Hi,
I discovered an export to Excel is failing in a specific case when using a multiband grid. It's too specific to explain, but my attached sample project demonstrates the problem.
If you run my program and export the grid data to Excel, the rows containing 'Item 1.1.2' and below are placed two cells too far to the right (they should start in column A).
I know the layout is doing unusual things like adding dummy columns in the first band and hiding the column headers of the other bands, but this creates the visual result the product owner requires.
Well, I did mention it in my first reply. :)
Thanks again!
TorX said:the product owner would like to see indentation in Excel after all
Ah, okay. That was the key piece I was missing.
Yes, you could just use the BeginExport event and set ColHeadersVisible to true on the export layout so that the column headers display in the export and not on the screen.
I mean the columns 'Description' and 'Score' I add to the root band in SetLayout. Those properties do not exist in Category, that's why I call them dummy columns.
First of all, as I mentioned the work around works great in v10.3. So we are going to use that for now. However, in hindsight the product owner would like to see indentation in Excel after all. So when we update Infragistics in the future, we can remove the workaround and have the correct indentation in Excel.
However, this will mean that the subcategory name will be in column B (= 'description' in the root band) and the item name will be in column C (= 'score' of the root band). Furthermore, the headers (in Excel row #1) 'description' and 'score' don't make sense anymore. But I think I can fix it by showing the column headers for the child bands (and removing those dummy columns), so each band gets their own column headers.
If you still don't understand it, then never mind... I will cross that bridge when I come to it.
I'm still not following you at all. What "dummy columns" are you referring to? I don't see any in the sample you posted here.
I have no idea what you are talking about. The workaround I provided here produces exactly the same results in both versions - one set of column headers for the root-level rows and then no column headers on the child rows. And the columns all line up. So... what's the problem you are trying to solve?
Mike Saltzman said:you aren't showing any except the ones on the root level.
Yes, but (because of design choices) the column headers of the root level are used for the rows in the child bands as well. That's the reason the dummy columns were created, and the headers of the other bands were hidden.
UltraGrid reuses columns for child bands, but this is not how it is exported to Excel (after the fix, without the workaround). So the 'trick' we've applied to use the column headers of the root band, is not possible for exporting. But perhaps I can use the BeginExport event to show the column headers of the child bands again, so we can have indentation (in Excel!) and have the data in the right columns.