I'm using DataPresenterExcelExporter for export to Excel. For converting and formating values we using CellExported
exporter.CellExported += exporter_CellExported;
void exporter_CellExported(object sender, CellExportedEventArgs e) {
if (e.Value is SoumeType) doSoume();
}
But if e.Field is TemplateField, e.Value always return is string type. How to return original type of value (SoumeType) from TemplateField?
I found solution: e.Record.Cells[e.CurrentColumnIndex].Value. But, probably, this decision is not quite right.
Please advise a more correct solution.
Thank you.
Hello Igor,
Thank you for the code-snippet you have provided.
I tested the behavior you have described in regards to the constantly appearing string type for an excel exported cell value from a TemplateField and I was not able to reproduce it. You can test it by running the attached application and pressing the "Export to Excel" button.
<igDP:TemplateField.DisplayTemplate> <DataTemplate> <Border BorderThickness="0.5" BorderBrush="Red"> <TextBox Text="{igEditors:TemplateEditorValueBinding}" /> </Border> </DataTemplate></igDP:TemplateField.DisplayTemplate> <igDP:TemplateField.EditTemplate> <DataTemplate> <Border BorderThickness="1" BorderBrush="Green"> <TextBox Text="{igEditors:TemplateEditorValueBinding}" /> </Border> </DataTemplate></igDP:TemplateField.EditTemplate>
Would you please modify the sample application I have attached, so the issue is isolated and reproduced? Having this information will help me further investigate this matter for you.
If you have any questions, please let me know.