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?
Hi treenode,
Supported encodings, based on the public help are "Besides the Unicode character encoding supported by Silverlight, the Excel Document Library supports Windows-1251 and Windows-1252 encodings."
Also in the last minutes we added Windows-31J (CP932)
So you can use any of these, for sure it will work if you save your excel page with Unicode.
Thanks,George
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)
Can you post a sample which demonstrates the problem?
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.
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.