Dear Team,
I have a WPF app (vb.net) where i use radgridview. Virtualization is on because we have more hundreds of rows, and in the CELLLOADED event i color the cell backgrounds based on cell content.
The result is something like this: (attached: mapps.jpg)
The customer wants me to create excel output, including the colors. I browsed a lot of forums and i found multiple approaches but the result is always the same. The background is colored, but all column inherits the color of the first row. (attached: excel.jpg)
Sub ExcelExport_Colored(rgv As RadGridView)
Dim workbook As Workbook = rgv.ExportToWorkbook(New GridViewDocumentExportOptions() With {
.ExportDefaultStyles = True,
.AutoFitColumnsWidth = True,
.ShowColumnHeaders = True})
Dim dialog As SaveFileDialog = New SaveFileDialog()
dialog.DefaultExt = "xlsx"
dialog.Filter = String.Format("{1} files (*.{0})|*.{0}|All files (*.*)|*.*", "xlsx", "Excel")
dialog.FilterIndex = 1
If dialog.ShowDialog() = True Then
Dim provider = New XlsxFormatProvider()
Using output = dialog.OpenFile()
provider.Export(workbook, output)
End Using
End If
Dim excelPath2 As String = Registry.GetValue("HKEY_LOCAL_MACHINE\SOFTWARE\Microsoft\Windows\CurrentVersion\App Paths\excel.exe",
"Path", "Key does not exist")
Microsoft.VisualBasic.Interaction.Shell(excelPath2 & "EXCEL.EXE /e/min """ & dialog.FileName & """", AppWinStyle.NormalFocus)
End Sub
I tried other export options as well, like radgridview.export, radgridview.exporttoxlsx.. all give the same result or worse.
Can you give any advice how to achieve it? I don't insist to the icons, if i could export the data with bgcolors i would be happy already.
Thank you !!
Peter