When I try using Silverlight Excel engine to load excel documents, sometimes got the following error:
Not supported code pageParameter name: codePage at Infragistics.Silverlight.CodePageEncoding.GetEncoding(Int32 codePage) at Infragistics.Silverlight.Excel.SilverlightFixes.GetEncoding(Int32 codePage) at id.b(BinaryReader A_0, a A_1) at id.a(BinaryReader A_0, a A_1) at gq.a(BinaryReader A_0, a A_1) at id.c(BinaryReader A_0, a A_1) at id.b(Stream A_0) at Infragistics.Silverlight.Excel.DocumentProperties.b(ig A_0) at Infragistics.Silverlight.Excel.Workbook.a(Workbook A_0, Stream A_1, String A_2) at Infragistics.Silverlight.Excel.Workbook.a(Stream A_0, WorkbookFormat A_1, String A_2, IPackageFactory A_3, Boolean A_4) at Infragistics.Silverlight.Excel.Workbook.Load(Stream stream, IPackageFactory packageFactory, Boolean verifyExcel2007Xml) at Infragistics.Silverlight.Excel.Workbook.Load(Stream stream, IPackageFactory packageFactory) at Infragistics.Silverlight.Excel.Workbook.Load(Stream stream) at ExcelSL.MainPage.Button_Click(Object sender, RoutedEventArgs e)
I didn't found any information about code page in documentation. Which code page is supported now? And what can I do?
I have the same problem.
We cannot do a change in C# code :
...........
ExcelDataConnectionSettings excelDataSettings = new ExcelDataConnectionSettings { FileStream = fileStream, GeneratedTypeName = PivotGridStrings.XPG_ExcelFileDataSource_InitialCube, WorksheetName = PivotGridStrings.XPG_ExcelFileDataSource_WorksheetName }; ExcelDataConnectionSettings.AddExcelCellFormatMapping(PivotGridStrings.XPG_ExcelFileDataSource_ExcelFormatSrc, PivotGridStrings.XPG_ExcelFileDataSource_ExcelFormatDest); ExcelDataConnectionSettings.AddExcelDateTimeCellFormatMapping("d/m/yy;@", "M/d/yy"); flatDataSource.Cube = DataSourceBase.GenerateInitialCube(PivotGridStrings.XPG_ExcelFileDataSource_InitialCube);
..........
so it will import Excel documents saved with wrong encoding ?
You are right, and that's because Silverlight doesn't support these encoding.
We have our own implementations for Windows-1251 and Windows-1252 encodings.
You can try with any of them.
I have done some reading. Excel writes files using default Windows Ansi code page. In my case it is 1250. I have tried few silverlight libraries for parsing excel files but non of them could handle 1250 code page.
Finally I have decided to send file to server and deal with it using OleDbConnection. It is only solution that I see for now.
//edit
Problem occurred only with xls files. Xlsx where parsed without problem.
Can you post a sample which demonstrates the problem?
How can i set encoding in Excel to Unicode?
When I run sumple code and import xls file everything is ok.
When I save xls file on may computer then i get error about wrong encoding.
(xlsx files work fine)