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