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

there is a error in export(workbook)

4 Answers 102 Views
Spreadsheet
This is a migrated thread and some comments may be shown as answers.
jafar
Top achievements
Rank 1
jafar asked on 07 Apr 2013, 07:25 AM
Hello
I have a error in export:
my code :
            var formatProvider = new XlsxFormatProvider();
            return formatProvider.Export(workbook);

and error:

{"The given key was not present in the dictionary."}

   at System.Collections.Generic.Dictionary`2.get_Item(TKey key)
   at Telerik.Windows.Documents.Spreadsheet.Core.DataStructures.QueueDictionary`2.get_Item(TKey key) in c:\TB\221\WPF_Scrum\Release_WPF\Sources\Development\Documents\Spreadsheet\Core\Core\DataStructures\QueueDictionary.cs:line 64

thanks

4 Answers, 1 is accepted

Sort by
0
Kammen
Telerik team
answered on 08 Apr 2013, 08:06 AM
Hello Jafar,

Is it possible to provide more information how to reproduce this issue. We need information about your setup and the steps you've executed in order to investigate the problem and fix it as soon as possible.

All the best,
Kammen
the Telerik team

Explore the entire Telerik portfolio by downloading Telerik DevCraft Ultimate.

0
sai
Top achievements
Rank 1
answered on 24 Mar 2015, 05:31 PM
Even I'm getting the same exception... I'm using latest dlls
Please find the attachment to reproduce the issue
Rename the extension from png to Xlsx
0
Tanya
Telerik team
answered on 27 Mar 2015, 03:05 PM
Hi Sai,

We tested the file you sent us and noticed that some of the number formats which it contains are not from the built-in ones and are not declared (its formatCode is not specified), which is the cause of the behavior. If you unzip the file and open the styles.xml part, you will find there is a list of elements similar to this one:
<xf numFmtId="44" fontId="1" fillId="0" borderId="0" applyFont="0" applyFill="0" applyBorder="0" applyAlignment="0" applyProtection="0" />

Some of these elements refer to definitions of formats which are not in-built, but are not defined in the file either. The missing definitions are for the following number formats' IDs: 41, 42, 43 and 44. You can either remove those elements or you can add definitions for them. You can refer to the snippet below which shows how to add the format code for a number format:
<numFmts count="1">
  <numFmt numFmtId="44" formatCode="[here goes the format code for this number format]"/>
</numFmts>

Unfortunately, since we are not sure how the file was generated, we don't know what the missing format strings are.
 
For reference, you could check this MSDN thread where the built-in format codes are discussed.

However, this file is quite strange and it will be great if you share how it was produced.

Regards,
Tanya
Telerik
 

See What's Next in App Development. Register for TelerikNEXT.

 
0
sai
Top achievements
Rank 1
answered on 30 Mar 2015, 12:22 PM
Thanks a lot Tanya for your Reply.
We use Aspose Cells(Third party Tool for Exporting and updating Excel content) from which we generated this Excel.

Thanks,
sai
Tags
Spreadsheet
Asked by
jafar
Top achievements
Rank 1
Answers by
Kammen
Telerik team
sai
Top achievements
Rank 1
Tanya
Telerik team
Share this question
or