Your Privacy Matters: We use our own and third-party cookies to improve your experience on our website. By continuing to use the website we understand that you accept their use. Cookie Policy
725
Formatting cells when exporting with DataPresenterExcelExporter
posted

I would like to customize the export

a) I would like exclude one of the columns from the original XamDataGrid

b) I would like to have specific numeric columns formatted "Scientific" like if I select cell/column in Excel and set number formatting to Scientific.

I am trying to handle exporter's CellExporting event, but not exactly knowing what to change currently without success

Thanks in advance.

Parents
No Data
Reply
  • 34430
    Offline posted

    Hello Justin,

    To exclude one of your columns from the original XamDataGrid, I would recommend setting the column’s visibility to Collapsed in the event handler that you are exporting the cell in. There are other ways of doing this, but most will create a blank column where that one would have been. To make it visible in the XamDataGrid again, just set the visibility of the column to Visible after the export is done.

    For the numeric columns being formatted to scientific, I would recommend setting the e.FormatSettings.FormatString if e.Field.DataType == double or int. You can set the format string to be in scientific notation. Below is a link to an MSDN article about format strings.

    FormatString Article: http://msdn.microsoft.com/en-us/library/0c899ak8(v=vs.110).aspx

    I have attached a sample application to demonstrate the above.

    Please let me know if you have any other questions or concerns on this matter.

    Sincerely,
    Andrew
    Developer Support Engineer I
    Infragistics Inc.
    www.infragistics.com/support

    XDGExcelExportCase.zip
Children