Hi,
When exporting to excel, if the ConverterOptions set to ColumnHeaders only, then the row headers were actually exported, if ConverterOptions set to RowHeaders only, what was exported is not row headers, but column headers.
Looking into the code in GridExcelConverterControl, I found the following:
...
int iRowDelta = ((options & ConverterOptions.RowHeaders) != 0) ? 1 : 0;
int iColumnDelta = ((options & ConverterOptions.ColumnHeaders) != 0) ? 1 : 0;
.....
int iMaxRow = Math.Min(WorksheetBaseImpl.DEF_MAX_ROW_ONE_INDEX,
grid.RowCount + iRowDelta);
int iMaxColumn = Math.Min(WorksheetBaseImpl.DEF_MAX_COLUMN_ONE_INDEX,
grid.ColCount + iColumnDelta);
It seems the logic is not right. If the option is RowHeaders only, that should mean one extra column (column 0) should be exported, not one extra row.
Please let me know if I missed something here.
Thanks,
Q
QS
Qingde Shi
June 12, 2007 04:38 PM UTC
Any comments?
>Hi,
When exporting to excel, if the ConverterOptions set to ColumnHeaders only, then the row headers were actually exported, if ConverterOptions set to RowHeaders only, what was exported is not row headers, but column headers.
Looking into the code in GridExcelConverterControl, I found the following:
...
int iRowDelta = ((options & ConverterOptions.RowHeaders) != 0) ? 1 : 0;
int iColumnDelta = ((options & ConverterOptions.ColumnHeaders) != 0) ? 1 : 0;
.....
int iMaxRow = Math.Min(WorksheetBaseImpl.DEF_MAX_ROW_ONE_INDEX,
grid.RowCount + iRowDelta);
int iMaxColumn = Math.Min(WorksheetBaseImpl.DEF_MAX_COLUMN_ONE_INDEX,
grid.ColCount + iColumnDelta);
It seems the logic is not right. If the option is RowHeaders only, that should mean one extra column (column 0) should be exported, not one extra row.
Please let me know if I missed something here.
Thanks,
Q
HA
haneefm
Syncfusion Team
June 12, 2007 11:14 PM UTC
Hi Q,
Sorry for the inconvenience caused. Right now, you can use ConverterOptions.RowHeaders enumeration to convert grid row headers into spreadsheet and use ConverterOptions.ColumnHeaders enumeration to convert grid column headers into spreadsheet.
Best regards,
Haneef
QS
Qingde Shi
June 13, 2007 02:10 PM UTC
Hi Haneef,
I am not quite sure I get what you said. Do you mean the codes I quoted was from older version (I used 4.4) which was not right, but now, in newer versions, that was fixed and should work as expected? So, I have to work around under my version.
>Hi Q,
Sorry for the inconvenience caused. Right now, you can use ConverterOptions.RowHeaders enumeration to convert grid row headers into spreadsheet and use ConverterOptions.ColumnHeaders enumeration to convert grid column headers into spreadsheet.
Best regards,
Haneef
HA
haneefm
Syncfusion Team
June 13, 2007 05:46 PM UTC
Hi Q,
You would have to derive the GridExcelConverterControl class and write your own GridToExcel method to work-around this issue. Here is a minimal sample that show this.
Sample :
GDBGExportRowHeader.zipBest regards,
Haneef