We use cookies to give you the best experience on our website. If you continue to browse, then you agree to our privacy policy and cookie policy.
Unfortunately, activation email could not send to your email. Please try again.

Grid Export Headers

Thread ID:

Created:

Updated:

Platform:

Replies:

62187 Jun 8,2007 08:34 PM Jun 13,2007 01:46 PM Windows Forms 4
loading
Tags: GridControl
Qingde Shi
Asked On June 8, 2007 08:34 PM

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

Qingde Shi
Replied On June 12, 2007 12:38 PM

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

haneefm [Syncfusion]
Replied On June 12, 2007 07:14 PM

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

Qingde Shi
Replied On June 13, 2007 10:10 AM

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

haneefm [Syncfusion]
Replied On June 13, 2007 01:46 PM

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.zip

Best regards,
Haneef

CONFIRMATION

This post will be permanently deleted. Are you sure you want to continue?

Sorry, An error occured while processing your request. Please try again later.

You are using an outdated version of Internet Explorer that may not display all features of this and other websites. Upgrade to Internet Explorer 8 or newer for a better experience.

;