I need to export the same format as what I display. I am wiring up the CellExportingEvent. I am not sure how I should translate the formats in this event.
<igDp:Field HorizontalContentAlignment="Right" Format="G4" .../><igDp:Field HorizontalContentAlignment="Right" Format="F2" .../>
To keep the formats in the UI and this event consistent, I tried binding the Format property to a string on the UI and use the same string in the event. But it is not working. How can I do this?
public string FormatF2{ get{return "F2";}}
<igDp:Field HorizontalContentAlignment="Right" Format="{Binding FormatF2"} Name="score".../>
protected override void FormatCell(object sender, CellExportingEventArgs e){ switch (e.Field.Name) { case "score": e.FormatSettings.FormatString = FormatF2; // This does not work
// e.FormatSettings.FormatString = e.Field.Format // This does not work either break; }}
Hello Lala,
The Excel could not correctly transform the “F2” format string in order to display two digits after the separator. If the FormatF2 property is set like this “0.00”, e.FormatSettings.FormatString = FormatF2 will also apply the format in the exported workbook.
More information about the Excel format support can be found at https://support.office.com/en-us/article/Create-or-delete-a-custom-number-format-78f2a361-936b-4c03-8772-09fab54be7f4 .
Please do not hesitate to let me know if you have any other questions.