Error loading template.xls

This line of code ... wb = ExcelUtils.Open(fileName) generates this error... System.InvalidCastException was caught Message="Unable to cast object of type ''Syncfusion.XlsIO.Parser.Biff_Records.Formula.MemFuncPtg'' to type ''Syncfusion.XlsIO.Parser.Biff_Records.Formula.IReference''." Source="Syncfusion.XlsIO.Base" StackTrace: at Syncfusion.XlsIO.Implementation.Charts.ChartSerieImpl.GetRange(ChartAIRecord chartAi) at Syncfusion.XlsIO.Implementation.Charts.ChartSerieImpl.Reparse() at Syncfusion.XlsIO.Implementation.Charts.ChartSerieImpl.Parse(IList data, Int32& iPos) at Syncfusion.XlsIO.Implementation.Charts.ChartImpl.ParseSeries(IList data, Int32& iPos) at Syncfusion.XlsIO.Implementation.Charts.ChartImpl.ParseChart(IList data, Int32& iPos) at Syncfusion.XlsIO.Implementation.Charts.ChartImpl.ParseData() at Syncfusion.XlsIO.Implementation.WorksheetBaseImpl.Parse() at Syncfusion.XlsIO.Implementation.Shapes.ChartShapeImpl.ParseClientData(MsofbtClientData clientData, ExcelParseOptions options) at Syncfusion.XlsIO.Implementation.Shapes.ShapeImpl.ParseRecord(ExcelParseOptions options) at Syncfusion.XlsIO.Implementation.Collections.ShapesCollection.AddShape(MsofbtSpContainer shapeContainer, ExcelParseOptions options) at Syncfusion.XlsIO.Implementation.Collections.ShapesCollection.AddShape(MsoBase shape, ExcelParseOptions options) at Syncfusion.XlsIO.Implementation.Collections.ShapesCollection.Parse(MsofbtSpgrContainer container, ExcelParseOptions options) at Syncfusion.XlsIO.Implementation.WorksheetBaseImpl.ParseMsoDgContainer(MsofbtDgContainer dgContainer, ExcelParseOptions options) at Syncfusion.XlsIO.Implementation.WorksheetBaseImpl.ParseMsoStructures(ArrayList arrStructures, ExcelParseOptions options) at Syncfusion.XlsIO.Implementation.WorksheetBaseImpl.ExtractMSODrawing(Int32 startIndex, ExcelParseOptions options) at Syncfusion.XlsIO.Implementation.WorksheetBaseImpl.Parse() at Syncfusion.XlsIO.Implementation.WorkbookImpl.ParseWorksheets() at Syncfusion.XlsIO.Implementation.WorkbookImpl.Parse(BiffReader reader, ExcelParseOptions options) at Syncfusion.XlsIO.Implementation.WorkbookImpl..ctor(IApplication application, Object parent, String FileName, ExcelParseOptions options) at Syncfusion.XlsIO.Implementation.ApplicationImpl.CreateWorkbook(Object parent, String strTemplateFile) at Syncfusion.XlsIO.Implementation.Collections.WorkbooksCollection.Open(String Filename) at Syncfusion.XlsIO.ExcelUtils.Open(String fileLocation) at AllocationManager.XlsFileUsingExcelRW.ExceRWCalcWorkbook.CreateFromXLS(String fileName) in C:\Talisman\PARS.NET\Apps\AllocationManager\ExceRWCalcWorkbook.vb:line 55 Looks like a bug to do with Charts. When I delete three pie charts the xls loads.

1 Reply

AD Administrator Syncfusion Team April 4, 2006 11:45 AM UTC

Hi Brian, I tried to reproduce the problem using this attached sample but was not able to see the problem. sample : 42610TemplateChart.zip The Sample will 1)Open a template file having a formula and a pie chart using code,wb = ExcelUtils.Open(fileName). 2)Edit the template file using XlsIO,by writing a value calculated using Calculate into the cell "B4" and insert a new pie chart to the template. Please take a look at the attachment.Let me know if this solves your issue. If not Could you please send us a template file in which you are having problem. Please let me know if you need any further assistance. Thanks, Bharath.

Loader.
Up arrow icon