Search code examples
delphidevexpressexport-to-exceldelphi-2009tcxgrid

Remove Band Separators when exporting CxGridBandedTableView to Excel


I have a TCxGrid (DevExpress) with a TCxGridDBBandedTableView. This view has 2 bands, and each band has its columns.

I use the ExportGridToExcel (from DevExpress's cxGridExportLink unit), to expot the grid to excel. Example:

Grid Configuration

  • Band 1:
  • => Column A
  • => Column B
  • Band 2:
  • => Column A
  • => Column B
  • => Column C

How the excel is being generated:

  • Column A (content of Band 1: Column A)
  • Column B (content of Band 1: Column B)
  • Column C (empty content, because here is where second band begins)
  • Column D (content of Band 2: Column A)
  • Column E (content of Band 2: Column B)
  • Column F (content of Band 2: Column C)

How I would like it to be:

  • Column A (content of Band 1: Column A)
  • Column B (content of Band 1: Column B)
  • Column C (content of Band 2: Column A)
  • Column D (content of Band 2: Column B)
  • Column E (content of Band 2: Column C)

Is there a way I could configure it not to consider "bands separators" as empty columns when generating excel?


Solution

  • I figured out my mistake. The problem is that I had these 2 bands, and my second band had FixedKind defined with fkLeft. I changed it to fkNone, and edited his Position.ColIndex property to zero (because I wanted it to be the first band). Thanks!