/// <summary> /// Exports a single hierarchical grid to the specified worksheet. /// Exporting starts from the defined rowIndex and columnOffset. /// The rowIndex is updated to point after the last exported row. /// /// </summary> protected virtual void ExportHierarchicalGrid(WebHierarchicalDataGrid grid, Worksheet worksheet, ref int rowIndex, int columnOffset) { int initialDataBindDepth = grid.InitialDataBindDepth; bool shouldEnableVirtualScrolling = false; bool shouldEnablePaging = false; VirtualScrolling behavior1 = grid.Behaviors.GetBehavior<VirtualScrolling>(); Paging behavior2 = grid.Behaviors.GetBehavior<Paging>(); this.RebindToAllData(ref shouldEnableVirtualScrolling, ref shouldEnablePaging, behavior1, behavior2); if (this.DataExportMode == DataExportMode.AllDataInDataSource) { grid.InitialDataBindDepth = -1; grid.GridView.RequireRecordsClear = true; grid.CollapseAll(); } this.ExportGrid((WebDataGrid)grid.GridView, worksheet, ref rowIndex, columnOffset, 0); this.RestoreBinding(shouldEnableVirtualScrolling, shouldEnablePaging, behavior1, behavior2); grid.InitialDataBindDepth = initialDataBindDepth; }
/// <summary> /// Exports a single hierarchical grid to the specified worksheet. /// Exporting starts from the defined row and column offsets. /// /// </summary> public virtual void Export(WebHierarchicalDataGrid grid, Worksheet worksheet, int rowOffset, int columnOffset) { this._currentWorkbookFormat = worksheet.Workbook.CurrentFormat; ExcelExportingEventArgs e = new ExcelExportingEventArgs(worksheet, rowOffset, columnOffset, 0); this.OnExporting(e); if (e.Cancel) return; int currentRowIndex = e.CurrentRowIndex; this.InitStyleSheet(grid.RunBot); this.ExportHierarchicalGrid(grid, worksheet, ref currentRowIndex, columnOffset); this._currentStyleSheet = (StyleSheet)null; this.OnExported(new ExcelExportedEventArgs(worksheet, currentRowIndex, columnOffset, 0)); this.DownloadWorkbook(worksheet.Workbook); }
/// <summary> /// Exports a single hierarchical grid to the specified workbook. /// /// </summary> public virtual void Export(WebHierarchicalDataGrid grid, Workbook workbook) { Worksheet worksheet = workbook.Worksheets.Add("WorkSheet1"); this.Export(grid, worksheet); }
/// <summary> /// Exports a single hierarchical grid to the specified worksheet. /// /// </summary> public virtual void Export(WebHierarchicalDataGrid grid, Worksheet worksheet) { this.Export(grid, worksheet, 0, 0); }
/// <summary> /// Exports a single hierarchical grid. /// /// </summary> public override void Export(WebHierarchicalDataGrid grid) { Workbook workbook = new Workbook(this.WorkbookFormat); this.Export(grid, workbook); }