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. Image for the cookie policy date
close icon

Error when trying to export to excel

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

3 Replies

RS Rajarajeswari S Syncfusion Team October 24, 2008 07:33 AM UTC

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





PW Perry Way October 30, 2008 08:43 PM UTC

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




MS Mohamed Suhaib Fahad A. Syncfusion Team November 1, 2008 02:18 AM UTC

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.,




Loader.
Live Chat Icon For mobile
Up arrow icon