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
1945
Translatation: True / False for boolean fields
posted

Hi

I'm exporting the grid's values and I need to have the boolean values translated. How should I do this?

Parents
  • 28407
    posted

    HI,

     Wire up the Exporter's CellExported Event and change the cell value

     Here is the code snippets:
     

     DataPresenterExcelExporter exporter = new DataPresenterExcelExporter();

      ExportOptions eo = new ExportOptions();

       exporter.CellExporting += new EventHandler<CellExportingEventArgs>(exporter_CellExporting);

      exporter.CellExported += new EventHandler<CellExportedEventArgs>(exporter_CellExported);

      exporter.Export(this.xgrid1, "xamDataPresenter1.xlsx", WorkbookFormat.Excel2007,eo);

     void exporter_CellExported(object sender, CellExportedEventArgs e)    

         {

                if (e.Field.Name == "Married")  

               {                 if (e.Value.ToString().ToUpper() == "TRUE")  

                       e.CurrentWorksheet.Rows[e.CurrentRowIndex].Cells[e.CurrentColumnIndex].Value = "Married";  

                   else   

                      e.CurrentWorksheet.Rows[e.CurrentRowIndex].Cells[e.CurrentColumnIndex].Value = "Single";       

          }             //throw new NotImplementedException();                    }

     

Reply Children
No Data