Hello,
using Infragistics 2016.1's Documents.Excel Reference, I managed to export data from a datatable to a new Excel file and to create outlining.
Here's a code snippet:
qryGroupHeadersOfCurrentPackage.ForEach (r => { var StartRow = r.RowNumberWithinPackageName; var EndRow = r.RowNumberWithinPackageName + r.DescendantsCount-1; for (var x = StartRow; x <= EndRow; x++) { xlWksPackageTree.Rows[x].OutlineLevel += 1; } } );
This works well and fast. :)
But is there a way to make sure that Excel's group headers (the "+" row headers) are above the Details? In Excel's VBA, I'd ensure that this way:
'still unclear ow to do this (Excel Automation) in Infragistics Excel document: xlWksPackageTree.Outline.AutomaticStyles = false xlWksPackageTree.Outline.SummaryRow = XlSummaryRow.xlSummaryAbove xlWksPackageTree.Outline.SummaryColumn = XlSummaryColumn.xlSummaryOnLeft
Thanks for any hint.
Regards
Martin
Hello Teodosia,
that's good advice, exactly what I needed!
Case closed. Thank you!
Thank you for the provided image and file. They helped a lot.
My suggestion to achieve your requirement is using ShowExpansionIndicatorBelowGroupedRows Property. It could be accessed through the DisplayOption property of each Worksheet. In order to change the position of the indicator to be on top, this property has to be set to false.
ws.DisplayOptions.ShowExpansionIndicatorBelowGroupedRows = Infragistics.Documents.Excel.ExcelDefaultableBoolean.False;
I have attached a sample application, that uses this approach. Please test it on your side and let me know if I may be of any further assistance.
Sincerely,
Teodosia Hristodorova
Associate Software Developer
1803.Excel_205800.zip
Hi Teodosia,
this Excel file below (without any code) demonstrates my concerns. In my hierarchy, I have parents and children present, and it's guaranteed that the parents are above their children. If Excel group Default is "Group above Details", this works fine. If the Default group position is "Group below Details", it fails. And to ensure that Excel puts the Groups above the details, I'm trying to influence this. In Excel-VBA, this can be controlled using the VBA Code in my original post. But in Documents.Excel, there seemes not to be any eqivalent.
The Excel dialogue affected is shown in this Picture (sorry, German Excel Version, hope you can recognize the command):
teodora.xlsx
Thanks