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
2745
Only export values and not formatting
posted

Hello!
I am using the Excel Export functionlity and I am wondering if it is possible to just export the a value in a grid cell straight into a cell in the excel file? Currently, the export functionality changes font, font size, colors etc. and makes some of our formulas in my excel file to stop working. Is there some specific setting that we can use to just focus on the value and not the formatting?

/Henrik

Parents
  • 29105
    Offline posted

    Hello Henrik, 

    Thank you for contacting Infragistics. With our WinGridExcelExporter, by default, the exporter will emulate what's seen in the grid over to excel. Note the exporter's ExportFormulas property is set to true by default. When true, the exporter will attempt to convert grid formulas into equivalent formulas in the exported worksheet. But it won't be 1:1 since DotNet and Excel differ. When false it will copy the value as seen in the grid. 

    The exporter has several events such as BeginExport and CellExporting that gives you access to the grid data before it is written into the Excel file, so you can perform pre-processing. You can also perform post-processing on the data after it has been written into the file by using the CellExported event. But to answer your question you can easily remove styles made to the file before the grid is exported by hooking BeginExport and calling some reset methods on the layout. 

    e.Layout.ResetOverride();
    e.Layout.ResetAppearance();

    For more details please visit:
    www.infragistics.com/.../wingridexcelexporter-export-grid-data-to-excel

Reply Children