I have formatted couple of Columns within the XAMDataGrid using the following Feature
<Style TargetType="{x:Type igEditors:XamNumericEditor}"> <Setter Property="Mask" Value="nnn,nnn,nnn,nnn.nn"/> <Setter Property="NullText" Value="-" /> </Style>
However when I export the Grid to Excel, the formatting of number is lost for e.g. the comma's go missing. Also huge numbers like 150000000000 are displayed as 1.5E+11. Numbers with decimal places as XXX.00 are displayed as XXX. When we manually change the format on the excelsheet to number, the value displayed is as desired.
I am not able to manually export each row and each column as the Grid might have grouping which we wish to have in the same format while export to excel.
Can you please help me with this?
Hi,
In to the local installed sample browser you can see all supported text format strings listed. The sample is called:
“Workbook Object Model” and is located under the Excel Engine -> Data in to sample browser.
I hope you find all formattings you need. Let me know if you have any furthered questions.
One further question to your response for Custom Excel Export Cell Style example.
I have a XamDataGrid shown on screen and based on various data triggers it has specific look and feel. Is it possible to export that situation (specific styled) in Excel?
Hi Dimi
In the sample project you attached earlier, how can I format percentage column?
is it possible to provide list of excel style formatting strings? Excel cells can be Number, Currency, accounting, Date, Time, Percent, Fractions, Scientific etc Can we specify .NET string formatting styles?
Hello Aniket,
I am just checking if the latest reply helped you out and if you require any further assistance on the matter.
If the above suggestion helped you solve your issue please verify the thread as answered so other users may take better advantage of it.
When exporting a formatted field the formatting are not exported in to excel, sice the format strings are different form the one you set in xamDataGrid. You can set the formatting during the exporting of the data by handling the CellExported event and set the corresponding formatting. You can set the same formatting that are valid for excel double numbers. See attached sample for your reference.
You can see more details in to the example “Workbook Object Model” under Excel engine in to Sample Browser. If you need to export the style of the fields you can look at the sample Custom Excel Export Cell Style under the XamDataGrid-> styles in to sample browser.
Hope this helps you.