private void ExportToStream(Stream stream) { this.spreadExportRenderer.AddWorksheet(this.SheetName); int num = 0; PropertyGridTraverser propertyGridTraverser = new PropertyGridTraverser(this.propertyGrid.PropertyGridElement.PropertyTableElement); propertyGridTraverser.TraverseHirarchy = true; bool skipHiddenChildItems = false; bool exportChildItemsHidden = false; int collapsedParentLevel = 0; this.valueCellWidth = this.propertyGrid.PropertyGridElement.SplitElement.PropertyTableElement.ValueColumnWidth; this.textCellWidth = this.propertyGrid.PropertyGridElement.PropertyTableElement.Size.Width - this.propertyGrid.PropertyGridElement.PropertyTableElement.VScrollBar.Size.Width - this.valueCellWidth; if (this.ExportChildItemsGrouped) { this.InitializeRowGroupDataStructures(); } while (propertyGridTraverser.MoveNext()) { if (this.applicationDoEvents) { Application.DoEvents(); } if (num > this.sheetMaxRowsNumber) { this.spreadExportRenderer.AddWorksheet(this.SheetName); num = 0; this.columnWidths.Clear(); } PropertyGridItemBase current = propertyGridTraverser.Current; int level = current.Level; if (current is PropertyGridItem && this.isGridGrouped) { ++level; } if (!skipHiddenChildItems || collapsedParentLevel >= level) { skipHiddenChildItems = false; this.AddRow(this.CreateExportRow(current, level, num, ref skipHiddenChildItems, ref collapsedParentLevel, ref exportChildItemsHidden), num); if (this.ExportChildItemsGrouped) { this.ProcessCurrentRowGrouping(level, num); } ++num; } } if (this.ExportChildItemsGrouped) { this.GroupWorksheetRows(num); } this.spreadExportRenderer.CallWorkbookCreated(); this.spreadExportRenderer.Export(stream); }
public System.Collections.IEnumerator GetEnumerator() { if (enumerator == null) { this.enumerator = new PropertyGridTraverser(this.propertyGridElement); } this.enumerator.item = this.item; this.enumerator.group = this.group; this.enumerator.index = this.index; this.enumerator.groupIndex = this.groupIndex; return(enumerator); }
private List <PropertyGridSpreadExportRow> GetPropertyGridDataSnapshot() { List <PropertyGridSpreadExportRow> gridSpreadExportRowList = new List <PropertyGridSpreadExportRow>(); if (this.ExportVisualSettings) { this.elementProvider = this.propertyGrid.PropertyGridElement.PropertyTableElement.ViewElement.ElementProvider as PropertyGridItemElementProvider; } int num = 0; PropertyGridTraverser propertyGridTraverser = new PropertyGridTraverser(this.propertyGrid.PropertyGridElement.PropertyTableElement); propertyGridTraverser.TraverseHirarchy = true; bool skipHiddenChildItems = false; bool exportChildItemsHidden = false; int collapsedParentLevel = 0; this.valueCellWidth = this.propertyGrid.PropertyGridElement.SplitElement.PropertyTableElement.ValueColumnWidth; this.textCellWidth = this.propertyGrid.PropertyGridElement.PropertyTableElement.Size.Width - this.propertyGrid.PropertyGridElement.PropertyTableElement.VScrollBar.Size.Width - this.valueCellWidth; if (this.ExportChildItemsGrouped) { this.InitializeRowGroupDataStructures(); } while (propertyGridTraverser.MoveNext()) { PropertyGridItemBase current = propertyGridTraverser.Current; int level = current.Level; if (current is PropertyGridItem && this.isGridGrouped) { ++level; } if (!skipHiddenChildItems || collapsedParentLevel >= level) { skipHiddenChildItems = false; PropertyGridSpreadExportRow exportRow = this.CreateExportRow(current, level, num, ref skipHiddenChildItems, ref collapsedParentLevel, ref exportChildItemsHidden); gridSpreadExportRowList.Add(exportRow); if (this.ExportChildItemsGrouped) { this.ProcessCurrentRowGrouping(level, num); } ++num; } } return(gridSpreadExportRowList); }