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
70
Different numeric formats in a single column, and Excel export
posted

I'm using 20.1.  I have a report which requires different numeric formats in the same column.  For example, one row is "percent of sales", which obviously needs to be formatted as percent, while other rows are formatted as currency.

After a lengthy search, I found that the only way to do this was to leave the columns unformatted, and apply an EditorWithText to the specific cells in InitializeRow, despite the fact that this is a read-only report.

(As an aside, I can't understand why it's possible to apply different CellAppearances in a single column, but not different numeric formats.)

In any case, the EditorWithText workaround worked.  But when I export the grid to Excel, there's no numeric formatting at all, because the export works on a column-by-column basis.

I'm already using ultraGridExcelExporter1_InitializeColumn to convert Ultragrid formats to Excel formats, and I'm using ultraGridExcelExporter1_ExportEnding to go into exported reports and autofit columns, since the exporter doesn't do that natively.  I'm happy to go into the the reports and apply formatting myself on a cell-by-cell basis, since the reports aren't very big.  But I can't do that, because I have no way to loop through grid columns in their display order.  The columns collection is in datasource order, which in my case *can't* be the same as display order.

Is there any way for me to loop through columns in the order in which they appear, visually, in the report?  Preferably non-hidden columns only, but I can allow for that myself if need be.

Parents Reply Children