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
138
UltreGrid Excel Exporter (WinForms): Add many blank columns
posted

Hi

I am using Infragistics4.Documents.Excel.v19.1


I have a table with two bands.

I want to insert some blank columns in the child band in order to better align child information.

Child band real column list is:

C1 (hidden), C2 (hidden), C3, C4, C5, C6, C7

What I want to achieve (into the Excel file) is:

Blank, Blank, Blank, Blank, Blank, Blank, C3, Blank, Blank, Blank, C4, C5, C6, C7

I handled the ExportStarted event and added the needed empty columns but the results are not as expected.

I used e.Layout.Bands[1].Columns.Insert(3, "EmptyX") to insert 3 empty columns between C3 and C4 and  then e.Layout.Bands[1].Columns.Insert(2, "EmptyX") to insert 6 columns before C3:
e.Layout.Bands[1].Columns.Insert(3, "Empty7");
e.Layout.Bands[1].Columns.Insert(3, "Empty8");
e.Layout.Bands[1].Columns.Insert(3, "Empty9");
e.Layout.Bands[1].Columns.Insert(2, "Empty1");
e.Layout.Bands[1].Columns.Insert(2, "Empty2");
e.Layout.Bands[1].Columns.Insert(2, "Empty3");
e.Layout.Bands[1].Columns.Insert(2, "Empty4");
e.Layout.Bands[1].Columns.Insert(2, "Empty5");
e.Layout.Bands[1].Columns.Insert(2, "Empty6");

The result is

Blank (indentation), Empty6, C3, Empty5, C4, Empty4, C5, Empty3, C6, Empty2, C7, Empty1, Empty9, Empty8, Empty7

I used e.Layout.Bands[1].Columns.Insert(0, "EmptyX") to insert 9 empty columns before the original ones:
e.Layout.Bands[1].Columns.Insert(0, "Empty1");
e.Layout.Bands[1].Columns.Insert(0, "Empty2");
e.Layout.Bands[1].Columns.Insert(0, "Empty3");
e.Layout.Bands[1].Columns.Insert(0, "Empty4");
e.Layout.Bands[1].Columns.Insert(0, "Empty5");
e.Layout.Bands[1].Columns.Insert(0, "Empty6");
e.Layout.Bands[1].Columns.Insert(0, "Empty7");
e.Layout.Bands[1].Columns.Insert(0, "Empty8");
e.Layout.Bands[1].Columns.Insert(0, "Empty9");

The result is:

Blank (indentation), Empty9, Empty8, Empty7, C3, Empty6, C4, Empty5, C5, Empty4, C6, Empty3, C7, Empty2, Empty1

I also tried using e.Layout.Bands[1].Columns.Indentation = 6 to achieve at least the first part of my goal but it doesn't work as expected

I also tried to use e.Layout.Bands[1].Columns[x].ColSpan but it gets ignored

Additionally, I handled BeginExport event (which gets handled after ExportStarted) in order to change column visibility. At the end of this event handler I checked the childband's column list and it seems as expected (6 blanks, 2 hiddens, C3, 3 blanks, C4, C5, C6, C7).

Could someone please help me?

Thanks

Parents Reply Children
No Data