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

Export to Excel error

Hi, I am trying to use the GroupingGridExcelConverter to export to Excel. But when I do, I get an error. Here is the code I use for converting:

Dim converter As Syncfusion.GroupingGridExcelConverter.GroupingGridExcelConverterControl = New Syncfusion.GroupingGridExcelConverter.GroupingGridExcelConverterControl()
converter.GroupingGridToExcel(Me.GridGroupingControl1, FilePhysicalPath, Syncfusion.GridExcelConverter.ConverterOptions.Default)

And, here is the error:

Font.Size out of range. Size must be less then 409 and greater than 1.
Parameter name: Font.Size
Actual value was 0.
Description: An unhandled exception occurred during the execution of the current web request. Please review the stack trace for more information about the error and where it originated in the code.

Exception Details: System.ArgumentOutOfRangeException: Font.Size out of range. Size must be less then 409 and greater than 1.
Parameter name: Font.Size
Actual value was 0.


Where do I set the Font.Size that it is complaining about?

Thanks.

9 Replies

SD Sarathi D Syncfusion Team August 30, 2007 08:13 PM UTC

Hi Kathy,

Thank you for posting your query to us.

I am afraid that I am not able to reproduce your issue. I have attached the sample under which I tried to reproduce the issue and the sample is available here.

http://websamples.syncfusion.com/samples/Grid.Windows/67659/main.htm


Please have a look at the above sample and if still the issue exists, could you please try reproducing it
in the above sample or send us the reproducing steps so that we could sort out the cause of the issue
and provide you a solution?

Regards,
Sarathi


KG Kathy Gray August 30, 2007 09:07 PM UTC

The project at this address is a vb.net project. I am using this in asp.net. Would it be the same code?


SD Sarathi D Syncfusion Team September 5, 2007 01:07 AM UTC

Hi Kathy,

I have created a sample that converts a grid data to Excel sheet. The sample is available in the following link.

http://www.syncfusion.com/Support/user/uploads/ExcelExport_VB_c19be0b0.zip

Please run the sample and let me know if this helps you.

Regards,
Sarathi


PW Perry Way May 1, 2008 10:34 PM UTC

I am getting the same exact error. Only I am getting it trying to convert from a web grid, not a windows grid. I am also using your exact example on your website on how to go about exporting. The only difference in the code below is I have changed the name of the grid on my web page to "grdDefault". This is C# code. I have about one hour remaining today before I am expected to present my findings on should we dump Infragistics libraries and completely migrate our code to Syncfusion's. This is the only thing holding up my ability to finish my proposal. It would be wonderful if I could get a reply on this today, not only for the company I work for but also for Syncfusion. Now is your time time shine, given the problems we've been having with Infragistics. You need to shine all the way in order for me to convince the powers that be that we should migrate to Syncfusion. Thanks, Perry



GroupingGridExcelConverterControl ggExcelConverter = new GroupingGridExcelConverterControl();
// ExcelEngine provides access to XLSIO application interface
ExcelEngine excelEngine = new ExcelEngine();
IApplication application = excelEngine.Excel;
// Excel workbook
IWorkbook myWorkbook = excelEngine.Excel.Workbooks.Add();
IWorksheet mySheet1 = myWorkbook.Worksheets[0];
// To convert only the visible contents , set ConverterOptions to Visible
ggExcelConverter.GroupingGridToExcel(this.grdDefault, mySheet1, ConverterOptions.Visible);
myWorkbook.SaveAs("Sample.xls", ExcelSaveType.SaveAsXLS, Response, ExcelDownloadType.PromptDialog);
excelEngine.ThrowNotSavedOnDestroy = false;
excelEngine.Dispose();






>Hi Kathy,

Thank you for posting your query to us.

I am afraid that I am not able to reproduce your issue. I have attached the sample under which I tried to reproduce the issue and the sample is available here.

http://websamples.syncfusion.com/samples/Grid.Windows/67659/main.htm


Please have a look at the above sample and if still the issue exists, could you please try reproducing it
in the above sample or send us the reproducing steps so that we could sort out the cause of the issue
and provide you a solution?

Regards,
Sarathi




AD Administrator Syncfusion Team May 2, 2008 12:07 AM UTC

Try explicitly setting the fontsize property on your grid using code similar to this to see if this will resolve this issue:

Me.GridGroupingControl1.Appearance.AnyCell.Font.Size = 10




PW Perry Way May 2, 2008 05:50 PM UTC

Yes, this worked, however it is showing black background with black fonts. I think I will continue this post in your Direct-Trac system for the other issues. Thanks,Perry

>Try explicitly setting the fontsize property on your grid using code similar to this to see if this will resolve this issue:

Me.GridGroupingControl1.Appearance.AnyCell.Font.Size = 10






GP Greg Persson July 24, 2008 05:30 PM UTC

I'm having the exact same problem: First the exception, then the black font on black background. Was there a resolution for this?

>Yes, this worked, however it is showing black background with black fonts. I think I will continue this post in your Direct-Trac system for the other issues. Thanks,Perry

>Try explicitly setting the fontsize property on your grid using code similar to this to see if this will resolve this issue:

Me.GridGroupingControl1.Appearance.AnyCell.Font.Size = 10








PP Pierre Pichard October 9, 2008 07:52 AM UTC

I've exactly the same problem.
Did somebody resolve it?



RS Rajarajeswari S Syncfusion Team October 10, 2008 09:22 AM UTC

Hi Denis,

Thanks for using Syncfusion products.

We have included some new features for ExcelExporting with our Vol 4 release. All formatting and Autoformat skins are exported to the Excel file. It won't throw any exception, and also there is no black background.

We will be updating you with the download link, once it is published.

Thanks for your patience.



Loader.
Live Chat Icon For mobile
Up arrow icon