Reputation: 363
I'm trying to export a DevExpress grid in Excel. The trouble I'm having is that either I export the grid in text mode which preservesthe formating I have previously applied to the grid but prevents me from doing some sums on columns (because they the cells are considered text and not values), OR, I export in value mode which allows me to later do sums in the excel file but loses the formatingthat I had previously applied.
I would like to BOTH keep the formating that I have previously applied on grid AND be able to do sums on columns.
This is one of the ways I've tried to export the grid:
Using link As New PrintableComponentLink(New PrintingSystem())
Dim options As New XlsxExportOptionsEx
options.ExportType = DevExpress.Export.ExportType.DataAware
options.TextExportMode = TextExportMode.Value 'Should set to Value to be able to have the numbers displayed as numbers instead of text.
options.AllowCellMerge = DefaultBoolean.False
link.Component = gcInvisibleDetail
link.CreateDocument(link.PrintingSystem)
link.ExportToXlsx(tbRepertoire.Text & "\Charges.xlsx", options)
End Using
Upvotes: 0
Views: 345
Reputation: 363
Ended up just using the following line that fixed all my problems: gridview.ExportToXlsx(file)
Upvotes: 2