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.

turn on column header borders

Thread ID:

Created:

Updated:

Platform:

Replies:

63955 Jul 11,2007 06:52 PM Jul 12,2007 05:22 PM Windows Forms 4
loading
Tags: GridControl
John
Asked On July 11, 2007 06:52 PM


Hi,

Is there a way to set the column header borders so that they show up when exporting to excel?

haneefm [Syncfusion]
Replied On July 11, 2007 07:02 PM

Hi Code12345,

If you want to affect the column/row headers, handle the Model’s QueryCellInfo event, and set the appropriate style when row zero or column zero is requested.

private void Model_QueryCellInfo(object sender, GridQueryCellInfoEventArgs e)
{
if( e.RowIndex == 0 )
{
e.Style.Borders.All = new GridBorder(GridBorderStyle.Solid);
}
}

Best regards,
Haneef

John
Replied On July 11, 2007 07:18 PM


Hi Haneef,

Thanks for the input. =) I think I might just try to turn on the column header borders all the time. Could you provide an example of how to do this? Thanks!

haneefm [Syncfusion]
Replied On July 12, 2007 03:37 PM

Hi code12345,

You can conditionally turn ON the border by enable flag before call the GridToExcelExport method and disable it after GridToExcelExport method. You can try the code:

private void Model_QueryCellInfo(object sender, GridQueryCellInfoEventArgs e)
{
if( IsExcelExport && e.RowIndex == 0 )
{
e.Style.Borders.All = new GridBorder(GridBorderStyle.Solid);
}
}

Best regards,
Haneef

John
Replied On July 12, 2007 05:22 PM


Hi Haneef,

I would like to keep the column header borders on all the time and not just for exporting into excel. What property of the databoundgrid do I need to modify in order to accomplish this? Thanks!


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.

;