This is a migrated thread and some comments may be shown as answers.

ExcelBiff Export error: value of 0 is not valid for emSize

3 Answers 155 Views
Grid
This is a migrated thread and some comments may be shown as answers.
FvLent
Top achievements
Rank 2
FvLent asked on 16 Aug 2012, 12:04 PM
Hello,
I have a Telerik RadGrid in a user control.
When I use the Excel Export, with ExportSettings:
    <ExportSettings>
            <Excel Format="Biff" />
    </ExportSettings
I recieve the following message:

Value of '0' is not valid for 'emSize'. 'emSize' should be greater than 0 and less than or equal to System.Single.MaxValue.
Parameter name: emSize


When I change the Format to Html it works, but I get the warning that the File Extension is wrong.

Also, when I use the same grid (with Format=Biff) in a ASPX file direcly instead of a user control, it works OK

Can anybody tell me what to do to have the BiffExport work in a user control?

This is the Trace when the error occurs:
  
at System.Drawing.Font.Initialize(FontFamily family, Single emSize, FontStyle 
style, GraphicsUnit unit, Byte gdiCharSet, Boolean 
gdiVerticalFont)<BR>   at System.Drawing.Font.Initialize(String 
familyName, Single emSize, FontStyle style, GraphicsUnit unit, Byte gdiCharSet, 
Boolean gdiVerticalFont)<BR>   at System.Drawing.Font..ctor(String 
familyName, Single emSize)<BR>   at 
Telerik.Web.UI.ExcelBiff.Font.GetData()<BR>   at 
Telerik.Web.UI.ExcelBiff.Workbook.AddFontRecordToList(Font font)<BR>   
at Telerik.Web.UI.ExcelBiff.StyleHandler.GetFontIndex(Cell cell)<BR>   
at Telerik.Web.UI.ExcelBiff.StyleHandler.GetXFIndex(Cell cell)<BR>   
at Telerik.Web.UI.ExcelBiff.Cell.CreateBiffCell()<BR>   at 
Telerik.Web.UI.ExcelBiff.Worksheet.WriteRowBlocksAndCells(Stream stream, Int32 
lastRow, UInt32 indexRecOffsetsStart, Int32 firstCol, Int32 
lastCol)<BR>   at Telerik.Web.UI.ExcelBiff.Worksheet.Write(Stream 
stream)<BR>   at Telerik.Web.UI.ExcelBiff.Workbook.Save(Stream 
stream)<BR>   at 
Telerik.Web.UI.ExportInfrastructure.XlsBiffRenderer.Render()<BR>   at 
Telerik.Web.UI.Grid.Export.TableViewExporter.ExcelExportRenderForm(HtmlTextWriter 
nullWriter, Control form)<BR>   at 
System.Web.UI.Control.RenderChildrenInternal(HtmlTextWriter writer, ICollection 
children)<BR>   at 
System.Web.UI.HtmlControls.HtmlForm.RenderChildren(HtmlTextWriter 
writer)<BR>   at 
System.Web.UI.HtmlControls.HtmlContainerControl.Render(HtmlTextWriter 
writer)<BR>   at 
System.Web.UI.HtmlControls.HtmlForm.Render(HtmlTextWriter 
output)<BR>   at 
System.Web.UI.Control.RenderControlInternal(HtmlTextWriter writer, 
ControlAdapter adapter)<BR>   at 
System.Web.UI.Control.RenderControl(HtmlTextWriter writer, ControlAdapter 
adapter)<BR>   at 
System.Web.UI.HtmlControls.HtmlForm.RenderControl(HtmlTextWriter 
writer)<BR>   at 
Telerik.Web.UI.Grid.Export.TableViewExporter.ExcelExportRenderPage(HtmlTextWriter 
nullWriter, Control page)<BR>   at 
System.Web.UI.Control.RenderChildrenInternal(HtmlTextWriter writer, ICollection 
children)<BR>   at System.Web.UI.Control.RenderChildren(HtmlTextWriter 
writer)<BR>   at System.Web.UI.Page.Render(HtmlTextWriter 
writer)<BR>   at 
System.Web.UI.Control.RenderControlInternal(HtmlTextWriter writer, 
ControlAdapter adapter)<BR>   at 
System.Web.UI.Control.RenderControl(HtmlTextWriter writer, ControlAdapter 
adapter)<BR>   at System.Web.UI.Control.RenderControl(HtmlTextWriter 
writer)<BR>   at 
Telerik.Web.UI.RadAjaxControl.RenderPageInAjaxMode(HtmlTextWriter writer, 
Control page)<BR>   at 
System.Web.UI.Control.RenderChildrenInternal(HtmlTextWriter writer, ICollection 
children)<BR>   at System.Web.UI.Control.RenderChildren(HtmlTextWriter 
writer)<BR>   at System.Web.UI.Page.Render(HtmlTextWriter 
writer)<BR>   at 
System.Web.UI.Control.RenderControlInternal(HtmlTextWriter writer, 
ControlAdapter adapter)<BR>   at 
System.Web.UI.Control.RenderControl(HtmlTextWriter writer, ControlAdapter 
adapter)<BR>   at System.Web.UI.Control.RenderControl(HtmlTextWriter 
writer)<BR>   at 
Telerik.Web.UI.RadAjaxControl.RenderPageInAjaxMode(HtmlTextWriter writer, 
Control page)<BR>   at 
System.Web.UI.Control.RenderChildrenInternal(HtmlTextWriter writer, ICollection 
children)<BR>   at System.Web.UI.Control.RenderChildren(HtmlTextWriter 
writer)<BR>   at System.Web.UI.Page.Render(HtmlTextWriter 
writer)<BR>   at 
System.Web.UI.Control.RenderControlInternal(HtmlTextWriter writer, 
ControlAdapter adapter)<BR>   at 
System.Web.UI.Control.RenderControl(HtmlTextWriter writer, ControlAdapter 
adapter)<BR>   at System.Web.UI.Control.RenderControl(HtmlTextWriter 
writer)<BR>   at System.Web.UI.Page.ProcessRequestMain(Boolean 
includeStagesBeforeAsyncPoint, Boolean includeStagesAfterAsyncPoint)<BR>

Regards,

Frank

3 Answers, 1 is accepted

Sort by
0
Daniel
Telerik team
answered on 21 Aug 2012, 11:46 AM
Hello Frank,

Could you please provide a simple (self-contained) demo showing this problem? Alternatively you could post the code here in the forum.

Thanks,
Daniel
the Telerik team
If you want to get updates on new releases, tips and tricks and sneak peeks at our product labs directly from the developers working on the RadControls for ASP.NET AJAX, subscribe to their blog feed now.
0
FvLent
Top achievements
Rank 2
answered on 21 Aug 2012, 03:34 PM
Hi Daniel,
Thank you for your response.
I was making an example page when I found the underlying cause.
I used a GridBoundColumn with HeaderStyle-Font-Size.
Removing that property made the export work.
Can you try to make a demo project yourself with a GridBoundColumn with using the property HeaderStyle-Font-Size and test it?
I don't expect it has anything to do with the fact that I use it in a web user control.

<telerik:GridBoundColumn DataField="Expr1"  UniqueName="col1" HeaderStyle-Width="250px" HeaderStyle-Font-Size="Smaller" MaxLength="100" />




Regards,
Frank



0
Daniel
Telerik team
answered on 24 Aug 2012, 12:10 PM
Hello Frank,

Thank you for reporting this bug. Our developers have fixed it already. In the upcoming service pack RadGrid will be able to handle the strongly typed relative units like smaller, small, xxlarge and the like.
We have updated your Telerik points as a token of gratitude for your cooperation.

Best regards,
Daniel
the Telerik team
If you want to get updates on new releases, tips and tricks and sneak peeks at our product labs directly from the developers working on the RadControls for ASP.NET AJAX, subscribe to their blog feed now.
Tags
Grid
Asked by
FvLent
Top achievements
Rank 2
Answers by
Daniel
Telerik team
FvLent
Top achievements
Rank 2
Share this question
or