diff --git a/ClosedXML/ClosedXML/ClosedXML/Excel/Cells/XLCell.cs b/ClosedXML/ClosedXML/ClosedXML/Excel/Cells/XLCell.cs index 8ebc81d..36084cd 100644 --- a/ClosedXML/ClosedXML/ClosedXML/Excel/Cells/XLCell.cs +++ b/ClosedXML/ClosedXML/ClosedXML/Excel/Cells/XLCell.cs @@ -1339,29 +1339,29 @@ _cellValue = source._cellValue; _dataType = source._dataType; FormulaR1C1 = source.FormulaR1C1; - _richText = source._richText != null ? new XLRichText(source._richText, source.Style.Font) : null; + _richText = source._richText == null ? null : new XLRichText(source._richText, source.Style.Font); } public IXLCell CopyFrom(XLCell otherCell) { - _cellValue = otherCell._cellValue; - _dataType = otherCell._dataType; - FormulaR1C1 = otherCell.FormulaR1C1; - m_style = new XLStyle(this, otherCell.m_style); - if (otherCell._richText != null) - { - _richText = new XLRichText(otherCell._richText, otherCell.Style.Font); - } - if (otherCell._hyperlink != null) + var source = otherCell; + _cellValue = source._cellValue; + _richText = source._richText == null ? null : new XLRichText(source._richText, source.Style.Font); + + _dataType = source._dataType; + FormulaR1C1 = source.FormulaR1C1; + m_style = new XLStyle(this, source.m_style); + + if (source._hyperlink != null) { SettingHyperlink = true; - Hyperlink = new XLHyperlink(otherCell.Hyperlink); + Hyperlink = new XLHyperlink(source.Hyperlink); SettingHyperlink = false; } - var asRange = otherCell.AsRange(); - if (otherCell.Worksheet.DataValidations.Any(dv => dv.Ranges.Contains(asRange))) - (DataValidation as XLDataValidation).CopyFrom(otherCell.DataValidation); + var asRange = source.AsRange(); + if (source.Worksheet.DataValidations.Any(dv => dv.Ranges.Contains(asRange))) + (DataValidation as XLDataValidation).CopyFrom(source.DataValidation); return this; } diff --git a/ClosedXML/ClosedXML/ClosedXML/Excel/Ranges/XLRangeColumn.cs b/ClosedXML/ClosedXML/ClosedXML/Excel/Ranges/XLRangeColumn.cs index 5094f84..34cab9e 100644 --- a/ClosedXML/ClosedXML/ClosedXML/Excel/Ranges/XLRangeColumn.cs +++ b/ClosedXML/ClosedXML/ClosedXML/Excel/Ranges/XLRangeColumn.cs @@ -238,10 +238,7 @@ { if (thisCell.DataType == XLCellValues.Text) { - if (e.MatchCase) - comparison = thisCell.InnerText.CompareTo(otherCell.InnerText); - else - comparison = thisCell.InnerText.ToLower().CompareTo(otherCell.InnerText.ToLower()); + comparison = e.MatchCase ? thisCell.InnerText.CompareTo(otherCell.InnerText) : thisCell.InnerText.ToLower().CompareTo(otherCell.InnerText.ToLower()); } else if (thisCell.DataType == XLCellValues.TimeSpan) comparison = thisCell.GetTimeSpan().CompareTo(otherCell.GetTimeSpan()); diff --git a/ClosedXML/ClosedXML/ClosedXML/Excel/Ranges/XLRangeRow.cs b/ClosedXML/ClosedXML/ClosedXML/Excel/Ranges/XLRangeRow.cs index 0b683c1..bc52b43 100644 --- a/ClosedXML/ClosedXML/ClosedXML/Excel/Ranges/XLRangeRow.cs +++ b/ClosedXML/ClosedXML/ClosedXML/Excel/Ranges/XLRangeRow.cs @@ -251,10 +251,7 @@ { if (thisCell.DataType == XLCellValues.Text) { - if (e.MatchCase) - comparison = thisCell.InnerText.CompareTo(otherCell.InnerText); - else - comparison = thisCell.InnerText.ToLower().CompareTo(otherCell.InnerText.ToLower()); + comparison = e.MatchCase ? thisCell.InnerText.CompareTo(otherCell.InnerText) : thisCell.InnerText.ToLower().CompareTo(otherCell.InnerText.ToLower()); } else if (thisCell.DataType == XLCellValues.TimeSpan) comparison = thisCell.GetTimeSpan().CompareTo(otherCell.GetTimeSpan()); diff --git a/ClosedXML/ClosedXML/ClosedXML/Excel/Style/XLAlignment.cs b/ClosedXML/ClosedXML/ClosedXML/Excel/Style/XLAlignment.cs index ba6d2ee..9e83f55 100644 --- a/ClosedXML/ClosedXML/ClosedXML/Excel/Style/XLAlignment.cs +++ b/ClosedXML/ClosedXML/ClosedXML/Excel/Style/XLAlignment.cs @@ -89,21 +89,25 @@ get { return _indent; } set { - if (Horizontal == XLAlignmentHorizontalValues.General) - Horizontal = XLAlignmentHorizontalValues.Left; - - if (value > 0 && !( - Horizontal == XLAlignmentHorizontalValues.Left - || Horizontal == XLAlignmentHorizontalValues.Right - || Horizontal == XLAlignmentHorizontalValues.Distributed - )) - throw new ArgumentException( - "For indents, only left, right, and distributed horizontal alignments are supported."); - if (_container != null && !_container.UpdatingStyle) + { _container.Styles.ForEach(s => s.Alignment.Indent = value); + } else + { + if (_horizontal == XLAlignmentHorizontalValues.General) + _horizontal = XLAlignmentHorizontalValues.Left; + + if (value > 0 && !( + _horizontal == XLAlignmentHorizontalValues.Left + || _horizontal == XLAlignmentHorizontalValues.Right + || _horizontal == XLAlignmentHorizontalValues.Distributed + )) + throw new ArgumentException( + "For indents, only left, right, and distributed horizontal alignments are supported."); + _indent = value; + } } } diff --git a/ClosedXML/ClosedXML/ClosedXML/Excel/Tables/IXLTable.cs b/ClosedXML/ClosedXML/ClosedXML/Excel/Tables/IXLTable.cs index 938512e..1c678fa 100644 --- a/ClosedXML/ClosedXML/ClosedXML/Excel/Tables/IXLTable.cs +++ b/ClosedXML/ClosedXML/ClosedXML/Excel/Tables/IXLTable.cs @@ -1,73 +1,73 @@ using System; - namespace ClosedXML.Excel { public enum XLTableTheme { - TableStyleMedium28, - TableStyleMedium27, - TableStyleMedium26, - TableStyleMedium25, - TableStyleMedium24, - TableStyleMedium23, - TableStyleMedium22, - TableStyleMedium21, - TableStyleMedium20, - TableStyleMedium19, - TableStyleMedium18, - TableStyleMedium17, - TableStyleMedium16, - TableStyleMedium15, - TableStyleMedium14, - TableStyleMedium13, - TableStyleMedium12, - TableStyleMedium11, - TableStyleMedium10, - TableStyleMedium9, - TableStyleMedium8, - TableStyleMedium7, - TableStyleMedium6, - TableStyleMedium5, - TableStyleMedium4, - TableStyleMedium3, - TableStyleMedium2, - TableStyleMedium1, - TableStyleLight21, - TableStyleLight20, - TableStyleLight19, - TableStyleLight18, - TableStyleLight17, - TableStyleLight16, - TableStyleLight15, - TableStyleLight14, - TableStyleLight13, - TableStyleLight12, - TableStyleLight11, - TableStyleLight10, - TableStyleLight9, - TableStyleLight8, - TableStyleLight7, - TableStyleLight6, - TableStyleLight5, - TableStyleLight4, - TableStyleLight3, - TableStyleLight2, - TableStyleLight1, - TableStyleDark11, - TableStyleDark10, - TableStyleDark9, - TableStyleDark8, - TableStyleDark7, - TableStyleDark6, - TableStyleDark5, - TableStyleDark4, - TableStyleDark3, - TableStyleDark2, + TableStyleMedium28, + TableStyleMedium27, + TableStyleMedium26, + TableStyleMedium25, + TableStyleMedium24, + TableStyleMedium23, + TableStyleMedium22, + TableStyleMedium21, + TableStyleMedium20, + TableStyleMedium19, + TableStyleMedium18, + TableStyleMedium17, + TableStyleMedium16, + TableStyleMedium15, + TableStyleMedium14, + TableStyleMedium13, + TableStyleMedium12, + TableStyleMedium11, + TableStyleMedium10, + TableStyleMedium9, + TableStyleMedium8, + TableStyleMedium7, + TableStyleMedium6, + TableStyleMedium5, + TableStyleMedium4, + TableStyleMedium3, + TableStyleMedium2, + TableStyleMedium1, + TableStyleLight21, + TableStyleLight20, + TableStyleLight19, + TableStyleLight18, + TableStyleLight17, + TableStyleLight16, + TableStyleLight15, + TableStyleLight14, + TableStyleLight13, + TableStyleLight12, + TableStyleLight11, + TableStyleLight10, + TableStyleLight9, + TableStyleLight8, + TableStyleLight7, + TableStyleLight6, + TableStyleLight5, + TableStyleLight4, + TableStyleLight3, + TableStyleLight2, + TableStyleLight1, + TableStyleDark11, + TableStyleDark10, + TableStyleDark9, + TableStyleDark8, + TableStyleDark7, + TableStyleDark6, + TableStyleDark5, + TableStyleDark4, + TableStyleDark3, + TableStyleDark2, TableStyleDark1 } - public interface IXLTable: IXLRangeBase + + public interface IXLTable : IXLRangeBase { - String Name { get; set; } + string Name { get; set; } Boolean EmphasizeFirstColumn { get; set; } Boolean EmphasizeLastColumn { get; set; } Boolean ShowRowStripes { get; set; } @@ -75,233 +75,279 @@ Boolean ShowTotalsRow { get; set; } Boolean ShowAutoFilter { get; set; } XLTableTheme Theme { get; set; } + IXLSortElements SortRows { get; } + IXLSortElements SortColumns { get; } IXLRangeRow HeadersRow(); IXLRangeRow TotalsRow(); - IXLTableField Field(String fieldName); - IXLTableField Field(Int32 fieldIndex); + IXLTableField Field(string fieldName); + IXLTableField Field(int fieldIndex); /// - /// Gets the first data row of the table. + /// Gets the first data row of the table. /// - IXLTableRow FirstRow(); + IXLTableRow FirstRow(); + /// - /// Gets the first data row of the table that contains a cell with a value. + /// Gets the first data row of the table that contains a cell with a value. /// - IXLTableRow FirstRowUsed(); + IXLTableRow FirstRowUsed(); + /// - /// Gets the last data row of the table. + /// Gets the last data row of the table. /// - IXLTableRow LastRow(); + IXLTableRow LastRow(); + /// - /// Gets the last data row of the table that contains a cell with a value. + /// Gets the last data row of the table that contains a cell with a value. /// - IXLTableRow LastRowUsed(); + IXLTableRow LastRowUsed(); + /// - /// Gets the specified row of the table data. + /// Gets the specified row of the table data. /// - /// The table row. - IXLTableRow Row(int row); + /// The table row. + IXLTableRow Row(int row); + /// - /// Gets a collection of all data rows in this table. + /// Gets a collection of all data rows in this table. /// - IXLTableRows Rows(); + IXLTableRows Rows(); + /// - /// Gets a collection of the specified data rows in this table. + /// Gets a collection of the specified data rows in this table. /// - /// The first row to return. - /// The last row to return. + /// The first row to return. + /// The last row to return. /// - IXLTableRows Rows(int firstRow, int lastRow); + IXLTableRows Rows(int firstRow, int lastRow); + /// - /// Gets a collection of the specified data rows in this table, separated by commas. - /// e.g. Rows("4:5"), Rows("7:8,10:11"), Rows("13") + /// Gets a collection of the specified data rows in this table, separated by commas. + /// e.g. Rows("4:5"), Rows("7:8,10:11"), Rows("13") /// - /// The rows to return. - IXLTableRows Rows(string rows); + /// The rows to return. + IXLTableRows Rows(string rows); - IXLRange Sort(); - IXLRange Sort(Boolean matchCase); - IXLRange Sort(XLSortOrder sortOrder); - IXLRange Sort(XLSortOrder sortOrder, Boolean matchCase); - IXLRange Sort(String columnsToSortBy); - IXLRange Sort(String columnsToSortBy, Boolean matchCase); + IXLRange Sort(); + IXLRange Sort(bool matchCase); + IXLRange Sort(XLSortOrder sortOrder); + IXLRange Sort(XLSortOrder sortOrder, bool matchCase); + IXLRange Sort(string columnsToSortBy); + IXLRange Sort(string columnsToSortBy, bool matchCase); - /// - /// Gets the cell at the specified row and column. - /// The cell address is relative to the parent range. - /// - /// The cell's row. - /// The cell's column. - IXLCell Cell(int row, int column); + /// + /// Gets the cell at the specified row and column. + /// The cell address is relative to the parent range. + /// + /// The cell's row. + /// The cell's column. + IXLCell Cell(int row, int column); - /// Gets the cell at the specified address. - /// The cell address is relative to the parent range. - /// The cell address in the parent range. - IXLCell Cell(string cellAddressInRange); + /// + /// Gets the cell at the specified address. + /// + /// The cell address is relative to the parent range. + /// The cell address in the parent range. + IXLCell Cell(string cellAddressInRange); - /// - /// Gets the cell at the specified row and column. - /// The cell address is relative to the parent range. - /// - /// The cell's row. - /// The cell's column. - IXLCell Cell(int row, string column); - /// Gets the cell at the specified address. - /// The cell address is relative to the parent range. - /// The cell address in the parent range. - IXLCell Cell(IXLAddress cellAddressInRange); + /// + /// Gets the cell at the specified row and column. + /// The cell address is relative to the parent range. + /// + /// The cell's row. + /// The cell's column. + IXLCell Cell(int row, string column); - /// - /// Gets the specified column of the range. - /// - /// The range column. - IXLRangeColumn Column(int column); - /// - /// Gets the specified column of the range. - /// - /// The range column. - IXLRangeColumn Column(string column); - /// - /// Gets the first column of the range. - /// - IXLRangeColumn FirstColumn(); - /// - /// Gets the first column of the range that contains a cell with a value. - /// - IXLRangeColumn FirstColumnUsed(); - /// - /// Gets the last column of the range. - /// - IXLRangeColumn LastColumn(); - /// - /// Gets the last column of the range that contains a cell with a value. - /// - IXLRangeColumn LastColumnUsed(); - /// - /// Gets a collection of all columns in this range. - /// - IXLRangeColumns Columns(); - /// - /// Gets a collection of the specified columns in this range. - /// - /// The first column to return. - /// The last column to return. - IXLRangeColumns Columns(int firstColumn, int lastColumn); - /// - /// Gets a collection of the specified columns in this range. - /// - /// The first column to return. - /// The last column to return. - IXLRangeColumns Columns(string firstColumn, string lastColumn); - /// - /// Gets a collection of the specified columns in this range, separated by commas. - /// e.g. Columns("G:H"), Columns("10:11,13:14"), Columns("P:Q,S:T"), Columns("V") - /// - /// The columns to return. - IXLRangeColumns Columns(string columns); + /// + /// Gets the cell at the specified address. + /// + /// The cell address is relative to the parent range. + /// The cell address in the parent range. + IXLCell Cell(IXLAddress cellAddressInRange); - /// - /// Returns the specified range. - /// - /// The range boundaries. - IXLRange Range(IXLRangeAddress rangeAddress); + /// + /// Gets the specified column of the range. + /// + /// The range column. + IXLRangeColumn Column(int column); - /// Returns the specified range. - /// e.g. Range("A1"), Range("A1:C2") - /// The range boundaries. - IXLRange Range(string rangeAddress); + /// + /// Gets the specified column of the range. + /// + /// The range column. + IXLRangeColumn Column(string column); - /// Returns the specified range. - /// The first cell in the range. - /// The last cell in the range. - IXLRange Range(IXLCell firstCell, IXLCell lastCell); + /// + /// Gets the first column of the range. + /// + IXLRangeColumn FirstColumn(); - /// Returns the specified range. - /// The first cell address in the range. - /// The last cell address in the range. - IXLRange Range(string firstCellAddress, string lastCellAddress); + /// + /// Gets the first column of the range that contains a cell with a value. + /// + IXLRangeColumn FirstColumnUsed(); - /// Returns the specified range. - /// The first cell address in the range. - /// The last cell address in the range. - IXLRange Range(IXLAddress firstCellAddress, IXLAddress lastCellAddress); + /// + /// Gets the last column of the range. + /// + IXLRangeColumn LastColumn(); - /// Returns a collection of ranges, separated by commas. - /// e.g. Ranges("A1"), Ranges("A1:C2"), Ranges("A1:B2,D1:D4") - /// The ranges to return. - IXLRanges Ranges(string ranges); + /// + /// Gets the last column of the range that contains a cell with a value. + /// + IXLRangeColumn LastColumnUsed(); - /// Returns the specified range. - /// The first cell's row of the range to return. - /// The first cell's column of the range to return. - /// The last cell's row of the range to return. - /// The last cell's column of the range to return. - /// . - IXLRange Range(int firstCellRow, int firstCellColumn, int lastCellRow, int lastCellColumn); + /// + /// Gets a collection of all columns in this range. + /// + IXLRangeColumns Columns(); - /// Gets the number of rows in this range. - int RowCount(); + /// + /// Gets a collection of the specified columns in this range. + /// + /// The first column to return. + /// The last column to return. + IXLRangeColumns Columns(int firstColumn, int lastColumn); - /// Gets the number of columns in this range. - int ColumnCount(); + /// + /// Gets a collection of the specified columns in this range. + /// + /// The first column to return. + /// The last column to return. + IXLRangeColumns Columns(string firstColumn, string lastColumn); - /// - /// Inserts X number of columns to the right of this range. - /// All cells to the right of this range will be shifted X number of columns. - /// - /// Number of columns to insert. - IXLRangeColumns InsertColumnsAfter(int numberOfColumns); - IXLRangeColumns InsertColumnsAfter(int numberOfColumns, Boolean expandRange); - /// - /// Inserts X number of columns to the left of this range. - /// This range and all cells to the right of this range will be shifted X number of columns. - /// - /// Number of columns to insert. - IXLRangeColumns InsertColumnsBefore(int numberOfColumns); - IXLRangeColumns InsertColumnsBefore(int numberOfColumns, Boolean expandRange); - /// - /// Inserts X number of rows on top of this range. - /// This range and all cells below this range will be shifted X number of rows. - /// - /// Number of rows to insert. - IXLRangeRows InsertRowsAbove(int numberOfRows); - IXLRangeRows InsertRowsAbove(int numberOfRows, Boolean expandRange); - /// - /// Inserts X number of rows below this range. - /// All cells below this range will be shifted X number of rows. - /// - /// Number of rows to insert. - IXLRangeRows InsertRowsBelow(int numberOfRows); - IXLRangeRows InsertRowsBelow(int numberOfRows, Boolean expandRange); + /// + /// Gets a collection of the specified columns in this range, separated by commas. + /// e.g. Columns("G:H"), Columns("10:11,13:14"), Columns("P:Q,S:T"), Columns("V") + /// + /// The columns to return. + IXLRangeColumns Columns(string columns); - /// - /// Deletes this range and shifts the surrounding cells accordingly. - /// - /// How to shift the surrounding cells. - void Delete(XLShiftDeletedCells shiftDeleteCells); + /// + /// Returns the specified range. + /// + /// The range boundaries. + IXLRange Range(IXLRangeAddress rangeAddress); - /// - /// Transposes the contents and styles of all cells in this range. - /// - /// How to handle the surrounding cells when transposing the range. - void Transpose(XLTransposeOptions transposeOption); + /// + /// Returns the specified range. + /// + /// e.g. Range("A1"), Range("A1:C2") + /// The range boundaries. + IXLRange Range(string rangeAddress); - IXLTable AsTable(); - IXLTable AsTable(String name); - IXLTable CreateTable(); - IXLTable CreateTable(String name); + /// + /// Returns the specified range. + /// + /// The first cell in the range. + /// The last cell in the range. + IXLRange Range(IXLCell firstCell, IXLCell lastCell); - IXLRange RangeUsed(); + /// + /// Returns the specified range. + /// + /// The first cell address in the range. + /// The last cell address in the range. + IXLRange Range(string firstCellAddress, string lastCellAddress); - void CopyTo(IXLCell target); - void CopyTo(IXLRangeBase target); + /// + /// Returns the specified range. + /// + /// The first cell address in the range. + /// The last cell address in the range. + IXLRange Range(IXLAddress firstCellAddress, IXLAddress lastCellAddress); - void SetAutoFilter(); - void SetAutoFilter(Boolean autoFilter); + /// + /// Returns a collection of ranges, separated by commas. + /// + /// e.g. Ranges("A1"), Ranges("A1:C2"), Ranges("A1:B2,D1:D4") + /// The ranges to return. + IXLRanges Ranges(string ranges); - IXLSortElements SortRows { get; } - IXLSortElements SortColumns { get; } + /// + /// Returns the specified range. + /// + /// The first cell's row of the range to return. + /// The first cell's column of the range to return. + /// The last cell's row of the range to return. + /// The last cell's column of the range to return. + /// . + IXLRange Range(int firstCellRow, int firstCellColumn, int lastCellRow, int lastCellColumn); - + /// + /// Gets the number of rows in this range. + /// + int RowCount(); + + /// + /// Gets the number of columns in this range. + /// + int ColumnCount(); + + /// + /// Inserts X number of columns to the right of this range. + /// All cells to the right of this range will be shifted X number of columns. + /// + /// Number of columns to insert. + IXLRangeColumns InsertColumnsAfter(int numberOfColumns); + + IXLRangeColumns InsertColumnsAfter(int numberOfColumns, bool expandRange); + + /// + /// Inserts X number of columns to the left of this range. + /// This range and all cells to the right of this range will be shifted X number of columns. + /// + /// Number of columns to insert. + IXLRangeColumns InsertColumnsBefore(int numberOfColumns); + + IXLRangeColumns InsertColumnsBefore(int numberOfColumns, bool expandRange); + + /// + /// Inserts X number of rows on top of this range. + /// This range and all cells below this range will be shifted X number of rows. + /// + /// Number of rows to insert. + IXLRangeRows InsertRowsAbove(int numberOfRows); + + IXLRangeRows InsertRowsAbove(int numberOfRows, bool expandRange); + + /// + /// Inserts X number of rows below this range. + /// All cells below this range will be shifted X number of rows. + /// + /// Number of rows to insert. + IXLRangeRows InsertRowsBelow(int numberOfRows); + + IXLRangeRows InsertRowsBelow(int numberOfRows, bool expandRange); + + /// + /// Deletes this range and shifts the surrounding cells accordingly. + /// + /// How to shift the surrounding cells. + void Delete(XLShiftDeletedCells shiftDeleteCells); + + /// + /// Transposes the contents and styles of all cells in this range. + /// + /// How to handle the surrounding cells when transposing the range. + void Transpose(XLTransposeOptions transposeOption); + + IXLTable AsTable(); + IXLTable AsTable(string name); + IXLTable CreateTable(); + IXLTable CreateTable(string name); + + IXLRange RangeUsed(); + + void CopyTo(IXLCell target); + void CopyTo(IXLRangeBase target); + + IXLTable SetEmphasizeFirstColumn(); IXLTable SetEmphasizeFirstColumn(Boolean value); + IXLTable SetEmphasizeLastColumn(); IXLTable SetEmphasizeLastColumn(Boolean value); + IXLTable SetShowRowStripes(); IXLTable SetShowRowStripes(Boolean value); + IXLTable SetShowColumnStripes(); IXLTable SetShowColumnStripes(Boolean value); + IXLTable SetShowTotalsRow(); IXLTable SetShowTotalsRow(Boolean value); + IXLTable SetShowAutoFilter(); IXLTable SetShowAutoFilter(Boolean value); + } -} +} \ No newline at end of file diff --git a/ClosedXML/ClosedXML/ClosedXML/Excel/Tables/XLTable.cs b/ClosedXML/ClosedXML/ClosedXML/Excel/Tables/XLTable.cs index b205bfa..d2f0e4e 100644 --- a/ClosedXML/ClosedXML/ClosedXML/Excel/Tables/XLTable.cs +++ b/ClosedXML/ClosedXML/ClosedXML/Excel/Tables/XLTable.cs @@ -416,5 +416,13 @@ } return DataRange.Sort(toSortBy.ToString(0, toSortBy.Length - 1)); } + + public IXLTable SetEmphasizeFirstColumn() { EmphasizeFirstColumn = true; return this; } public IXLTable SetEmphasizeFirstColumn(Boolean value) { EmphasizeFirstColumn = value; return this; } + public IXLTable SetEmphasizeLastColumn() { EmphasizeLastColumn = true; return this; } public IXLTable SetEmphasizeLastColumn(Boolean value) { EmphasizeLastColumn = value; return this; } + public IXLTable SetShowRowStripes() { ShowRowStripes = true; return this; } public IXLTable SetShowRowStripes(Boolean value) { ShowRowStripes = value; return this; } + public IXLTable SetShowColumnStripes() { ShowColumnStripes = true; return this; } public IXLTable SetShowColumnStripes(Boolean value) { ShowColumnStripes = value; return this; } + public IXLTable SetShowTotalsRow() { ShowTotalsRow = true; return this; } public IXLTable SetShowTotalsRow(Boolean value) { ShowTotalsRow = value; return this; } + public IXLTable SetShowAutoFilter() { ShowAutoFilter = true; return this; } public IXLTable SetShowAutoFilter(Boolean value) { ShowAutoFilter = value; return this; } + } } \ No newline at end of file diff --git a/ClosedXML/ClosedXML/ClosedXML/Excel/XLWorkbook_Save.cs b/ClosedXML/ClosedXML/ClosedXML/Excel/XLWorkbook_Save.cs index aaacaeb..3e74458 100644 --- a/ClosedXML/ClosedXML/ClosedXML/Excel/XLWorkbook_Save.cs +++ b/ClosedXML/ClosedXML/ClosedXML/Excel/XLWorkbook_Save.cs @@ -362,30 +362,6 @@ } } - private List GetExistingWorksheets(WorkbookPart workbookPart) - { - if (workbookPart != null && workbookPart.Workbook != null && workbookPart.Workbook.Sheets != null) - { - return workbookPart.Workbook.Sheets.Select(s => ((Sheet) s).Name.Value).ToList(); - } - else - { - return new List(); - } - } - - private List GetExistingNamedRanges(VTVector vTVector_Two) - { - if (vTVector_Two.Any()) - { - return vTVector_Two.Elements().Select(e => e.Text).ToList(); - } - else - { - return new List(); - } - } - private List GetModifiedNamedRanges() { var namedRanges = new List(); @@ -1196,6 +1172,11 @@ var a = new XLAlignment(); if (alignment != null) { + if (alignment.Indent != null) + { + a.Indent = (Int32)alignment.Indent.Value; + } + if (alignment.Horizontal != null) { a.Horizontal = alignment.Horizontal.Value.ToClosedXml(); @@ -1204,10 +1185,7 @@ { a.Vertical = alignment.Vertical.Value.ToClosedXml(); } - if (alignment.Indent != null) - { - a.Indent = (Int32) alignment.Indent.Value; - } + if (alignment.ReadingOrder != null) { a.ReadingOrder = alignment.ReadingOrder.Value.ToClosedXml();