Your Privacy Matters: We use our own and third-party cookies to improve your experience on our website. By continuing to use the website we understand that you accept their use. Cookie Policy
1105
Grid export to excel - new line in caption
posted

Hi.

I'm trying to export a grid to excel, the columns captions contains '\r\n', but the export does not export the caption into 2 lines.

I've try to repolace the \'r\n' to '\n', but it did not solve my problem:

private void _gridExporter_HeaderRowExporting(object sender, HeaderRowExportingEventArgs e)

{if (e.HeaderType == HeaderTypes.ColumnHeader)

{

foreach (UltraGridColumn col in e.Band.Columns)

{

col.Header.Caption = col.Header.Caption.Replace(
Environment.NewLine, "\n");

}

}

}

 Is this a bug (I'm using dll 2007.2).

Another small thing - the export does not show borders for the cells, how can I fix this?

 

 

  • 71886
    Offline posted

    Hello eligazit,

    You could try the following code sample in order to achieve this:

    ultraGrid1.DisplayLayout.Bands[0].Columns[0].Header.Caption = "Kind" + Environment.NewLine + "King"; ultraGrid1.DisplayLayout.Bands[0].ColHeaderLines = 2;

    As to the borders of the cells - this also works fine for me, so my advice is to try to update your version to the latest service release available and test your application against it.

    Please do not hesitate to ask if something comes up.