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
1090
How do I export the text (instead of value) for a combo editor field?
posted

Hey,

I want to export a grid that has combo editor fields.  My problem is that, by default, it is exporting the values and not the display members. 

Looking at the excel exporter, I saw that it has a CellExporting event where I can set a custom Value on the event args.  I'm guessing that this would be the ideal spot for me to somehow grab the text?  My problem is that CellValuePresenter.FromRecordAndField returns null here.  I want to use CellValuePresenter.Editor.Text as the Value.  Am I doing something wrong?  In the worst case, I suppose I could use the Cell's value to key into my drop down list and get out the displayed text myself -- is this my best option?

Thanks

Parents
No Data
Reply
  • 54937
    Verified Answer
    Offline posted

    This doesn't seem like correct behavior. I would have expected the display text for this field to have been exported but I have submitted an issue for this so the matter can be investigated further. In the interim you could try handling the CellExported event and set the worksheet cell's value directly. e.g.

    void ex_CellExported(object sender, CellExportedEventArgs e)
    {
    e.CurrentWorksheet.Rows[e.CurrentRowIndex].Cells[e.CurrentColumnIndex].Value = 
    e.Record.GetCellText(e.Field);
    }

     

Children