We use cookies to give you the best experience on our website. If you continue to browse, then you agree to our privacy policy and cookie policy.
Unfortunately, activation email could not send to your email. Please try again.
Syncfusion Feedback

Error when trying to export to excel

Thread ID:

Created:

Updated:

Platform:

Replies:

77287 Oct 23,2008 01:18 PM Oct 31,2008 10:18 PM ASP.NET Web Forms (Classic) 3
loading
Tags: GridGroupingControl
Rafiq
Asked On October 23, 2008 01:18 PM

Hi,

We are using Essential Studio v.6.3.1.8. When I try to export the grid data to excel I am getting an error "Font.Size out of range. Size must be less then 409 and greater than 1.
Parameter name: Font.Size
Actual value was 0.". Please find the attached file for more details. The following code I used for export task.

GroupingGridExcelConverterControl ggExcelConverter = new GroupingGridExcelConverterControl();
ExcelEngine excelEngine = new ExcelEngine();
IApplication application = excelEngine.Excel;
IWorkbook myWorkbook = excelEngine.Excel.Workbooks.Create(2);
IWorksheet mySheet = myWorkbook.Worksheets[0];
//ggExcelConverter.AutofitColumns = true; // used to Autofit the Excel columns
//ggExcelConverter.AutofitRows = true; // used to Autofit the Excel rows
//ggExcelConverter.GroupingGridToExcel(myWorkbook,this.sgInventory, mySheet, ConverterOptions.Visible);
ggExcelConverter.GroupingGridToExcel(this.sgInventory, mySheet, Syncfusion.GridExcelConverter.ConverterOptions.Visible);
myWorkbook.SaveAs("Color.xls", ExcelSaveType.SaveAsXLS, Response, ExcelDownloadType.PromptDialog);

Please reply me ASAP.

Thanks,
Rafiq



ScreenShot016_8b05784.zip

Rajarajeswari S [Syncfusion]
Replied On October 24, 2008 03:33 AM

Hi Rafiq,

Thanks for using Syncfusion products.


With version 6.3.1.8, we have the Excel export feature implemented with full support to the auto-formats present in the Grid.

Please refer the sample from below link:

http://websamples.syncfusion.com/samples/Grid.Web/6.3.1.8/Grid_Web_ExcelExport/main.htm




In the above sample the App_Code contains the following files which has the code for EcelExport
. GridBaseExport -Common Base class for Excel export.
. GridExcelExport -Class which has been inherited from the base class, initialize the Excel file and export the data with styles.

The export() presents inside the GridExcelExport class. This is the method which actually exports the Grid data to the Excel sheet. Please refer the below code snippet which illustrates this:

ExcelExport:
GridExcelExport excel = new GridExcelExport(this.GridGroupingControl1, "excel.xls");
excel.Export();


The GridExcelExport class constructors accepts the following as its arguments:
1. The Grid object, which is going to be exported.
2. Name of the file to which the data is going to be exported.

The GridExcelExport class contains the following properties.
. AutoFormat - Return the "AutoFormat" applied to the Grid.
. UseAutoFormat - Return true if AutoFormat is set to the Grid else false.
. ExportNestedTable - If it is set to "False" Nestedtables can't be exported. By default it is "true".
. FileName - Return the name of the exported file.
. GridGroupingControl - Return the name of the exported file.


Also, we are happy to inform you that, we have new feature implemented for ExcelExport and WordExport in our Vol 4 release. Now all these export features are shipped with Grid.Grouping.Web assemblies itself, gridconverter.web assemblies are not required, which makes the process more easier.


Could you please upgrade to our latest Vol 4 release (6.4.0.15) and try the ExcelExport? You can Download the version from the below link:

http://www.syncfusion.com/downloads/latestversion/default.aspx


Once if you installed it, the samples will be loaded on the disk, in the following location:

C:\Documents and Settings\{User Name} \My Documents\Syncfusion\EssentialStudio\6.4.0.15\Web\grid.grouping.web\Samples\2.0\ExportingAndPrinting\Export\CS

Please have a look at this, and let us know if this helps you out.

Regards,
Raji




Perry Way
Replied On October 30, 2008 04:43 PM

Hi Raji,

When I tried using v6.3.1.8 with the provided class files, It's not exporting data into excel if grid has summary row. But with no summary rows, its working fine.

Thanks,
Perry



Mohamed Suhaib Fahad A. [Syncfusion]
Replied On October 31, 2008 10:18 PM

Hi Perry,

Thanks for the details.

Since this is a defect you have mentioned, I would like you to create a new DTrac incident for further follow up on this.

Thanks,
Fahad
ASP.NET Grid Team
Syncfusion Inc.,




CONFIRMATION

This post will be permanently deleted. Are you sure you want to continue?

Sorry, An error occured while processing your request. Please try again later.

Warning Icon You are using an outdated version of Internet Explorer that may not display all features of this and other websites. Upgrade to Internet Explorer 8 or newer for a better experience.Close Icon

;