Win7, Vs2010 , silverlight 4
Hi, When i try to run this code, it trows exception like that "The type initializer for 'SR' threw an exception." on Workbook.Load().
Code from http://help.infragistics.com/Help/NetAdvantage/Silverlight/2010.2/CLR4.0/html/SL_Getting_Started_with_Infragistics_Excel_Engine.html
private void Button_Click(object sender, RoutedEventArgs e){ OpenFileDialog openfileDialog = new OpenFileDialog(); Workbook workbook1; // Open dialog if (openfileDialog.ShowDialog() == true) { // If user selected a file get the stream of that file FileStream stream = openfileDialog.File.OpenRead(); // Load workbook with data workbook1 = Workbook.Load(stream); stream.Close(); } }
private
void
object
new
// Open dialog
if
true
// If user selected a file get the stream of that file
// Load workbook with data
i am just going to update this page because i almost wasted an half day for this issue and infragistic help forume and support really is not good in helping us so we have to help eachother .
Guys ! if you are getting this error you just need go and install "System.Text.Encoding.CodePages" from Nuget and them put " Encoding.RegisterProvider(CodePagesEncodingProvider.Instance);" where you are reading the stream .
that is ALL !!!!
this error causes due to problem of reading Encode 1225 and would be solved by this solution only