internal SLTableColumn Clone() { var tc = new SLTableColumn(); tc.HasCalculatedColumnFormula = HasCalculatedColumnFormula; tc.CalculatedColumnFormula = CalculatedColumnFormula.Clone(); tc.HasTotalsRowFormula = HasTotalsRowFormula; tc.TotalsRowFormula = TotalsRowFormula.Clone(); tc.HasXmlColumnProperties = HasXmlColumnProperties; tc.XmlColumnProperties = XmlColumnProperties.Clone(); tc.Id = Id; tc.UniqueName = UniqueName; tc.Name = Name; tc.HasTotalsRowFunction = HasTotalsRowFunction; tc.vTotalsRowFunction = vTotalsRowFunction; tc.TotalsRowLabel = TotalsRowLabel; tc.QueryTableFieldId = QueryTableFieldId; tc.HeaderRowDifferentialFormattingId = HeaderRowDifferentialFormattingId; tc.DataFormatId = DataFormatId; tc.TotalsRowDifferentialFormattingId = TotalsRowDifferentialFormattingId; tc.HeaderRowCellStyle = HeaderRowCellStyle; tc.DataCellStyle = DataCellStyle; tc.TotalsRowCellStyle = TotalsRowCellStyle; return tc; }
internal void FromTable(Table t) { SetAllNull(); if (t.AutoFilter != null) { AutoFilter.FromAutoFilter(t.AutoFilter); HasAutoFilter = true; } if (t.SortState != null) { SortState.FromSortState(t.SortState); HasSortState = true; } using (var oxr = OpenXmlReader.Create(t.TableColumns)) { SLTableColumn tc; while (oxr.Read()) { if (oxr.ElementType == typeof(TableColumn)) { tc = new SLTableColumn(); tc.FromTableColumn((TableColumn)oxr.LoadCurrentElement()); TableColumns.Add(tc); } } } if (t.TableStyleInfo != null) { TableStyleInfo.FromTableStyleInfo(t.TableStyleInfo); HasTableStyleInfo = true; } Id = t.Id.Value; if (t.Name != null) { Name = t.Name.Value; } sDisplayName = t.DisplayName.Value; if (t.Comment != null) { Comment = t.Comment.Value; } var iStartRowIndex = 1; var iStartColumnIndex = 1; var iEndRowIndex = 1; var iEndColumnIndex = 1; var sRef = t.Reference.Value; if (sRef.IndexOf(":") > 0) { if (SLTool.FormatCellReferenceRangeToRowColumnIndex(sRef, out iStartRowIndex, out iStartColumnIndex, out iEndRowIndex, out iEndColumnIndex)) { StartRowIndex = iStartRowIndex; StartColumnIndex = iStartColumnIndex; EndRowIndex = iEndRowIndex; EndColumnIndex = iEndColumnIndex; } } else { if (SLTool.FormatCellReferenceToRowColumnIndex(sRef, out iStartRowIndex, out iStartColumnIndex)) { StartRowIndex = iStartRowIndex; StartColumnIndex = iStartColumnIndex; EndRowIndex = iStartRowIndex; EndColumnIndex = iStartColumnIndex; } } if (t.TableType != null) { TableType = t.TableType.Value; } if ((t.HeaderRowCount != null) && (t.HeaderRowCount.Value != 1)) { HeaderRowCount = t.HeaderRowCount.Value; } if ((t.InsertRow != null) && t.InsertRow.Value) { InsertRow = t.InsertRow.Value; } if ((t.InsertRowShift != null) && t.InsertRowShift.Value) { InsertRowShift = t.InsertRowShift.Value; } if ((t.TotalsRowCount != null) && (t.TotalsRowCount.Value != 0)) { TotalsRowCount = t.TotalsRowCount.Value; } if ((t.TotalsRowShown != null) && !t.TotalsRowShown.Value) { TotalsRowShown = t.TotalsRowShown.Value; } if ((t.Published != null) && t.Published.Value) { Published = t.Published.Value; } if (t.HeaderRowFormatId != null) { HeaderRowFormatId = t.HeaderRowFormatId.Value; } if (t.DataFormatId != null) { DataFormatId = t.DataFormatId.Value; } if (t.TotalsRowFormatId != null) { TotalsRowFormatId = t.TotalsRowFormatId.Value; } if (t.HeaderRowBorderFormatId != null) { HeaderRowBorderFormatId = t.HeaderRowBorderFormatId.Value; } if (t.BorderFormatId != null) { BorderFormatId = t.BorderFormatId.Value; } if (t.TotalsRowBorderFormatId != null) { TotalsRowBorderFormatId = t.TotalsRowBorderFormatId.Value; } if (t.HeaderRowCellStyle != null) { HeaderRowCellStyle = t.HeaderRowCellStyle.Value; } if (t.DataCellStyle != null) { DataCellStyle = t.DataCellStyle.Value; } if (t.TotalsRowCellStyle != null) { TotalsRowCellStyle = t.TotalsRowCellStyle.Value; } if (t.ConnectionId != null) { ConnectionId = t.ConnectionId.Value; } }