private void RunExportCall(string fileName) { PropertyGridExportState state = this.SavePropertyGridState(); this.columnWidths = new List <int>(); if (this.ExportVisualSettings) { this.elementProvider = this.propertyGrid.PropertyGridElement.PropertyTableElement.ViewElement.ElementProvider as PropertyGridItemElementProvider; } try { this.spreadExportRenderer.GetFormatProvider(this.ExportFormat); fileName = Path.GetDirectoryName(fileName) + (object)Path.DirectorySeparatorChar + Path.GetFileNameWithoutExtension(fileName) + this.spreadExportRenderer.GetFileExtension(this.ExportFormat); FileStream fileStream; if (this.FileExportMode == FileExportMode.NewSheetInExistingFile && File.Exists(fileName) && this.ExportFormat == SpreadExportFormat.Xlsx) { fileStream = new FileStream(fileName, FileMode.Open, FileAccess.ReadWrite, FileShare.ReadWrite, 32768, false); this.spreadExportRenderer.ImportWorkbook((Stream)fileStream); } else { fileStream = new FileStream(fileName, FileMode.Create, FileAccess.ReadWrite, FileShare.ReadWrite, 32768, false); this.spreadExportRenderer.CreateWorkbook(); } using (fileStream) this.ExportToStream((Stream)fileStream); this.OnExportCompleted(new EventArgs()); ControlTraceMonitor.TrackAtomicFeature((RadControl)this.propertyGrid, "Export", (object)fileName); } finally { this.applicationDoEvents = false; this.RestorePropertyGridState(state); } }
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); }
private void RunExportCall(Stream exportStream) { PropertyGridExportState state = this.SavePropertyGridState(); this.columnWidths = new List <int>(); if (this.ExportVisualSettings) { this.elementProvider = this.propertyGrid.PropertyGridElement.PropertyTableElement.ViewElement.ElementProvider as PropertyGridItemElementProvider; } try { this.spreadExportRenderer.GetFormatProvider(this.ExportFormat); this.spreadExportRenderer.CreateWorkbook(); this.ExportToStream(exportStream); this.OnExportCompleted(new EventArgs()); ControlTraceMonitor.TrackAtomicFeature((RadControl)this.propertyGrid, "Export"); } finally { this.applicationDoEvents = false; this.RestorePropertyGridState(state); } }