diff --git a/ClosedXML/Excel/Cells/XLCell.cs b/ClosedXML/Excel/Cells/XLCell.cs index 0c335d5..fa03857 100644 --- a/ClosedXML/Excel/Cells/XLCell.cs +++ b/ClosedXML/Excel/Cells/XLCell.cs @@ -19,7 +19,6 @@ internal class XLCell : IXLCell, IXLStylized { public static readonly DateTime BaseDate = new DateTime(1899, 12, 30); - private static Dictionary _formatCodes; private static readonly Regex A1Regex = new Regex( @"(?<=\W)(\$?[a-zA-Z]{1,3}\$?\d{1,7})(?=\W)" // A1 @@ -1701,7 +1700,7 @@ var style = GetStyleForRead(); if (String.IsNullOrWhiteSpace(style.NumberFormat.Format)) { - var formatCodes = GetFormatCodes(); + var formatCodes = XLPredefinedFormat.FormatCodes; if (formatCodes.ContainsKey(style.NumberFormat.NumberFormatId)) format = formatCodes[style.NumberFormat.NumberFormatId]; } @@ -1738,8 +1737,8 @@ { var maxRows = asRange.RowCount(); var maxColumns = asRange.ColumnCount(); - using (var rng = Worksheet.Range(Address.RowNumber, Address.ColumnNumber, maxRows, maxColumns)) - rng.Clear(); + using (var rng = Worksheet.Range(Address.RowNumber, Address.ColumnNumber, maxRows, maxColumns)) + rng.Clear(); } var minRow = asRange.RangeAddress.FirstAddress.RowNumber; @@ -1883,48 +1882,6 @@ _cellValue = val; } - private static Dictionary GetFormatCodes() - { - if (_formatCodes == null) - { - var fCodes = new Dictionary - { - {0, string.Empty}, - {1, "0"}, - {2, "0.00"}, - {3, "#,##0"}, - {4, "#,##0.00"}, - {7, "$#,##0.00_);($#,##0.00)"}, - {9, "0%"}, - {10, "0.00%"}, - {11, "0.00E+00"}, - {12, "# ?/?"}, - {13, "# ??/??"}, - {14, "M/d/yyyy"}, - {15, "d-MMM-yy"}, - {16, "d-MMM"}, - {17, "MMM-yy"}, - {18, "h:mm tt"}, - {19, "h:mm:ss tt"}, - {20, "H:mm"}, - {21, "H:mm:ss"}, - {22, "M/d/yyyy H:mm"}, - {37, "#,##0 ;(#,##0)"}, - {38, "#,##0 ;[Red](#,##0)"}, - {39, "#,##0.00;(#,##0.00)"}, - {40, "#,##0.00;[Red](#,##0.00)"}, - {45, "mm:ss"}, - {46, "[h]:mm:ss"}, - {47, "mmss.0"}, - {48, "##0.0E+0"}, - {49, "@"} - }; - _formatCodes = fCodes; - } - - return _formatCodes; - } - private string GetFormulaR1C1(string value) { return GetFormula(value, FormulaConversionType.A1ToR1C1, 0, 0); @@ -2249,148 +2206,148 @@ if (!A1ColumnRegex.IsMatch(rangeAddress)) { using (var matchRange = worksheetInAction.Workbook.Worksheet(sheetName).Range(rangeAddress)) - { - if (shiftedRange.RangeAddress.FirstAddress.RowNumber <= matchRange.RangeAddress.LastAddress.RowNumber - && shiftedRange.RangeAddress.FirstAddress.ColumnNumber <= matchRange.RangeAddress.FirstAddress.ColumnNumber - && shiftedRange.RangeAddress.LastAddress.ColumnNumber >= matchRange.RangeAddress.LastAddress.ColumnNumber) - { - if (A1RowRegex.IsMatch(rangeAddress)) - { - var rows = rangeAddress.Split(':'); - var row1String = rows[0]; - var row2String = rows[1]; - string row1; - if (row1String[0] == '$') - { - row1 = "$" + - (XLHelper.TrimRowNumber(Int32.Parse(row1String.Substring(1)) + rowsShifted)).ToInvariantString(); - } - else - row1 = (XLHelper.TrimRowNumber(Int32.Parse(row1String) + rowsShifted)).ToInvariantString(); + { + if (shiftedRange.RangeAddress.FirstAddress.RowNumber <= matchRange.RangeAddress.LastAddress.RowNumber + && shiftedRange.RangeAddress.FirstAddress.ColumnNumber <= matchRange.RangeAddress.FirstAddress.ColumnNumber + && shiftedRange.RangeAddress.LastAddress.ColumnNumber >= matchRange.RangeAddress.LastAddress.ColumnNumber) + { + if (A1RowRegex.IsMatch(rangeAddress)) + { + var rows = rangeAddress.Split(':'); + var row1String = rows[0]; + var row2String = rows[1]; + string row1; + if (row1String[0] == '$') + { + row1 = "$" + + (XLHelper.TrimRowNumber(Int32.Parse(row1String.Substring(1)) + rowsShifted)).ToInvariantString(); + } + else + row1 = (XLHelper.TrimRowNumber(Int32.Parse(row1String) + rowsShifted)).ToInvariantString(); - string row2; - if (row2String[0] == '$') - { - row2 = "$" + - (XLHelper.TrimRowNumber(Int32.Parse(row2String.Substring(1)) + rowsShifted)).ToInvariantString(); - } - else - row2 = (XLHelper.TrimRowNumber(Int32.Parse(row2String) + rowsShifted)).ToInvariantString(); + string row2; + if (row2String[0] == '$') + { + row2 = "$" + + (XLHelper.TrimRowNumber(Int32.Parse(row2String.Substring(1)) + rowsShifted)).ToInvariantString(); + } + else + row2 = (XLHelper.TrimRowNumber(Int32.Parse(row2String) + rowsShifted)).ToInvariantString(); - sb.Append(useSheetName - ? String.Format("{0}!{1}:{2}", sheetName.WrapSheetNameInQuotesIfRequired(), row1, row2) - : String.Format("{0}:{1}", row1, row2)); - } - else if (shiftedRange.RangeAddress.FirstAddress.RowNumber <= - matchRange.RangeAddress.FirstAddress.RowNumber) - { - if (rangeAddress.Contains(':')) - { - if (useSheetName) - { - sb.Append(String.Format("{0}!{1}:{2}", - sheetName.WrapSheetNameInQuotesIfRequired(), - new XLAddress(worksheetInAction, - XLHelper.TrimRowNumber(matchRange.RangeAddress.FirstAddress.RowNumber + rowsShifted), - matchRange.RangeAddress. - FirstAddress.ColumnLetter, - matchRange.RangeAddress. - FirstAddress.FixedRow, - matchRange.RangeAddress. - FirstAddress.FixedColumn), - new XLAddress(worksheetInAction, - XLHelper.TrimRowNumber(matchRange.RangeAddress.LastAddress.RowNumber + rowsShifted), - matchRange.RangeAddress. - LastAddress.ColumnLetter, - matchRange.RangeAddress. - LastAddress.FixedRow, - matchRange.RangeAddress. - LastAddress.FixedColumn))); - } - else - { - sb.Append(String.Format("{0}:{1}", - new XLAddress(worksheetInAction, - XLHelper.TrimRowNumber(matchRange.RangeAddress.FirstAddress.RowNumber + rowsShifted), - matchRange.RangeAddress. - FirstAddress.ColumnLetter, - matchRange.RangeAddress. - FirstAddress.FixedRow, - matchRange.RangeAddress. - FirstAddress.FixedColumn), - new XLAddress(worksheetInAction, - XLHelper.TrimRowNumber(matchRange.RangeAddress.LastAddress.RowNumber + rowsShifted), - matchRange.RangeAddress. - LastAddress.ColumnLetter, - matchRange.RangeAddress. - LastAddress.FixedRow, - matchRange.RangeAddress. - LastAddress.FixedColumn))); - } - } - else - { - if (useSheetName) - { - sb.Append(String.Format("{0}!{1}", - sheetName.WrapSheetNameInQuotesIfRequired(), - new XLAddress(worksheetInAction, - XLHelper.TrimRowNumber(matchRange.RangeAddress.FirstAddress.RowNumber + rowsShifted), - matchRange.RangeAddress. - FirstAddress.ColumnLetter, - matchRange.RangeAddress. - FirstAddress.FixedRow, - matchRange.RangeAddress. - FirstAddress.FixedColumn))); - } - else - { - sb.Append(String.Format("{0}", - new XLAddress(worksheetInAction, - XLHelper.TrimRowNumber(matchRange.RangeAddress.FirstAddress.RowNumber + rowsShifted), - matchRange.RangeAddress. - FirstAddress.ColumnLetter, - matchRange.RangeAddress. - FirstAddress.FixedRow, - matchRange.RangeAddress. - FirstAddress.FixedColumn))); - } - } - } - else - { - if (useSheetName) - { - sb.Append(String.Format("{0}!{1}:{2}", - sheetName.WrapSheetNameInQuotesIfRequired(), - matchRange.RangeAddress.FirstAddress, - new XLAddress(worksheetInAction, - XLHelper.TrimRowNumber(matchRange.RangeAddress.LastAddress.RowNumber + rowsShifted), - matchRange.RangeAddress. - LastAddress.ColumnLetter, - matchRange.RangeAddress. - LastAddress.FixedRow, - matchRange.RangeAddress. - LastAddress.FixedColumn))); - } - else - { - sb.Append(String.Format("{0}:{1}", - matchRange.RangeAddress.FirstAddress, - new XLAddress(worksheetInAction, - XLHelper.TrimRowNumber(matchRange.RangeAddress.LastAddress.RowNumber + rowsShifted), - matchRange.RangeAddress. - LastAddress.ColumnLetter, - matchRange.RangeAddress. - LastAddress.FixedRow, - matchRange.RangeAddress. - LastAddress.FixedColumn))); - } - } - } - else - sb.Append(matchString); - } + sb.Append(useSheetName + ? String.Format("{0}!{1}:{2}", sheetName.WrapSheetNameInQuotesIfRequired(), row1, row2) + : String.Format("{0}:{1}", row1, row2)); + } + else if (shiftedRange.RangeAddress.FirstAddress.RowNumber <= + matchRange.RangeAddress.FirstAddress.RowNumber) + { + if (rangeAddress.Contains(':')) + { + if (useSheetName) + { + sb.Append(String.Format("{0}!{1}:{2}", + sheetName.WrapSheetNameInQuotesIfRequired(), + new XLAddress(worksheetInAction, + XLHelper.TrimRowNumber(matchRange.RangeAddress.FirstAddress.RowNumber + rowsShifted), + matchRange.RangeAddress. + FirstAddress.ColumnLetter, + matchRange.RangeAddress. + FirstAddress.FixedRow, + matchRange.RangeAddress. + FirstAddress.FixedColumn), + new XLAddress(worksheetInAction, + XLHelper.TrimRowNumber(matchRange.RangeAddress.LastAddress.RowNumber + rowsShifted), + matchRange.RangeAddress. + LastAddress.ColumnLetter, + matchRange.RangeAddress. + LastAddress.FixedRow, + matchRange.RangeAddress. + LastAddress.FixedColumn))); + } + else + { + sb.Append(String.Format("{0}:{1}", + new XLAddress(worksheetInAction, + XLHelper.TrimRowNumber(matchRange.RangeAddress.FirstAddress.RowNumber + rowsShifted), + matchRange.RangeAddress. + FirstAddress.ColumnLetter, + matchRange.RangeAddress. + FirstAddress.FixedRow, + matchRange.RangeAddress. + FirstAddress.FixedColumn), + new XLAddress(worksheetInAction, + XLHelper.TrimRowNumber(matchRange.RangeAddress.LastAddress.RowNumber + rowsShifted), + matchRange.RangeAddress. + LastAddress.ColumnLetter, + matchRange.RangeAddress. + LastAddress.FixedRow, + matchRange.RangeAddress. + LastAddress.FixedColumn))); + } + } + else + { + if (useSheetName) + { + sb.Append(String.Format("{0}!{1}", + sheetName.WrapSheetNameInQuotesIfRequired(), + new XLAddress(worksheetInAction, + XLHelper.TrimRowNumber(matchRange.RangeAddress.FirstAddress.RowNumber + rowsShifted), + matchRange.RangeAddress. + FirstAddress.ColumnLetter, + matchRange.RangeAddress. + FirstAddress.FixedRow, + matchRange.RangeAddress. + FirstAddress.FixedColumn))); + } + else + { + sb.Append(String.Format("{0}", + new XLAddress(worksheetInAction, + XLHelper.TrimRowNumber(matchRange.RangeAddress.FirstAddress.RowNumber + rowsShifted), + matchRange.RangeAddress. + FirstAddress.ColumnLetter, + matchRange.RangeAddress. + FirstAddress.FixedRow, + matchRange.RangeAddress. + FirstAddress.FixedColumn))); + } + } + } + else + { + if (useSheetName) + { + sb.Append(String.Format("{0}!{1}:{2}", + sheetName.WrapSheetNameInQuotesIfRequired(), + matchRange.RangeAddress.FirstAddress, + new XLAddress(worksheetInAction, + XLHelper.TrimRowNumber(matchRange.RangeAddress.LastAddress.RowNumber + rowsShifted), + matchRange.RangeAddress. + LastAddress.ColumnLetter, + matchRange.RangeAddress. + LastAddress.FixedRow, + matchRange.RangeAddress. + LastAddress.FixedColumn))); + } + else + { + sb.Append(String.Format("{0}:{1}", + matchRange.RangeAddress.FirstAddress, + new XLAddress(worksheetInAction, + XLHelper.TrimRowNumber(matchRange.RangeAddress.LastAddress.RowNumber + rowsShifted), + matchRange.RangeAddress. + LastAddress.ColumnLetter, + matchRange.RangeAddress. + LastAddress.FixedRow, + matchRange.RangeAddress. + LastAddress.FixedColumn))); + } + } + } + else + sb.Append(matchString); + } } else sb.Append(matchString); @@ -2455,167 +2412,167 @@ if (!A1RowRegex.IsMatch(rangeAddress)) { using (var matchRange = worksheetInAction.Workbook.Worksheet(sheetName).Range(rangeAddress)) - { - if (shiftedRange.RangeAddress.FirstAddress.ColumnNumber <= - matchRange.RangeAddress.LastAddress.ColumnNumber - && - shiftedRange.RangeAddress.FirstAddress.RowNumber <= - matchRange.RangeAddress.FirstAddress.RowNumber - && - shiftedRange.RangeAddress.LastAddress.RowNumber >= - matchRange.RangeAddress.LastAddress.RowNumber) - { - if (A1ColumnRegex.IsMatch(rangeAddress)) - { - var columns = rangeAddress.Split(':'); - var column1String = columns[0]; - var column2String = columns[1]; - string column1; - if (column1String[0] == '$') - { - column1 = "$" + - XLHelper.GetColumnLetterFromNumber( - XLHelper.GetColumnNumberFromLetter( - column1String.Substring(1)) + columnsShifted, true); - } - else - { - column1 = - XLHelper.GetColumnLetterFromNumber( - XLHelper.GetColumnNumberFromLetter(column1String) + - columnsShifted, true); - } + { + if (shiftedRange.RangeAddress.FirstAddress.ColumnNumber <= + matchRange.RangeAddress.LastAddress.ColumnNumber + && + shiftedRange.RangeAddress.FirstAddress.RowNumber <= + matchRange.RangeAddress.FirstAddress.RowNumber + && + shiftedRange.RangeAddress.LastAddress.RowNumber >= + matchRange.RangeAddress.LastAddress.RowNumber) + { + if (A1ColumnRegex.IsMatch(rangeAddress)) + { + var columns = rangeAddress.Split(':'); + var column1String = columns[0]; + var column2String = columns[1]; + string column1; + if (column1String[0] == '$') + { + column1 = "$" + + XLHelper.GetColumnLetterFromNumber( + XLHelper.GetColumnNumberFromLetter( + column1String.Substring(1)) + columnsShifted, true); + } + else + { + column1 = + XLHelper.GetColumnLetterFromNumber( + XLHelper.GetColumnNumberFromLetter(column1String) + + columnsShifted, true); + } - string column2; - if (column2String[0] == '$') - { - column2 = "$" + - XLHelper.GetColumnLetterFromNumber( - XLHelper.GetColumnNumberFromLetter( - column2String.Substring(1)) + columnsShifted, true); - } - else - { - column2 = - XLHelper.GetColumnLetterFromNumber( - XLHelper.GetColumnNumberFromLetter(column2String) + - columnsShifted, true); - } + string column2; + if (column2String[0] == '$') + { + column2 = "$" + + XLHelper.GetColumnLetterFromNumber( + XLHelper.GetColumnNumberFromLetter( + column2String.Substring(1)) + columnsShifted, true); + } + else + { + column2 = + XLHelper.GetColumnLetterFromNumber( + XLHelper.GetColumnNumberFromLetter(column2String) + + columnsShifted, true); + } - sb.Append(useSheetName - ? String.Format("{0}!{1}:{2}", sheetName.WrapSheetNameInQuotesIfRequired(), column1, column2) - : String.Format("{0}:{1}", column1, column2)); - } - else if (shiftedRange.RangeAddress.FirstAddress.ColumnNumber <= - matchRange.RangeAddress.FirstAddress.ColumnNumber) - { - if (rangeAddress.Contains(':')) - { - if (useSheetName) - { - sb.Append(String.Format("{0}!{1}:{2}", - sheetName.WrapSheetNameInQuotesIfRequired(), - new XLAddress(worksheetInAction, - matchRange.RangeAddress. - FirstAddress.RowNumber, - XLHelper.TrimColumnNumber(matchRange.RangeAddress.FirstAddress.ColumnNumber + columnsShifted), - matchRange.RangeAddress. - FirstAddress.FixedRow, - matchRange.RangeAddress. - FirstAddress.FixedColumn), - new XLAddress(worksheetInAction, - matchRange.RangeAddress. - LastAddress.RowNumber, - XLHelper.TrimColumnNumber(matchRange.RangeAddress.LastAddress.ColumnNumber + columnsShifted), - matchRange.RangeAddress. - LastAddress.FixedRow, - matchRange.RangeAddress. - LastAddress.FixedColumn))); - } - else - { - sb.Append(String.Format("{0}:{1}", - new XLAddress(worksheetInAction, - matchRange.RangeAddress. - FirstAddress.RowNumber, - XLHelper.TrimColumnNumber(matchRange.RangeAddress.FirstAddress.ColumnNumber + columnsShifted), - matchRange.RangeAddress. - FirstAddress.FixedRow, - matchRange.RangeAddress. - FirstAddress.FixedColumn), - new XLAddress(worksheetInAction, - matchRange.RangeAddress. - LastAddress.RowNumber, - XLHelper.TrimColumnNumber(matchRange.RangeAddress.LastAddress.ColumnNumber + columnsShifted), - matchRange.RangeAddress. - LastAddress.FixedRow, - matchRange.RangeAddress. - LastAddress.FixedColumn))); - } - } - else - { - if (useSheetName) - { - sb.Append(String.Format("{0}!{1}", - sheetName.WrapSheetNameInQuotesIfRequired(), - new XLAddress(worksheetInAction, - matchRange.RangeAddress. - FirstAddress.RowNumber, - XLHelper.TrimColumnNumber(matchRange.RangeAddress.FirstAddress.ColumnNumber + columnsShifted), - matchRange.RangeAddress. - FirstAddress.FixedRow, - matchRange.RangeAddress. - FirstAddress.FixedColumn))); - } - else - { - sb.Append(String.Format("{0}", - new XLAddress(worksheetInAction, - matchRange.RangeAddress. - FirstAddress.RowNumber, - XLHelper.TrimColumnNumber(matchRange.RangeAddress.FirstAddress.ColumnNumber + columnsShifted), - matchRange.RangeAddress. - FirstAddress.FixedRow, - matchRange.RangeAddress. - FirstAddress.FixedColumn))); - } - } - } - else - { - if (useSheetName) - { - sb.Append(String.Format("{0}!{1}:{2}", - sheetName.WrapSheetNameInQuotesIfRequired(), - matchRange.RangeAddress.FirstAddress, - new XLAddress(worksheetInAction, - matchRange.RangeAddress. - LastAddress.RowNumber, - XLHelper.TrimColumnNumber(matchRange.RangeAddress.LastAddress.ColumnNumber + columnsShifted), - matchRange.RangeAddress. - LastAddress.FixedRow, - matchRange.RangeAddress. - LastAddress.FixedColumn))); - } - else - { - sb.Append(String.Format("{0}:{1}", - matchRange.RangeAddress.FirstAddress, - new XLAddress(worksheetInAction, - matchRange.RangeAddress. - LastAddress.RowNumber, - XLHelper.TrimColumnNumber(matchRange.RangeAddress.LastAddress.ColumnNumber + columnsShifted), - matchRange.RangeAddress. - LastAddress.FixedRow, - matchRange.RangeAddress. - LastAddress.FixedColumn))); - } - } - } - else - sb.Append(matchString); - } + sb.Append(useSheetName + ? String.Format("{0}!{1}:{2}", sheetName.WrapSheetNameInQuotesIfRequired(), column1, column2) + : String.Format("{0}:{1}", column1, column2)); + } + else if (shiftedRange.RangeAddress.FirstAddress.ColumnNumber <= + matchRange.RangeAddress.FirstAddress.ColumnNumber) + { + if (rangeAddress.Contains(':')) + { + if (useSheetName) + { + sb.Append(String.Format("{0}!{1}:{2}", + sheetName.WrapSheetNameInQuotesIfRequired(), + new XLAddress(worksheetInAction, + matchRange.RangeAddress. + FirstAddress.RowNumber, + XLHelper.TrimColumnNumber(matchRange.RangeAddress.FirstAddress.ColumnNumber + columnsShifted), + matchRange.RangeAddress. + FirstAddress.FixedRow, + matchRange.RangeAddress. + FirstAddress.FixedColumn), + new XLAddress(worksheetInAction, + matchRange.RangeAddress. + LastAddress.RowNumber, + XLHelper.TrimColumnNumber(matchRange.RangeAddress.LastAddress.ColumnNumber + columnsShifted), + matchRange.RangeAddress. + LastAddress.FixedRow, + matchRange.RangeAddress. + LastAddress.FixedColumn))); + } + else + { + sb.Append(String.Format("{0}:{1}", + new XLAddress(worksheetInAction, + matchRange.RangeAddress. + FirstAddress.RowNumber, + XLHelper.TrimColumnNumber(matchRange.RangeAddress.FirstAddress.ColumnNumber + columnsShifted), + matchRange.RangeAddress. + FirstAddress.FixedRow, + matchRange.RangeAddress. + FirstAddress.FixedColumn), + new XLAddress(worksheetInAction, + matchRange.RangeAddress. + LastAddress.RowNumber, + XLHelper.TrimColumnNumber(matchRange.RangeAddress.LastAddress.ColumnNumber + columnsShifted), + matchRange.RangeAddress. + LastAddress.FixedRow, + matchRange.RangeAddress. + LastAddress.FixedColumn))); + } + } + else + { + if (useSheetName) + { + sb.Append(String.Format("{0}!{1}", + sheetName.WrapSheetNameInQuotesIfRequired(), + new XLAddress(worksheetInAction, + matchRange.RangeAddress. + FirstAddress.RowNumber, + XLHelper.TrimColumnNumber(matchRange.RangeAddress.FirstAddress.ColumnNumber + columnsShifted), + matchRange.RangeAddress. + FirstAddress.FixedRow, + matchRange.RangeAddress. + FirstAddress.FixedColumn))); + } + else + { + sb.Append(String.Format("{0}", + new XLAddress(worksheetInAction, + matchRange.RangeAddress. + FirstAddress.RowNumber, + XLHelper.TrimColumnNumber(matchRange.RangeAddress.FirstAddress.ColumnNumber + columnsShifted), + matchRange.RangeAddress. + FirstAddress.FixedRow, + matchRange.RangeAddress. + FirstAddress.FixedColumn))); + } + } + } + else + { + if (useSheetName) + { + sb.Append(String.Format("{0}!{1}:{2}", + sheetName.WrapSheetNameInQuotesIfRequired(), + matchRange.RangeAddress.FirstAddress, + new XLAddress(worksheetInAction, + matchRange.RangeAddress. + LastAddress.RowNumber, + XLHelper.TrimColumnNumber(matchRange.RangeAddress.LastAddress.ColumnNumber + columnsShifted), + matchRange.RangeAddress. + LastAddress.FixedRow, + matchRange.RangeAddress. + LastAddress.FixedColumn))); + } + else + { + sb.Append(String.Format("{0}:{1}", + matchRange.RangeAddress.FirstAddress, + new XLAddress(worksheetInAction, + matchRange.RangeAddress. + LastAddress.RowNumber, + XLHelper.TrimColumnNumber(matchRange.RangeAddress.LastAddress.ColumnNumber + columnsShifted), + matchRange.RangeAddress. + LastAddress.FixedRow, + matchRange.RangeAddress. + LastAddress.FixedColumn))); + } + } + } + else + sb.Append(matchString); + } } else sb.Append(matchString); @@ -2783,4 +2740,4 @@ return FindCurrentRegion(this.Worksheet.Range(grownRangeAddress)); } } -} \ No newline at end of file +} diff --git a/ClosedXML/Excel/ConditionalFormats/Save/XLCFCellIsConverter.cs b/ClosedXML/Excel/ConditionalFormats/Save/XLCFCellIsConverter.cs index f883286..d846ce3 100644 --- a/ClosedXML/Excel/ConditionalFormats/Save/XLCFCellIsConverter.cs +++ b/ClosedXML/Excel/ConditionalFormats/Save/XLCFCellIsConverter.cs @@ -1,5 +1,5 @@ -using System; using DocumentFormat.OpenXml.Spreadsheet; +using System; namespace ClosedXML.Excel { @@ -10,7 +10,10 @@ String val = GetQuoted(cf.Values[1]); var conditionalFormattingRule = XLCFBaseConverter.Convert(cf, priority); - conditionalFormattingRule.FormatId = (UInt32) context.DifferentialFormats[cf.Style]; + + if (!cf.Style.Equals(XLWorkbook.DefaultStyle)) + conditionalFormattingRule.FormatId = (UInt32)context.DifferentialFormats[cf.Style]; + conditionalFormattingRule.Operator = cf.Operator.ToOpenXml(); var formula = new Formula(); @@ -20,10 +23,10 @@ formula.Text = val; conditionalFormattingRule.Append(formula); - if(cf.Operator == XLCFOperator.Between || cf.Operator == XLCFOperator.NotBetween) + if (cf.Operator == XLCFOperator.Between || cf.Operator == XLCFOperator.NotBetween) { var formula2 = new Formula { Text = GetQuoted(cf.Values[2]) }; - conditionalFormattingRule.Append(formula2); + conditionalFormattingRule.Append(formula2); } return conditionalFormattingRule; @@ -38,7 +41,5 @@ return value; } - - } } diff --git a/ClosedXML/Excel/ConditionalFormats/Save/XLCFContainsConverter.cs b/ClosedXML/Excel/ConditionalFormats/Save/XLCFContainsConverter.cs index 01a4694..5e33f41 100644 --- a/ClosedXML/Excel/ConditionalFormats/Save/XLCFContainsConverter.cs +++ b/ClosedXML/Excel/ConditionalFormats/Save/XLCFContainsConverter.cs @@ -1,5 +1,5 @@ -using System; using DocumentFormat.OpenXml.Spreadsheet; +using System; namespace ClosedXML.Excel { @@ -9,17 +9,18 @@ { String val = cf.Values[1].Value; var conditionalFormattingRule = XLCFBaseConverter.Convert(cf, priority); - conditionalFormattingRule.FormatId = (UInt32) context.DifferentialFormats[cf.Style]; + + if (!cf.Style.Equals(XLWorkbook.DefaultStyle)) + conditionalFormattingRule.FormatId = (UInt32)context.DifferentialFormats[cf.Style]; + conditionalFormattingRule.Operator = ConditionalFormattingOperatorValues.ContainsText; conditionalFormattingRule.Text = val; - + var formula = new Formula { Text = "NOT(ISERROR(SEARCH(\"" + val + "\"," + cf.Range.RangeAddress.FirstAddress.ToStringRelative(false) + ")))" }; conditionalFormattingRule.Append(formula); return conditionalFormattingRule; } - - } } diff --git a/ClosedXML/Excel/ConditionalFormats/Save/XLCFEndsWithConverter.cs b/ClosedXML/Excel/ConditionalFormats/Save/XLCFEndsWithConverter.cs index 54364f7..230f0f6 100644 --- a/ClosedXML/Excel/ConditionalFormats/Save/XLCFEndsWithConverter.cs +++ b/ClosedXML/Excel/ConditionalFormats/Save/XLCFEndsWithConverter.cs @@ -9,7 +9,10 @@ { String val = cf.Values[1].Value; var conditionalFormattingRule = XLCFBaseConverter.Convert(cf, priority); - conditionalFormattingRule.FormatId = (UInt32)context.DifferentialFormats[cf.Style]; + + if (!cf.Style.Equals(XLWorkbook.DefaultStyle)) + conditionalFormattingRule.FormatId = (UInt32)context.DifferentialFormats[cf.Style]; + conditionalFormattingRule.Operator = ConditionalFormattingOperatorValues.EndsWith; conditionalFormattingRule.Text = val; diff --git a/ClosedXML/Excel/ConditionalFormats/Save/XLCFIsBlankConverter.cs b/ClosedXML/Excel/ConditionalFormats/Save/XLCFIsBlankConverter.cs index a9dac0f..fdd7442 100644 --- a/ClosedXML/Excel/ConditionalFormats/Save/XLCFIsBlankConverter.cs +++ b/ClosedXML/Excel/ConditionalFormats/Save/XLCFIsBlankConverter.cs @@ -1,15 +1,16 @@ -using System; using DocumentFormat.OpenXml.Spreadsheet; +using System; namespace ClosedXML.Excel { internal class XLCFIsBlankConverter : IXLCFConverter { - public ConditionalFormattingRule Convert(IXLConditionalFormat cf, int priority, XLWorkbook.SaveContext context) { var conditionalFormattingRule = XLCFBaseConverter.Convert(cf, priority); - conditionalFormattingRule.FormatId = (UInt32)context.DifferentialFormats[cf.Style]; + + if (!cf.Style.Equals(XLWorkbook.DefaultStyle)) + conditionalFormattingRule.FormatId = (UInt32)context.DifferentialFormats[cf.Style]; var formula = new Formula { Text = "LEN(TRIM(" + cf.Range.RangeAddress.FirstAddress.ToStringRelative(false) + "))=0" }; @@ -17,6 +18,5 @@ return conditionalFormattingRule; } - } } diff --git a/ClosedXML/Excel/ConditionalFormats/Save/XLCFIsErrorConverter.cs b/ClosedXML/Excel/ConditionalFormats/Save/XLCFIsErrorConverter.cs index eb65890..88ad11c 100644 --- a/ClosedXML/Excel/ConditionalFormats/Save/XLCFIsErrorConverter.cs +++ b/ClosedXML/Excel/ConditionalFormats/Save/XLCFIsErrorConverter.cs @@ -1,15 +1,16 @@ -using System; using DocumentFormat.OpenXml.Spreadsheet; +using System; namespace ClosedXML.Excel { internal class XLCFIsErrorConverter : IXLCFConverter { - public ConditionalFormattingRule Convert(IXLConditionalFormat cf, int priority, XLWorkbook.SaveContext context) { var conditionalFormattingRule = XLCFBaseConverter.Convert(cf, priority); - conditionalFormattingRule.FormatId = (UInt32)context.DifferentialFormats[cf.Style]; + + if (!cf.Style.Equals(XLWorkbook.DefaultStyle)) + conditionalFormattingRule.FormatId = (UInt32)context.DifferentialFormats[cf.Style]; var formula = new Formula { Text = "ISERROR(" + cf.Range.RangeAddress.FirstAddress.ToStringRelative(false) + ")" }; @@ -17,6 +18,5 @@ return conditionalFormattingRule; } - } } diff --git a/ClosedXML/Excel/ConditionalFormats/Save/XLCFNotBlankConverter.cs b/ClosedXML/Excel/ConditionalFormats/Save/XLCFNotBlankConverter.cs index 753e754..134a763 100644 --- a/ClosedXML/Excel/ConditionalFormats/Save/XLCFNotBlankConverter.cs +++ b/ClosedXML/Excel/ConditionalFormats/Save/XLCFNotBlankConverter.cs @@ -1,15 +1,16 @@ -using System; using DocumentFormat.OpenXml.Spreadsheet; +using System; namespace ClosedXML.Excel { internal class XLCFNotBlankConverter : IXLCFConverter { - public ConditionalFormattingRule Convert(IXLConditionalFormat cf, int priority, XLWorkbook.SaveContext context) { var conditionalFormattingRule = XLCFBaseConverter.Convert(cf, priority); - conditionalFormattingRule.FormatId = (UInt32)context.DifferentialFormats[cf.Style]; + + if (!cf.Style.Equals(XLWorkbook.DefaultStyle)) + conditionalFormattingRule.FormatId = (UInt32)context.DifferentialFormats[cf.Style]; var formula = new Formula { Text = "LEN(TRIM(" + cf.Range.RangeAddress.FirstAddress.ToStringRelative(false) + "))>0" }; @@ -17,6 +18,5 @@ return conditionalFormattingRule; } - } } diff --git a/ClosedXML/Excel/ConditionalFormats/Save/XLCFNotContainsConverter.cs b/ClosedXML/Excel/ConditionalFormats/Save/XLCFNotContainsConverter.cs index 3e3c081..a0342f1 100644 --- a/ClosedXML/Excel/ConditionalFormats/Save/XLCFNotContainsConverter.cs +++ b/ClosedXML/Excel/ConditionalFormats/Save/XLCFNotContainsConverter.cs @@ -1,5 +1,5 @@ -using System; using DocumentFormat.OpenXml.Spreadsheet; +using System; namespace ClosedXML.Excel { @@ -9,7 +9,10 @@ { String val = cf.Values[1].Value; var conditionalFormattingRule = XLCFBaseConverter.Convert(cf, priority); - conditionalFormattingRule.FormatId = (UInt32)context.DifferentialFormats[cf.Style]; + + if (!cf.Style.Equals(XLWorkbook.DefaultStyle)) + conditionalFormattingRule.FormatId = (UInt32)context.DifferentialFormats[cf.Style]; + conditionalFormattingRule.Operator = ConditionalFormattingOperatorValues.NotContains; conditionalFormattingRule.Text = val; @@ -19,7 +22,5 @@ return conditionalFormattingRule; } - - } } diff --git a/ClosedXML/Excel/ConditionalFormats/Save/XLCFNotErrorConverter.cs b/ClosedXML/Excel/ConditionalFormats/Save/XLCFNotErrorConverter.cs index 108c244..57ccd6f 100644 --- a/ClosedXML/Excel/ConditionalFormats/Save/XLCFNotErrorConverter.cs +++ b/ClosedXML/Excel/ConditionalFormats/Save/XLCFNotErrorConverter.cs @@ -1,15 +1,16 @@ -using System; using DocumentFormat.OpenXml.Spreadsheet; +using System; namespace ClosedXML.Excel { internal class XLCFNotErrorConverter : IXLCFConverter { - public ConditionalFormattingRule Convert(IXLConditionalFormat cf, int priority, XLWorkbook.SaveContext context) { var conditionalFormattingRule = XLCFBaseConverter.Convert(cf, priority); - conditionalFormattingRule.FormatId = (UInt32)context.DifferentialFormats[cf.Style]; + + if (!cf.Style.Equals(XLWorkbook.DefaultStyle)) + conditionalFormattingRule.FormatId = (UInt32)context.DifferentialFormats[cf.Style]; var formula = new Formula { Text = "NOT(ISERROR(" + cf.Range.RangeAddress.FirstAddress.ToStringRelative(false) + "))" }; @@ -17,6 +18,5 @@ return conditionalFormattingRule; } - } } diff --git a/ClosedXML/Excel/ConditionalFormats/Save/XLCFStartsWithConverter.cs b/ClosedXML/Excel/ConditionalFormats/Save/XLCFStartsWithConverter.cs index 77abaf9..6442a59 100644 --- a/ClosedXML/Excel/ConditionalFormats/Save/XLCFStartsWithConverter.cs +++ b/ClosedXML/Excel/ConditionalFormats/Save/XLCFStartsWithConverter.cs @@ -1,5 +1,5 @@ -using System; using DocumentFormat.OpenXml.Spreadsheet; +using System; namespace ClosedXML.Excel { @@ -9,9 +9,12 @@ { String val = cf.Values[1].Value; var conditionalFormattingRule = XLCFBaseConverter.Convert(cf, priority); - conditionalFormattingRule.FormatId = (UInt32)context.DifferentialFormats[cf.Style]; - conditionalFormattingRule.Operator = ConditionalFormattingOperatorValues.BeginsWith; - conditionalFormattingRule.Text = val; + + if (!cf.Style.Equals(XLWorkbook.DefaultStyle)) + conditionalFormattingRule.FormatId = (UInt32)context.DifferentialFormats[cf.Style]; + + conditionalFormattingRule.Operator = ConditionalFormattingOperatorValues.BeginsWith; + conditionalFormattingRule.Text = val; var formula = new Formula { Text = "LEFT(" + cf.Range.RangeAddress.FirstAddress.ToStringRelative(false) + "," + val.Length.ToString() + ")=\"" + val + "\"" }; @@ -19,7 +22,5 @@ return conditionalFormattingRule; } - - } } diff --git a/ClosedXML/Excel/ConditionalFormats/Save/XLCFTopConverter.cs b/ClosedXML/Excel/ConditionalFormats/Save/XLCFTopConverter.cs index 3ca8dbc..9a1f572 100644 --- a/ClosedXML/Excel/ConditionalFormats/Save/XLCFTopConverter.cs +++ b/ClosedXML/Excel/ConditionalFormats/Save/XLCFTopConverter.cs @@ -1,5 +1,5 @@ -using System; using DocumentFormat.OpenXml.Spreadsheet; +using System; namespace ClosedXML.Excel { @@ -9,13 +9,14 @@ { UInt32 val = UInt32.Parse(cf.Values[1].Value); var conditionalFormattingRule = XLCFBaseConverter.Convert(cf, priority); - conditionalFormattingRule.FormatId = (UInt32)context.DifferentialFormats[cf.Style]; + + if (!cf.Style.Equals(XLWorkbook.DefaultStyle)) + conditionalFormattingRule.FormatId = (UInt32)context.DifferentialFormats[cf.Style]; + conditionalFormattingRule.Percent = cf.Percent; conditionalFormattingRule.Rank = val; conditionalFormattingRule.Bottom = cf.Bottom; return conditionalFormattingRule; } - - } } diff --git a/ClosedXML/Excel/ConditionalFormats/Save/XLCFUniqueConverter.cs b/ClosedXML/Excel/ConditionalFormats/Save/XLCFUniqueConverter.cs index f4945bc..bba890e 100644 --- a/ClosedXML/Excel/ConditionalFormats/Save/XLCFUniqueConverter.cs +++ b/ClosedXML/Excel/ConditionalFormats/Save/XLCFUniqueConverter.cs @@ -1,4 +1,5 @@ using DocumentFormat.OpenXml.Spreadsheet; +using System; namespace ClosedXML.Excel { @@ -7,7 +8,10 @@ public ConditionalFormattingRule Convert(IXLConditionalFormat cf, int priority, XLWorkbook.SaveContext context) { var conditionalFormattingRule = XLCFBaseConverter.Convert(cf, priority); - conditionalFormattingRule.FormatId = (uint)context.DifferentialFormats[cf.Style]; + + if (!cf.Style.Equals(XLWorkbook.DefaultStyle)) + conditionalFormattingRule.FormatId = (UInt32)context.DifferentialFormats[cf.Style]; + return conditionalFormattingRule; } } diff --git a/ClosedXML/Excel/Style/IXLFill.cs b/ClosedXML/Excel/Style/IXLFill.cs index b39356e..fdc6359 100644 --- a/ClosedXML/Excel/Style/IXLFill.cs +++ b/ClosedXML/Excel/Style/IXLFill.cs @@ -25,17 +25,16 @@ Solid } - public interface IXLFill:IEquatable + public interface IXLFill : IEquatable { XLColor BackgroundColor { get; set; } XLColor PatternColor { get; set; } - XLColor PatternBackgroundColor { get; set; } XLFillPatternValues PatternType { get; set; } IXLStyle SetBackgroundColor(XLColor value); - IXLStyle SetPatternColor(XLColor value); - IXLStyle SetPatternBackgroundColor(XLColor value); - IXLStyle SetPatternType(XLFillPatternValues value); + IXLStyle SetPatternColor(XLColor value); + + IXLStyle SetPatternType(XLFillPatternValues value); } } diff --git a/ClosedXML/Excel/Style/XLFill.cs b/ClosedXML/Excel/Style/XLFill.cs index c4e02b9..d7155af 100644 --- a/ClosedXML/Excel/Style/XLFill.cs +++ b/ClosedXML/Excel/Style/XLFill.cs @@ -1,5 +1,5 @@ using System; -using System.Text; +using System.Linq; namespace ClosedXML.Excel { @@ -11,12 +11,12 @@ { return _patternType == other.PatternType + && _backgroundColor.Equals(other.BackgroundColor) && _patternColor.Equals(other.PatternColor) - && _patternBackgroundColor.Equals(other.PatternBackgroundColor) ; } - #endregion + #endregion IXLFill Members private void SetStyleChanged() { @@ -37,13 +37,13 @@ #region Properties - private XLColor _patternBackgroundColor; + private XLColor _backgroundColor; private XLColor _patternColor; private XLFillPatternValues _patternType; public XLColor BackgroundColor { - get { return _patternColor; } + get { return _backgroundColor; } set { SetStyleChanged(); @@ -51,18 +51,20 @@ _container.Styles.ForEach(s => s.Fill.BackgroundColor = value); else { - _patternType = value.HasValue ? XLFillPatternValues.Solid : XLFillPatternValues.None; - _patternColor = value; - _patternBackgroundColor = value; - - PatternTypeModified = true; - PatternColorModified = true; - PatternBackgroundColorModified = true; + // 4 ways of determining an "empty" color + if (new XLFillPatternValues[] { XLFillPatternValues.None, XLFillPatternValues.Solid }.Contains(_patternType) + && (_backgroundColor == null + || !_backgroundColor.HasValue + || _backgroundColor == XLColor.NoColor + || _backgroundColor.ColorType == XLColorType.Indexed && _backgroundColor.Indexed == 64)) + { + _patternType = value.HasValue ? XLFillPatternValues.Solid : XLFillPatternValues.None; + } + _backgroundColor = value; } } } - public Boolean PatternColorModified; public XLColor PatternColor { get { return _patternColor; } @@ -74,29 +76,10 @@ else { _patternColor = value; - PatternColorModified = true; } } } - public Boolean PatternBackgroundColorModified; - public XLColor PatternBackgroundColor - { - get { return _patternBackgroundColor; } - set - { - SetStyleChanged(); - if (_container != null && !_container.UpdatingStyle) - _container.Styles.ForEach(s => s.Fill.PatternBackgroundColor = value); - else - { - _patternBackgroundColor = value; - PatternBackgroundColorModified = true; - } - } - } - - public Boolean PatternTypeModified; public XLFillPatternValues PatternType { get { return _patternType; } @@ -108,7 +91,6 @@ else { _patternType = value; - PatternTypeModified = true; } } } @@ -125,19 +107,13 @@ return _container.Style; } - public IXLStyle SetPatternBackgroundColor(XLColor value) - { - PatternBackgroundColor = value; - return _container.Style; - } - public IXLStyle SetPatternType(XLFillPatternValues value) { PatternType = value; return _container.Style; } - #endregion + #endregion Properties #region Constructors @@ -152,33 +128,34 @@ _container = container; if (defaultFill == null) return; _patternType = defaultFill.PatternType; + _backgroundColor = defaultFill.BackgroundColor; _patternColor = defaultFill.PatternColor; - _patternBackgroundColor = defaultFill.PatternBackgroundColor; if (useDefaultModify) { var d = defaultFill as XLFill; - PatternBackgroundColorModified = d.PatternBackgroundColorModified; - PatternColorModified = d.PatternColorModified; - PatternTypeModified = d.PatternTypeModified; } } - #endregion + #endregion Constructors #region Overridden public override string ToString() { - var sb = new StringBuilder(); - sb.Append(BackgroundColor); - sb.Append("-"); - sb.Append(PatternType.ToString()); - sb.Append("-"); - sb.Append(PatternColor); - return sb.ToString(); + switch (PatternType) + { + case XLFillPatternValues.None: + return "None"; + + case XLFillPatternValues.Solid: + return string.Concat("Solid ", BackgroundColor.ToString()); + + default: + return string.Concat(PatternType.ToString(), " pattern: ", PatternColor.ToString(), " on ", BackgroundColor.ToString()); + } } - #endregion + #endregion Overridden } -} \ No newline at end of file +} diff --git a/ClosedXML/Excel/Style/XLPredefinedFormat.cs b/ClosedXML/Excel/Style/XLPredefinedFormat.cs index 32c6e1a..461cf73 100644 --- a/ClosedXML/Excel/Style/XLPredefinedFormat.cs +++ b/ClosedXML/Excel/Style/XLPredefinedFormat.cs @@ -1,4 +1,6 @@ -namespace ClosedXML.Excel +using System.Collections.Generic; + +namespace ClosedXML.Excel { /// /// Reference point of date/number formats available. @@ -6,6 +8,11 @@ /// public static class XLPredefinedFormat { + /// + /// General + /// + public static int General { get { return 0; } } + public enum Number { /// @@ -37,22 +44,22 @@ /// 0% /// PercentInteger = 9, - + /// /// 0.00% /// PercentPrecision2 = 10, - + /// /// 0.00E+00 /// ScientificPrecision2 = 11, - + /// /// # ?/? /// FractionPrecision1 = 12, - + /// /// # ??/?? /// @@ -67,7 +74,7 @@ /// #,##0 ,[Red](#,##0) /// IntegerWithSeparatorAndParensRed = 38, - + /// /// #,##0.00,(#,##0.00) /// @@ -100,42 +107,42 @@ /// d/m/yyyy /// DayMonthYear4WithSlashes = 14, - + /// /// d-mmm-yy /// DayMonthAbbrYear2WithDashes = 15, - + /// /// d-mmm /// DayMonthAbbrWithDash = 16, - + /// /// mmm-yy /// MonthAbbrYear2WithDash = 17, - + /// /// h:mm tt /// Hour12MinutesAmPm = 18, - + /// /// h:mm:ss tt /// Hour12MinutesSecondsAmPm = 19, - + /// /// H:mm /// Hour24Minutes = 20, - + /// /// H:mm:ss /// Hour24MinutesSeconds = 21, - + /// /// m/d/yyyy H:mm /// @@ -150,16 +157,62 @@ /// [h]:mm:ss /// Hour12MinutesSeconds = 46, - + /// /// mmss.0 /// MinutesSecondsMillis1 = 47, - + /// /// @ /// Text = 49 } + + private static IDictionary _formatCodes; + internal static IDictionary FormatCodes + { + get + { + if (_formatCodes == null) + { + var fCodes = new Dictionary + { + {0, string.Empty}, + {1, "0"}, + {2, "0.00"}, + {3, "#,##0"}, + {4, "#,##0.00"}, + {7, "$#,##0.00_);($#,##0.00)"}, + {9, "0%"}, + {10, "0.00%"}, + {11, "0.00E+00"}, + {12, "# ?/?"}, + {13, "# ??/??"}, + {14, "M/d/yyyy"}, + {15, "d-MMM-yy"}, + {16, "d-MMM"}, + {17, "MMM-yy"}, + {18, "h:mm tt"}, + {19, "h:mm:ss tt"}, + {20, "H:mm"}, + {21, "H:mm:ss"}, + {22, "M/d/yyyy H:mm"}, + {37, "#,##0 ;(#,##0)"}, + {38, "#,##0 ;[Red](#,##0)"}, + {39, "#,##0.00;(#,##0.00)"}, + {40, "#,##0.00;[Red](#,##0.00)"}, + {45, "mm:ss"}, + {46, "[h]:mm:ss"}, + {47, "mmss.0"}, + {48, "##0.0E+0"}, + {49, "@"} + }; + _formatCodes = fCodes; + } + + return _formatCodes; + } + } } } diff --git a/ClosedXML/Excel/Style/XLStyle.cs b/ClosedXML/Excel/Style/XLStyle.cs index b392a84..939aa96 100644 --- a/ClosedXML/Excel/Style/XLStyle.cs +++ b/ClosedXML/Excel/Style/XLStyle.cs @@ -38,7 +38,7 @@ public IXLFill Fill { get; set; } private IXLNumberFormat numberFormat; - public IXLNumberFormat NumberFormat + public IXLNumberFormat NumberFormat { get { diff --git a/ClosedXML/Excel/Style/XLStylizedContainer.cs b/ClosedXML/Excel/Style/XLStylizedContainer.cs index bc2e5ec..e9177a3 100644 --- a/ClosedXML/Excel/Style/XLStylizedContainer.cs +++ b/ClosedXML/Excel/Style/XLStylizedContainer.cs @@ -19,11 +19,12 @@ public IEnumerable Styles { - get + get { + var _backupUpdatingStyle = _container.UpdatingStyle; _container.UpdatingStyle = true; yield return Style; - _container.UpdatingStyle = false; + _container.UpdatingStyle = _backupUpdatingStyle; } } diff --git a/ClosedXML/Excel/Tables/IXLTableField.cs b/ClosedXML/Excel/Tables/IXLTableField.cs index abd8029..4c2fb00 100644 --- a/ClosedXML/Excel/Tables/IXLTableField.cs +++ b/ClosedXML/Excel/Tables/IXLTableField.cs @@ -18,19 +18,86 @@ public interface IXLTableField { + /// + /// Gets the corresponding column for this table field. + /// + /// + /// The column. + /// IXLRangeColumn Column { get; } + + /// + /// Gets the index of the column (0-based). + /// + /// + /// The index. + /// Int32 Index { get; } + + /// + /// Gets or sets the name/header of this table field. + /// The corresponding header cell's value will change if you set this. + /// + /// + /// The name. + /// String Name { get; set; } + + /// + /// Gets the underlying table for this table field. + /// + IXLTable Table { get; } + + /// + /// Gets or sets the totals row formula in A1 format. + /// + /// + /// The totals row formula a1. + /// String TotalsRowFormulaA1 { get; set; } + + /// + /// Gets or sets the totals row formula in R1C1 format. + /// + /// + /// The totals row formula r1 c1. + /// String TotalsRowFormulaR1C1 { get; set; } + + /// + /// Gets or sets the totals row function. + /// + /// + /// The totals row function. + /// XLTotalsRowFunction TotalsRowFunction { get; set; } + + /// + /// Gets or sets the totals row label. + /// + /// + /// The totals row label. + /// String TotalsRowLabel { get; set; } + /// + /// Deletes this table field from the table. + /// void Delete(); /// /// Determines whether all cells this table field have a consistent data type. /// Boolean IsConsistentDataType(); + + /// + /// Determines whether all cells this table field have a consistent formula. + /// + Boolean IsConsistentFormula(); + + /// + /// Determines whether all cells this table field have a consistent style. + /// + Boolean IsConsistentStyle(); } } diff --git a/ClosedXML/Excel/Tables/XLTableField.cs b/ClosedXML/Excel/Tables/XLTableField.cs index f4bfe87..ed65bed 100644 --- a/ClosedXML/Excel/Tables/XLTableField.cs +++ b/ClosedXML/Excel/Tables/XLTableField.cs @@ -11,6 +11,8 @@ internal String totalsRowLabel; private readonly XLTable table; + private IXLRangeColumn _column; + private Int32 index; private String name; public XLTableField(XLTable table, String name) @@ -19,8 +21,6 @@ this.name = name; } - private IXLRangeColumn _column; - public IXLRangeColumn Column { get @@ -33,8 +33,6 @@ } } - private Int32 index; - public Int32 Index { get { return index; } @@ -62,6 +60,8 @@ } } + public IXLTable Table { get { return table; } } + public String TotalsRowFormulaA1 { get { return table.TotalsRow().Cell(Index + 1).FormulaA1; } @@ -92,34 +92,6 @@ } } - internal void UpdateUnderlyingCellFormula() - { - if (TotalsRowFunction != XLTotalsRowFunction.None && TotalsRowFunction != XLTotalsRowFunction.Custom) - { - var cell = table.TotalsRow().Cell(Index + 1); - String formula = String.Empty; - switch (TotalsRowFunction) - { - case XLTotalsRowFunction.Sum: formula = "109"; break; - case XLTotalsRowFunction.Minimum: formula = "105"; break; - case XLTotalsRowFunction.Maximum: formula = "104"; break; - case XLTotalsRowFunction.Average: formula = "101"; break; - case XLTotalsRowFunction.Count: formula = "103"; break; - case XLTotalsRowFunction.CountNumbers: formula = "102"; break; - case XLTotalsRowFunction.StandardDeviation: formula = "107"; break; - case XLTotalsRowFunction.Variance: formula = "110"; break; - } - - cell.FormulaA1 = "SUBTOTAL(" + formula + ",[" + Name + "])"; - var lastCell = table.LastRow().Cell(Index + 1); - if (lastCell.DataType != XLCellValues.Text) - { - cell.DataType = lastCell.DataType; - cell.Style.NumberFormat = lastCell.Style.NumberFormat; - } - } - } - public String TotalsRowLabel { get { return totalsRowLabel; } @@ -165,5 +137,69 @@ return distinctDataTypes.Count() == 1; } + + public Boolean IsConsistentFormula() + { + var formulas = this.Column + .Cells() + .Skip(this.table.ShowHeaderRow ? 1 : 0) + .Select(c => c.FormulaR1C1); + + if (this.table.ShowTotalsRow) + formulas = formulas.Take(formulas.Count() - 1); + + var distinctFormulas = formulas + .GroupBy(f => f) + .Select(g => new { Key = g.Key, Count = g.Count() }); + + return distinctFormulas.Count() == 1; + } + + public bool IsConsistentStyle() + { + var styles = this.Column + .Cells() + .Skip(this.table.ShowHeaderRow ? 1 : 0) + .Select(c => c.Style); + + if (this.table.ShowTotalsRow) + styles = styles.Take(styles.Count() - 1); + + var distinctStyles = styles + .GroupBy(f => f) + .Select(g => new { Key = g.Key, Count = g.Count() }); + + var ie = distinctStyles.First().Key.Equals(distinctStyles.Last().Key); + + return distinctStyles.Count() == 1; + } + + internal void UpdateUnderlyingCellFormula() + { + if (TotalsRowFunction != XLTotalsRowFunction.None && TotalsRowFunction != XLTotalsRowFunction.Custom) + { + var cell = table.TotalsRow().Cell(Index + 1); + String formula = String.Empty; + switch (TotalsRowFunction) + { + case XLTotalsRowFunction.Sum: formula = "109"; break; + case XLTotalsRowFunction.Minimum: formula = "105"; break; + case XLTotalsRowFunction.Maximum: formula = "104"; break; + case XLTotalsRowFunction.Average: formula = "101"; break; + case XLTotalsRowFunction.Count: formula = "103"; break; + case XLTotalsRowFunction.CountNumbers: formula = "102"; break; + case XLTotalsRowFunction.StandardDeviation: formula = "107"; break; + case XLTotalsRowFunction.Variance: formula = "110"; break; + } + + cell.FormulaA1 = "SUBTOTAL(" + formula + ",[" + Name + "])"; + var lastCell = table.LastRow().Cell(Index + 1); + if (lastCell.DataType != XLCellValues.Text) + { + cell.DataType = lastCell.DataType; + cell.Style.NumberFormat = lastCell.Style.NumberFormat; + } + } + } } } diff --git a/ClosedXML/Excel/XLConstants.cs b/ClosedXML/Excel/XLConstants.cs index 4948bb2..c9d87d0 100644 --- a/ClosedXML/Excel/XLConstants.cs +++ b/ClosedXML/Excel/XLConstants.cs @@ -4,7 +4,7 @@ public static class XLConstants { public const string PivotTableValuesSentinalLabel = "{{Values}}"; - public const int NumberOfBuiltInStyles = 163; + public const int NumberOfBuiltInStyles = 164; // But they are stored as 0-based (0 - 163) internal static class Comment { diff --git a/ClosedXML/Excel/XLWorkbook_Load.cs b/ClosedXML/Excel/XLWorkbook_Load.cs index 2b7fa10..2e9c4cd 100644 --- a/ClosedXML/Excel/XLWorkbook_Load.cs +++ b/ClosedXML/Excel/XLWorkbook_Load.cs @@ -1455,10 +1455,11 @@ { if (nfSource == null) return; - if (nfSource.FormatCode != null) + if (nfSource.NumberFormatId != null && nfSource.NumberFormatId.Value < XLConstants.NumberOfBuiltInStyles) + nf.NumberFormatId = (Int32)nfSource.NumberFormatId.Value; + else if (nfSource.FormatCode != null) nf.Format = nfSource.FormatCode.Value; - //if (nfSource.NumberFormatId != null) - // nf.NumberFormatId = (Int32)nfSource.NumberFormatId.Value; + } private void LoadBorder(Border borderSource, IXLBorder border) @@ -1489,21 +1490,44 @@ } } - private void LoadFill(Fill fillSource, IXLFill fill) + // Differential fills store the patterns differently than other fills + // Actually differential fills make more sense. bg is bg and fg is fg + // 'Other' fills store the bg color in the fg field when pattern type is solid + private void LoadFill(Fill openXMLFill, IXLFill closedXMLFill, Boolean differentialFillFormat) { - if (fillSource == null) return; + if (openXMLFill == null || openXMLFill.PatternFill == null) return; - if (fillSource.PatternFill != null) + if (openXMLFill.PatternFill.PatternType != null) + closedXMLFill.PatternType = openXMLFill.PatternFill.PatternType.Value.ToClosedXml(); + else + closedXMLFill.PatternType = XLFillPatternValues.Solid; + + switch (closedXMLFill.PatternType) { - if (fillSource.PatternFill.PatternType != null) - fill.PatternType = fillSource.PatternFill.PatternType.Value.ToClosedXml(); - else - fill.PatternType = XLFillPatternValues.Solid; + case XLFillPatternValues.None: + break; - if (fillSource.PatternFill.ForegroundColor != null) - fill.PatternColor = GetColor(fillSource.PatternFill.ForegroundColor); - if (fillSource.PatternFill.BackgroundColor != null) - fill.PatternBackgroundColor = GetColor(fillSource.PatternFill.BackgroundColor); + case XLFillPatternValues.Solid: + if (differentialFillFormat) + { + if (openXMLFill.PatternFill.BackgroundColor != null) + closedXMLFill.BackgroundColor = GetColor(openXMLFill.PatternFill.BackgroundColor); + } + else + { + // yes, source is foreground! + if (openXMLFill.PatternFill.ForegroundColor != null) + closedXMLFill.BackgroundColor = GetColor(openXMLFill.PatternFill.ForegroundColor); + } + break; + + default: + if (openXMLFill.PatternFill.ForegroundColor != null) + closedXMLFill.PatternColor = GetColor(openXMLFill.PatternFill.ForegroundColor); + + if (openXMLFill.PatternFill.BackgroundColor != null) + closedXMLFill.BackgroundColor = GetColor(openXMLFill.PatternFill.BackgroundColor); + break; } } @@ -1920,7 +1944,7 @@ if (fr.FormatId != null) { LoadFont(differentialFormats[(Int32)fr.FormatId.Value].Font, conditionalFormat.Style.Font); - LoadFill(differentialFormats[(Int32)fr.FormatId.Value].Fill, conditionalFormat.Style.Fill); + LoadFill(differentialFormats[(Int32)fr.FormatId.Value].Fill, conditionalFormat.Style.Fill, differentialFillFormat: true); LoadBorder(differentialFormats[(Int32)fr.FormatId.Value].Border, conditionalFormat.Style.Border); LoadNumberFormat(differentialFormats[(Int32)fr.FormatId.Value].NumberingFormat, conditionalFormat.Style.NumberFormat); } @@ -2320,7 +2344,7 @@ thisColor = _colorList[htmlColor]; retVal = XLColor.FromColor(thisColor); } - else if (color.Indexed != null && color.Indexed < 64) + else if (color.Indexed != null && color.Indexed <= 64) retVal = XLColor.FromIndex((Int32)color.Indexed.Value); else if (color.Theme != null) { @@ -2357,15 +2381,7 @@ var fill = (Fill)fills.ElementAt((Int32)cellFormat.FillId.Value); if (fill.PatternFill != null) { - if (fill.PatternFill.PatternType != null) - xlStylized.InnerStyle.Fill.PatternType = fill.PatternFill.PatternType.Value.ToClosedXml(); - - var fgColor = GetColor(fill.PatternFill.ForegroundColor); - if (fgColor.HasValue) xlStylized.InnerStyle.Fill.PatternColor = fgColor; - - var bgColor = GetColor(fill.PatternFill.BackgroundColor); - if (bgColor.HasValue) - xlStylized.InnerStyle.Fill.PatternBackgroundColor = bgColor; + LoadFill(fill, xlStylized.InnerStyle.Fill, differentialFillFormat: false); } } diff --git a/ClosedXML/Excel/XLWorkbook_Save.cs b/ClosedXML/Excel/XLWorkbook_Save.cs index 05e831d..4979c7d 100644 --- a/ClosedXML/Excel/XLWorkbook_Save.cs +++ b/ClosedXML/Excel/XLWorkbook_Save.cs @@ -1818,32 +1818,68 @@ else table.TotalsRowShown = false; - var tableColumns1 = new TableColumns { Count = (UInt32)xlTable.ColumnCount() }; + var tableColumns = new TableColumns { Count = (UInt32)xlTable.ColumnCount() }; UInt32 columnId = 0; foreach (var xlField in xlTable.Fields) { columnId++; var fieldName = xlField.Name; - var tableColumn1 = new TableColumn + var tableColumn = new TableColumn { Id = columnId, Name = fieldName.Replace("_x000a_", "_x005f_x000a_").Replace(Environment.NewLine, "_x000a_") }; + + // https://github.com/ClosedXML/ClosedXML/issues/513 + if (xlField.IsConsistentStyle()) + { + var style = xlField.Column.Cells() + .Skip(xlTable.ShowHeaderRow ? 1 : 0) + .First() + .Style; + + if (!DefaultStyle.Equals(style) && context.DifferentialFormats.ContainsKey(style)) + tableColumn.DataFormatId = UInt32Value.FromUInt32(Convert.ToUInt32(context.DifferentialFormats[style])); + } + else + tableColumn.DataFormatId = null; + + if (xlField.IsConsistentFormula()) + { + string formula = xlField.Column.Cells() + .Skip(xlTable.ShowHeaderRow ? 1 : 0) + .First() + .FormulaA1; + + while (formula.StartsWith("=") && formula.Length > 1) + formula = formula.Substring(1); + + if (!String.IsNullOrWhiteSpace(formula)) + { + tableColumn.CalculatedColumnFormula = new CalculatedColumnFormula + { + Text = formula + }; + } + } + else + tableColumn.CalculatedColumnFormula = null; + if (xlTable.ShowTotalsRow) { if (xlField.TotalsRowFunction != XLTotalsRowFunction.None) { - tableColumn1.TotalsRowFunction = xlField.TotalsRowFunction.ToOpenXml(); + tableColumn.TotalsRowFunction = xlField.TotalsRowFunction.ToOpenXml(); if (xlField.TotalsRowFunction == XLTotalsRowFunction.Custom) - tableColumn1.TotalsRowFormula = new TotalsRowFormula(xlField.TotalsRowFormulaA1); + tableColumn.TotalsRowFormula = new TotalsRowFormula(xlField.TotalsRowFormulaA1); } if (!String.IsNullOrWhiteSpace(xlField.TotalsRowLabel)) - tableColumn1.TotalsRowLabel = xlField.TotalsRowLabel; + tableColumn.TotalsRowLabel = xlField.TotalsRowLabel; } - tableColumns1.AppendChild(tableColumn1); + tableColumns.AppendChild(tableColumn); } var tableStyleInfo1 = new TableStyleInfo @@ -1874,7 +1910,7 @@ table.AppendChild(autoFilter1); } - table.AppendChild(tableColumns1); + table.AppendChild(tableColumns); table.AppendChild(tableStyleInfo1); tableDefinitionPart.Table = table; @@ -3101,7 +3137,7 @@ UInt32 fontCount = 1; UInt32 fillCount = 3; UInt32 borderCount = 1; - var numberFormatCount = 1; + var numberFormatCount = 0; // 0-based var xlStyles = new HashSet(); var pivotTableNumberFormats = new HashSet(); @@ -3242,8 +3278,24 @@ { foreach (var cf in ws.ConditionalFormats) { - if (!context.DifferentialFormats.ContainsKey(cf.Style)) - AddDifferentialFormat(workbookStylesPart.Stylesheet.DifferentialFormats, cf, context); + //var ie = context.DifferentialFormats.Keys.First().Equals(cf.Style); + + if (!cf.Style.Equals(DefaultStyle) && !context.DifferentialFormats.ContainsKey(cf.Style)) + AddConditionalDifferentialFormat(workbookStylesPart.Stylesheet.DifferentialFormats, cf, context); + } + + foreach (var tf in ws.Tables.SelectMany(t => t.Fields)) + { + if (tf.IsConsistentStyle()) + { + var style = tf.Column.Cells() + .Skip(tf.Table.ShowHeaderRow ? 1 : 0) + .First() + .Style; + + if (!style.Equals(DefaultStyle) && !context.DifferentialFormats.ContainsKey(style)) + AddStyleAsDifferentialFormat(workbookStylesPart.Stylesheet.DifferentialFormats, style, context); + } } } @@ -3257,19 +3309,26 @@ { dictionary.Clear(); var id = 0; + foreach (var df in differentialFormats.Elements()) { - var style = new XLStyle(new XLStylizedEmpty(DefaultStyle), DefaultStyle); + var emptyContainer = new XLStylizedEmpty(DefaultStyle); + emptyContainer.UpdatingStyle = true; + + var style = new XLStyle(emptyContainer, DefaultStyle); LoadFont(df.Font, style.Font); LoadBorder(df.Border, style.Border); LoadNumberFormat(df.NumberingFormat, style.NumberFormat); - LoadFill(df.Fill, style.Fill); + LoadFill(df.Fill, style.Fill, differentialFillFormat: true); + + emptyContainer.UpdatingStyle = false; + if (!dictionary.ContainsKey(style)) - dictionary.Add(style, ++id); + dictionary.Add(style, id++); } } - private static void AddDifferentialFormat(DifferentialFormats differentialFormats, IXLConditionalFormat cf, + private static void AddConditionalDifferentialFormat(DifferentialFormats differentialFormats, IXLConditionalFormat cf, SaveContext context) { var differentialFormat = new DifferentialFormat(); @@ -3283,7 +3342,7 @@ }; differentialFormat.Append(numberFormat); } - differentialFormat.Append(GetNewFill(new FillInfo { Fill = cf.Style.Fill as XLFill }, false)); + differentialFormat.Append(GetNewFill(new FillInfo { Fill = cf.Style.Fill as XLFill }, differentialFillFormat: true, ignoreMod: false)); differentialFormat.Append(GetNewBorder(new BorderInfo { Border = cf.Style.Border as XLBorder }, false)); differentialFormats.Append(differentialFormat); @@ -3291,6 +3350,42 @@ context.DifferentialFormats.Add(cf.Style, differentialFormats.Count() - 1); } + private static void AddStyleAsDifferentialFormat(DifferentialFormats differentialFormats, IXLStyle style, + SaveContext context) + { + var differentialFormat = new DifferentialFormat(); + differentialFormat.Append(GetNewFont(new FontInfo { Font = style.Font as XLFont }, false)); + if (!String.IsNullOrWhiteSpace(style.NumberFormat.Format) || style.NumberFormat.NumberFormatId != 0) + { + var numberFormat = new NumberingFormat(); + + if (style.NumberFormat.NumberFormatId == -1) + { + numberFormat.FormatCode = style.NumberFormat.Format; + numberFormat.NumberFormatId = (UInt32)(XLConstants.NumberOfBuiltInStyles + + differentialFormats + .Descendants() + .Count(df => df.NumberingFormat != null && df.NumberingFormat.NumberFormatId != null && df.NumberingFormat.NumberFormatId.Value >= XLConstants.NumberOfBuiltInStyles)); + } + else + { + numberFormat.NumberFormatId = (UInt32)(style.NumberFormat.NumberFormatId); + if (!string.IsNullOrEmpty(style.NumberFormat.Format)) + numberFormat.FormatCode = style.NumberFormat.Format; + else if (XLPredefinedFormat.FormatCodes.ContainsKey(style.NumberFormat.NumberFormatId)) + numberFormat.FormatCode = XLPredefinedFormat.FormatCodes[style.NumberFormat.NumberFormatId]; + } + + differentialFormat.Append(numberFormat); + } + differentialFormat.Append(GetNewFill(new FillInfo { Fill = style.Fill as XLFill }, differentialFillFormat: true, ignoreMod: false)); + differentialFormat.Append(GetNewBorder(new BorderInfo { Border = style.Border as XLBorder }, false)); + + differentialFormats.Append(differentialFormat); + + context.DifferentialFormats.Add(style, differentialFormats.Count() - 1); + } + private static void ResolveRest(WorkbookStylesPart workbookStylesPart, SaveContext context) { if (workbookStylesPart.Stylesheet.CellFormats == null) @@ -3619,7 +3714,7 @@ var foundOne = false; foreach (Fill f in workbookStylesPart.Stylesheet.Fills) { - if (FillsAreEqual(f, fillInfo.Fill)) + if (FillsAreEqual(f, fillInfo.Fill, fromDifferentialFormat: false)) { foundOne = true; break; @@ -3628,7 +3723,7 @@ } if (!foundOne) { - var fill = GetNewFill(fillInfo); + var fill = GetNewFill(fillInfo, differentialFillFormat: false); workbookStylesPart.Stylesheet.Fills.AppendChild(fill); } allSharedFills.Add(fillInfo.Fill, new FillInfo { Fill = fillInfo.Fill, FillId = (UInt32)fillId }); @@ -3652,44 +3747,122 @@ fills.AppendChild(fill1); } - private static Fill GetNewFill(FillInfo fillInfo, Boolean ignoreMod = true) + private static Fill GetNewFill(FillInfo fillInfo, Boolean differentialFillFormat, Boolean ignoreMod = true) { var fill = new Fill(); var patternFill = new PatternFill(); - if (fillInfo.Fill.PatternTypeModified || ignoreMod) - patternFill.PatternType = fillInfo.Fill.PatternType.ToOpenXml(); - if (fillInfo.Fill.PatternColorModified || ignoreMod) - { - var foregroundColor = new ForegroundColor(); - if (fillInfo.Fill.PatternColor.ColorType == XLColorType.Color) - foregroundColor.Rgb = fillInfo.Fill.PatternColor.Color.ToHex(); - else if (fillInfo.Fill.PatternColor.ColorType == XLColorType.Indexed) - foregroundColor.Indexed = (UInt32)fillInfo.Fill.PatternColor.Indexed; - else - { - foregroundColor.Theme = (UInt32)fillInfo.Fill.PatternColor.ThemeColor; - if (fillInfo.Fill.PatternColor.ThemeTint != 0) - foregroundColor.Tint = fillInfo.Fill.PatternColor.ThemeTint; - } - patternFill.AppendChild(foregroundColor); - } + patternFill.PatternType = fillInfo.Fill.PatternType.ToOpenXml(); - if (fillInfo.Fill.PatternBackgroundColorModified || ignoreMod) + BackgroundColor backgroundColor; + ForegroundColor foregroundColor; + + switch (fillInfo.Fill.PatternType) { - var backgroundColor = new BackgroundColor(); - if (fillInfo.Fill.PatternBackgroundColor.ColorType == XLColorType.Color) - backgroundColor.Rgb = fillInfo.Fill.PatternBackgroundColor.Color.ToHex(); - else if (fillInfo.Fill.PatternBackgroundColor.ColorType == XLColorType.Indexed) - backgroundColor.Indexed = (UInt32)fillInfo.Fill.PatternBackgroundColor.Indexed; - else - { - backgroundColor.Theme = (UInt32)fillInfo.Fill.PatternBackgroundColor.ThemeColor; - if (fillInfo.Fill.PatternBackgroundColor.ThemeTint != 0) - backgroundColor.Tint = fillInfo.Fill.PatternBackgroundColor.ThemeTint; - } - patternFill.AppendChild(backgroundColor); + case XLFillPatternValues.None: + break; + + case XLFillPatternValues.Solid: + if (differentialFillFormat) + { + patternFill.AppendChild(new ForegroundColor { Auto = true }); + backgroundColor = new BackgroundColor(); + switch (fillInfo.Fill.BackgroundColor.ColorType) + { + case XLColorType.Color: + backgroundColor.Rgb = fillInfo.Fill.BackgroundColor.Color.ToHex(); + break; + + case XLColorType.Indexed: + backgroundColor.Indexed = (UInt32)fillInfo.Fill.BackgroundColor.Indexed; + break; + + case XLColorType.Theme: + backgroundColor.Theme = (UInt32)fillInfo.Fill.BackgroundColor.ThemeColor; + + if (fillInfo.Fill.BackgroundColor.ThemeTint != 0) + backgroundColor.Tint = fillInfo.Fill.BackgroundColor.ThemeTint; + + break; + } + + patternFill.AppendChild(backgroundColor); + } + else + { + // ClosedXML Background color to be populated into OpenXML fgColor + foregroundColor = new ForegroundColor(); + switch (fillInfo.Fill.BackgroundColor.ColorType) + { + case XLColorType.Color: + foregroundColor.Rgb = fillInfo.Fill.BackgroundColor.Color.ToHex(); + break; + + case XLColorType.Indexed: + foregroundColor.Indexed = (UInt32)fillInfo.Fill.BackgroundColor.Indexed; + break; + + case XLColorType.Theme: + foregroundColor.Theme = (UInt32)fillInfo.Fill.BackgroundColor.ThemeColor; + + if (fillInfo.Fill.BackgroundColor.ThemeTint != 0) + foregroundColor.Tint = fillInfo.Fill.BackgroundColor.ThemeTint; + + break; + } + + patternFill.AppendChild(foregroundColor); + } + break; + + default: + + foregroundColor = new ForegroundColor(); + switch (fillInfo.Fill.PatternColor.ColorType) + { + case XLColorType.Color: + foregroundColor.Rgb = fillInfo.Fill.PatternColor.Color.ToHex(); + break; + + case XLColorType.Indexed: + foregroundColor.Indexed = (UInt32)fillInfo.Fill.PatternColor.Indexed; + break; + + case XLColorType.Theme: + foregroundColor.Theme = (UInt32)fillInfo.Fill.PatternColor.ThemeColor; + + if (fillInfo.Fill.PatternColor.ThemeTint != 0) + foregroundColor.Tint = fillInfo.Fill.PatternColor.ThemeTint; + + break; + } + + patternFill.AppendChild(foregroundColor); + + backgroundColor = new BackgroundColor(); + switch (fillInfo.Fill.BackgroundColor.ColorType) + { + case XLColorType.Color: + backgroundColor.Rgb = fillInfo.Fill.BackgroundColor.Color.ToHex(); + break; + + case XLColorType.Indexed: + backgroundColor.Indexed = (UInt32)fillInfo.Fill.BackgroundColor.Indexed; + break; + + case XLColorType.Theme: + backgroundColor.Theme = (UInt32)fillInfo.Fill.BackgroundColor.ThemeColor; + + if (fillInfo.Fill.BackgroundColor.ThemeTint != 0) + backgroundColor.Tint = fillInfo.Fill.BackgroundColor.ThemeTint; + + break; + } + + patternFill.AppendChild(backgroundColor); + + break; } fill.AppendChild(patternFill); @@ -3697,22 +3870,12 @@ return fill; } - private bool FillsAreEqual(Fill f, IXLFill xlFill) + private bool FillsAreEqual(Fill f, IXLFill xlFill, Boolean fromDifferentialFormat) { var nF = new XLFill(); - if (f.PatternFill != null) - { - if (f.PatternFill.PatternType != null) - nF.PatternType = f.PatternFill.PatternType.Value.ToClosedXml(); - var fColor = GetColor(f.PatternFill.ForegroundColor); - if (fColor.HasValue) - nF.PatternColor = fColor; + LoadFill(f, nF, fromDifferentialFormat); - var bColor = GetColor(f.PatternFill.BackgroundColor); - if (bColor.HasValue) - nF.PatternBackgroundColor = bColor; - } return nF.Equals(xlFill); } @@ -3887,7 +4050,7 @@ var allSharedNumberFormats = new Dictionary(); foreach (var numberFormatInfo in sharedNumberFormats.Values.Where(nf => nf.NumberFormatId != defaultFormatId)) { - var numberingFormatId = XLConstants.NumberOfBuiltInStyles + 1; + var numberingFormatId = XLConstants.NumberOfBuiltInStyles; // 0-based var foundOne = false; foreach (NumberingFormat nf in workbookStylesPart.Stylesheet.NumberingFormats) { diff --git a/ClosedXML_Examples/Columns/InsertColumns.cs b/ClosedXML_Examples/Columns/InsertColumns.cs index 58b05ee..e908c01 100644 --- a/ClosedXML_Examples/Columns/InsertColumns.cs +++ b/ClosedXML_Examples/Columns/InsertColumns.cs @@ -1,46 +1,11 @@ +using ClosedXML.Excel; using System; using System.Linq; -using ClosedXML.Excel; - namespace ClosedXML_Examples.Columns { public class InsertColumns : IXLExample { - #region Variables - - // Public - - // Private - - - #endregion - - #region Properties - - // Public - - // Private - - // Override - - - #endregion - - #region Events - - // Public - - // Private - - // Override - - - #endregion - - #region Methods - - // Public public void Create(String filePath) { var workbook = new XLWorkbook(); @@ -54,14 +19,12 @@ foreach (var c in Enumerable.Range(1, 5)) ws.Cell(r, c).Value = "X"; - var blueColumn = ws.Column(2); var redColumn = ws.Column(5); blueColumn.Style.Fill.BackgroundColor = XLColor.Blue; blueColumn.InsertColumnsAfter(2); - redColumn.Style.Fill.BackgroundColor = XLColor.Red; redColumn.InsertColumnsBefore(2); @@ -73,12 +36,5 @@ workbook.SaveAs(filePath); } - - // Private - - // Override - - - #endregion } } diff --git a/ClosedXML_Examples/Styles/StyleFill.cs b/ClosedXML_Examples/Styles/StyleFill.cs index a5d0800..8a85791 100644 --- a/ClosedXML_Examples/Styles/StyleFill.cs +++ b/ClosedXML_Examples/Styles/StyleFill.cs @@ -1,11 +1,8 @@ -using System; using ClosedXML.Excel; - +using System; namespace ClosedXML_Examples.Styles { - - public class StyleFill : IXLExample { public void Create(String filePath) @@ -19,12 +16,12 @@ ws.Cell(++ro, co + 1).Value = "BackgroundColor = Red"; ws.Cell(ro, co).Style.Fill.BackgroundColor = XLColor.Red; - ws.Cell(++ro, co + 1).Value = "PatternType = DarkTrellis; PatternColor = Orange; PatternBackgroundColor = Blue"; + ws.Cell(++ro, co + 1).Value = "PatternType = DarkTrellis; PatternColor = Orange; BackgroundColor = Blue"; ws.Cell(ro, co).Style.Fill.PatternType = XLFillPatternValues.DarkTrellis; ws.Cell(ro, co).Style.Fill.PatternColor = XLColor.Orange; - ws.Cell(ro, co).Style.Fill.PatternBackgroundColor = XLColor.Blue; + ws.Cell(ro, co).Style.Fill.BackgroundColor = XLColor.Blue; workbook.SaveAs(filePath); } } -} \ No newline at end of file +} diff --git a/ClosedXML_Examples/Tables/UsingTables.cs b/ClosedXML_Examples/Tables/UsingTables.cs index 639a0a0..24f4903 100644 --- a/ClosedXML_Examples/Tables/UsingTables.cs +++ b/ClosedXML_Examples/Tables/UsingTables.cs @@ -21,7 +21,7 @@ ws.Name = "Contacts Table"; var firstCell = ws.FirstCellUsed(); var lastCell = ws.LastCellUsed(); - var range = ws.Range(firstCell.Address, lastCell.Address); + var range = ws.Range(firstCell.Address, lastCell.CellRight().Address); range.FirstRow().Delete(); // Deleting the "Contacts" header (we don't need it for our purposes) // We want to use a theme for table, not the hard coded format of the BasicTable @@ -30,6 +30,15 @@ range.Column(4).Style.NumberFormat.NumberFormatId = 15; range.Column(5).Style.NumberFormat.Format = "$ #,##0"; + // Add a field + range.Column(6).FirstCell().SetValue("Age"); + var c = range.Column(6).FirstCell().CellBelow(); + c.Style.NumberFormat.SetFormat("0.00"); + c.FormulaA1 = "=(DATE(2017, 10, 3) - E3) / 365"; + + c.CopyTo(c.CellBelow()) + .CopyTo(c.CellBelow().CellBelow()); + var table = range.CreateTable(); // You can also use range.AsTable() if you want to // manipulate the range as a table but don't want // to create the table in the worksheet. @@ -40,8 +49,10 @@ // Just for fun let's add the text "Sum Of Income" to the totals row table.Field(0).TotalsRowLabel = "Sum Of Income"; + table.Field("Age").TotalsRowFunction = XLTotalsRowFunction.Average; + // Copy all the headers - Int32 columnWithHeaders = lastCell.Address.ColumnNumber + 2; + Int32 columnWithHeaders = lastCell.Address.ColumnNumber + 3; Int32 currentRow = table.RangeAddress.FirstAddress.RowNumber; ws.Cell(currentRow, columnWithHeaders).Value = "Table Headers"; foreach (var cell in table.HeadersRow().Cells()) @@ -82,7 +93,7 @@ namesTable.ShowAutoFilter = false; ws.Columns().AdjustToContents(); - ws.Columns("A,G,I").Width = 3; + ws.Columns("A,H,J").Width = 3; wb.SaveAs(filePath); } diff --git a/ClosedXML_Tests/Examples/ColumnsTests.cs b/ClosedXML_Tests/Examples/ColumnsTests.cs index 1ecd215..b5007bf 100644 --- a/ClosedXML_Tests/Examples/ColumnsTests.cs +++ b/ClosedXML_Tests/Examples/ColumnsTests.cs @@ -30,5 +30,11 @@ { TestHelper.RunTestExample(@"Columns\DeletingColumns.xlsx"); } + + //[Test] // Not working yet + public void InsertColumns() + { + TestHelper.RunTestExample(@"Columns\InsertColumns.xlsx"); + } } -} \ No newline at end of file +} diff --git a/ClosedXML_Tests/Examples/RowsTests.cs b/ClosedXML_Tests/Examples/RowsTests.cs index 3042957..446b812 100644 --- a/ClosedXML_Tests/Examples/RowsTests.cs +++ b/ClosedXML_Tests/Examples/RowsTests.cs @@ -24,5 +24,11 @@ { TestHelper.RunTestExample(@"Rows\RowSettings.xlsx"); } + + //[Test] // Not working yet + public void InsertRows() + { + TestHelper.RunTestExample(@"Rows\InsertRows.xlsx"); + } } -} \ No newline at end of file +} diff --git a/ClosedXML_Tests/Excel/Styles/XLFillTests.cs b/ClosedXML_Tests/Excel/Styles/XLFillTests.cs index 6177890..72abc22 100644 --- a/ClosedXML_Tests/Excel/Styles/XLFillTests.cs +++ b/ClosedXML_Tests/Excel/Styles/XLFillTests.cs @@ -26,16 +26,16 @@ [Test] public void BackgroundPatternEqualCheck() { - var fill1 = new XLFill {PatternBackgroundColor = XLColor.Blue}; - var fill2 = new XLFill {PatternBackgroundColor = XLColor.Blue}; + var fill1 = new XLFill {BackgroundColor = XLColor.Blue}; + var fill2 = new XLFill {BackgroundColor = XLColor.Blue}; Assert.IsTrue(fill1.Equals(fill2)); } [Test] public void BackgroundPatternNotEqualCheck() { - var fill1 = new XLFill {PatternBackgroundColor = XLColor.Blue}; - var fill2 = new XLFill {PatternBackgroundColor = XLColor.Red}; + var fill1 = new XLFill {BackgroundColor = XLColor.Blue}; + var fill2 = new XLFill {BackgroundColor = XLColor.Red}; Assert.IsFalse(fill1.Equals(fill2)); } @@ -48,8 +48,8 @@ var cf = worksheet.Cell(2, 2).AddConditionalFormat(); var style = cf.WhenNotBlank(); style - .Border.SetOutsideBorder(XLBorderStyleValues.Thick) - .Border.SetOutsideBorderColor(XLColor.Blue); + .Border.SetOutsideBorder(XLBorderStyleValues.Thick) + .Border.SetOutsideBorderColor(XLColor.Blue); Assert.AreEqual(style.Border.BottomBorder, XLBorderStyleValues.Thick); Assert.AreEqual(style.Border.TopBorder, XLBorderStyleValues.Thick); @@ -62,4 +62,4 @@ Assert.AreEqual(style.Border.RightBorderColor, XLColor.Blue); } } -} \ No newline at end of file +} diff --git a/ClosedXML_Tests/Resource/Examples/AutoFilter/CustomAutoFilter.xlsx b/ClosedXML_Tests/Resource/Examples/AutoFilter/CustomAutoFilter.xlsx index 2ee0c8d..156af42 100644 --- a/ClosedXML_Tests/Resource/Examples/AutoFilter/CustomAutoFilter.xlsx +++ b/ClosedXML_Tests/Resource/Examples/AutoFilter/CustomAutoFilter.xlsx Binary files differ diff --git a/ClosedXML_Tests/Resource/Examples/AutoFilter/DynamicAutoFilter.xlsx b/ClosedXML_Tests/Resource/Examples/AutoFilter/DynamicAutoFilter.xlsx index 0b2fb27..ca26674 100644 --- a/ClosedXML_Tests/Resource/Examples/AutoFilter/DynamicAutoFilter.xlsx +++ b/ClosedXML_Tests/Resource/Examples/AutoFilter/DynamicAutoFilter.xlsx Binary files differ diff --git a/ClosedXML_Tests/Resource/Examples/AutoFilter/RegularAutoFilter.xlsx b/ClosedXML_Tests/Resource/Examples/AutoFilter/RegularAutoFilter.xlsx index 7221dae..1e430a1 100644 --- a/ClosedXML_Tests/Resource/Examples/AutoFilter/RegularAutoFilter.xlsx +++ b/ClosedXML_Tests/Resource/Examples/AutoFilter/RegularAutoFilter.xlsx Binary files differ diff --git a/ClosedXML_Tests/Resource/Examples/AutoFilter/TopBottomAutoFilter.xlsx b/ClosedXML_Tests/Resource/Examples/AutoFilter/TopBottomAutoFilter.xlsx index 4e069ba..e396345 100644 --- a/ClosedXML_Tests/Resource/Examples/AutoFilter/TopBottomAutoFilter.xlsx +++ b/ClosedXML_Tests/Resource/Examples/AutoFilter/TopBottomAutoFilter.xlsx Binary files differ diff --git a/ClosedXML_Tests/Resource/Examples/Columns/ColumnCells.xlsx b/ClosedXML_Tests/Resource/Examples/Columns/ColumnCells.xlsx index 2e35af2..70c8e96 100644 --- a/ClosedXML_Tests/Resource/Examples/Columns/ColumnCells.xlsx +++ b/ClosedXML_Tests/Resource/Examples/Columns/ColumnCells.xlsx Binary files differ diff --git a/ClosedXML_Tests/Resource/Examples/Columns/ColumnCollection.xlsx b/ClosedXML_Tests/Resource/Examples/Columns/ColumnCollection.xlsx index 8210ecf..be26aca 100644 --- a/ClosedXML_Tests/Resource/Examples/Columns/ColumnCollection.xlsx +++ b/ClosedXML_Tests/Resource/Examples/Columns/ColumnCollection.xlsx Binary files differ diff --git a/ClosedXML_Tests/Resource/Examples/Columns/ColumnSettings.xlsx b/ClosedXML_Tests/Resource/Examples/Columns/ColumnSettings.xlsx index d729b73..ea65770 100644 --- a/ClosedXML_Tests/Resource/Examples/Columns/ColumnSettings.xlsx +++ b/ClosedXML_Tests/Resource/Examples/Columns/ColumnSettings.xlsx Binary files differ diff --git a/ClosedXML_Tests/Resource/Examples/Columns/DeletingColumns.xlsx b/ClosedXML_Tests/Resource/Examples/Columns/DeletingColumns.xlsx index e2ac29f..83b5a8d 100644 --- a/ClosedXML_Tests/Resource/Examples/Columns/DeletingColumns.xlsx +++ b/ClosedXML_Tests/Resource/Examples/Columns/DeletingColumns.xlsx Binary files differ diff --git a/ClosedXML_Tests/Resource/Examples/Comments/AddingComments.xlsx b/ClosedXML_Tests/Resource/Examples/Comments/AddingComments.xlsx index 5c9ae0a..775345e 100644 --- a/ClosedXML_Tests/Resource/Examples/Comments/AddingComments.xlsx +++ b/ClosedXML_Tests/Resource/Examples/Comments/AddingComments.xlsx Binary files differ diff --git a/ClosedXML_Tests/Resource/Examples/ConditionalFormatting/CFColorScaleLowHigh.xlsx b/ClosedXML_Tests/Resource/Examples/ConditionalFormatting/CFColorScaleLowHigh.xlsx index 8e28b85..80e81a7 100644 --- a/ClosedXML_Tests/Resource/Examples/ConditionalFormatting/CFColorScaleLowHigh.xlsx +++ b/ClosedXML_Tests/Resource/Examples/ConditionalFormatting/CFColorScaleLowHigh.xlsx Binary files differ diff --git a/ClosedXML_Tests/Resource/Examples/ConditionalFormatting/CFColorScaleLowMidHigh.xlsx b/ClosedXML_Tests/Resource/Examples/ConditionalFormatting/CFColorScaleLowMidHigh.xlsx index a9216c5..797dc0b 100644 --- a/ClosedXML_Tests/Resource/Examples/ConditionalFormatting/CFColorScaleLowMidHigh.xlsx +++ b/ClosedXML_Tests/Resource/Examples/ConditionalFormatting/CFColorScaleLowMidHigh.xlsx Binary files differ diff --git a/ClosedXML_Tests/Resource/Examples/ConditionalFormatting/CFColorScaleMinimumMaximum.xlsx b/ClosedXML_Tests/Resource/Examples/ConditionalFormatting/CFColorScaleMinimumMaximum.xlsx index 965c332..e58bfc1 100644 --- a/ClosedXML_Tests/Resource/Examples/ConditionalFormatting/CFColorScaleMinimumMaximum.xlsx +++ b/ClosedXML_Tests/Resource/Examples/ConditionalFormatting/CFColorScaleMinimumMaximum.xlsx Binary files differ diff --git a/ClosedXML_Tests/Resource/Examples/ConditionalFormatting/CFContains.xlsx b/ClosedXML_Tests/Resource/Examples/ConditionalFormatting/CFContains.xlsx index 4721b41..a0c3791 100644 --- a/ClosedXML_Tests/Resource/Examples/ConditionalFormatting/CFContains.xlsx +++ b/ClosedXML_Tests/Resource/Examples/ConditionalFormatting/CFContains.xlsx Binary files differ diff --git a/ClosedXML_Tests/Resource/Examples/ConditionalFormatting/CFDataBar.xlsx b/ClosedXML_Tests/Resource/Examples/ConditionalFormatting/CFDataBar.xlsx index 4db382d..8e1cc60 100644 --- a/ClosedXML_Tests/Resource/Examples/ConditionalFormatting/CFDataBar.xlsx +++ b/ClosedXML_Tests/Resource/Examples/ConditionalFormatting/CFDataBar.xlsx Binary files differ diff --git a/ClosedXML_Tests/Resource/Examples/ConditionalFormatting/CFDataBarNegative.xlsx b/ClosedXML_Tests/Resource/Examples/ConditionalFormatting/CFDataBarNegative.xlsx index fa46948..8ad081e 100644 --- a/ClosedXML_Tests/Resource/Examples/ConditionalFormatting/CFDataBarNegative.xlsx +++ b/ClosedXML_Tests/Resource/Examples/ConditionalFormatting/CFDataBarNegative.xlsx Binary files differ diff --git a/ClosedXML_Tests/Resource/Examples/ConditionalFormatting/CFEndsWith.xlsx b/ClosedXML_Tests/Resource/Examples/ConditionalFormatting/CFEndsWith.xlsx index e2d4308..bfb06cd 100644 --- a/ClosedXML_Tests/Resource/Examples/ConditionalFormatting/CFEndsWith.xlsx +++ b/ClosedXML_Tests/Resource/Examples/ConditionalFormatting/CFEndsWith.xlsx Binary files differ diff --git a/ClosedXML_Tests/Resource/Examples/ConditionalFormatting/CFEqualsNumber.xlsx b/ClosedXML_Tests/Resource/Examples/ConditionalFormatting/CFEqualsNumber.xlsx index a75c503..bbfa6d4 100644 --- a/ClosedXML_Tests/Resource/Examples/ConditionalFormatting/CFEqualsNumber.xlsx +++ b/ClosedXML_Tests/Resource/Examples/ConditionalFormatting/CFEqualsNumber.xlsx Binary files differ diff --git a/ClosedXML_Tests/Resource/Examples/ConditionalFormatting/CFEqualsString.xlsx b/ClosedXML_Tests/Resource/Examples/ConditionalFormatting/CFEqualsString.xlsx index 07e8628..4b6a481 100644 --- a/ClosedXML_Tests/Resource/Examples/ConditionalFormatting/CFEqualsString.xlsx +++ b/ClosedXML_Tests/Resource/Examples/ConditionalFormatting/CFEqualsString.xlsx Binary files differ diff --git a/ClosedXML_Tests/Resource/Examples/ConditionalFormatting/CFIconSet.xlsx b/ClosedXML_Tests/Resource/Examples/ConditionalFormatting/CFIconSet.xlsx index fb91ef7..0ef2377 100644 --- a/ClosedXML_Tests/Resource/Examples/ConditionalFormatting/CFIconSet.xlsx +++ b/ClosedXML_Tests/Resource/Examples/ConditionalFormatting/CFIconSet.xlsx Binary files differ diff --git a/ClosedXML_Tests/Resource/Examples/ConditionalFormatting/CFIsBlank.xlsx b/ClosedXML_Tests/Resource/Examples/ConditionalFormatting/CFIsBlank.xlsx index e57b38d..84f5931 100644 --- a/ClosedXML_Tests/Resource/Examples/ConditionalFormatting/CFIsBlank.xlsx +++ b/ClosedXML_Tests/Resource/Examples/ConditionalFormatting/CFIsBlank.xlsx Binary files differ diff --git a/ClosedXML_Tests/Resource/Examples/ConditionalFormatting/CFIsError.xlsx b/ClosedXML_Tests/Resource/Examples/ConditionalFormatting/CFIsError.xlsx index e952a7f..0677026 100644 --- a/ClosedXML_Tests/Resource/Examples/ConditionalFormatting/CFIsError.xlsx +++ b/ClosedXML_Tests/Resource/Examples/ConditionalFormatting/CFIsError.xlsx Binary files differ diff --git a/ClosedXML_Tests/Resource/Examples/ConditionalFormatting/CFMultipleConditions.xlsx b/ClosedXML_Tests/Resource/Examples/ConditionalFormatting/CFMultipleConditions.xlsx index 0d31d2a..d396c20 100644 --- a/ClosedXML_Tests/Resource/Examples/ConditionalFormatting/CFMultipleConditions.xlsx +++ b/ClosedXML_Tests/Resource/Examples/ConditionalFormatting/CFMultipleConditions.xlsx Binary files differ diff --git a/ClosedXML_Tests/Resource/Examples/ConditionalFormatting/CFNotBlank.xlsx b/ClosedXML_Tests/Resource/Examples/ConditionalFormatting/CFNotBlank.xlsx index e233171..f2a8f5b 100644 --- a/ClosedXML_Tests/Resource/Examples/ConditionalFormatting/CFNotBlank.xlsx +++ b/ClosedXML_Tests/Resource/Examples/ConditionalFormatting/CFNotBlank.xlsx Binary files differ diff --git a/ClosedXML_Tests/Resource/Examples/ConditionalFormatting/CFNotContains.xlsx b/ClosedXML_Tests/Resource/Examples/ConditionalFormatting/CFNotContains.xlsx index 1b3b379..22026b6 100644 --- a/ClosedXML_Tests/Resource/Examples/ConditionalFormatting/CFNotContains.xlsx +++ b/ClosedXML_Tests/Resource/Examples/ConditionalFormatting/CFNotContains.xlsx Binary files differ diff --git a/ClosedXML_Tests/Resource/Examples/ConditionalFormatting/CFNotEqualsNumber.xlsx b/ClosedXML_Tests/Resource/Examples/ConditionalFormatting/CFNotEqualsNumber.xlsx index 7d1bd15..4eabc7c 100644 --- a/ClosedXML_Tests/Resource/Examples/ConditionalFormatting/CFNotEqualsNumber.xlsx +++ b/ClosedXML_Tests/Resource/Examples/ConditionalFormatting/CFNotEqualsNumber.xlsx Binary files differ diff --git a/ClosedXML_Tests/Resource/Examples/ConditionalFormatting/CFNotEqualsString.xlsx b/ClosedXML_Tests/Resource/Examples/ConditionalFormatting/CFNotEqualsString.xlsx index 531411d..72e5631 100644 --- a/ClosedXML_Tests/Resource/Examples/ConditionalFormatting/CFNotEqualsString.xlsx +++ b/ClosedXML_Tests/Resource/Examples/ConditionalFormatting/CFNotEqualsString.xlsx Binary files differ diff --git a/ClosedXML_Tests/Resource/Examples/ConditionalFormatting/CFNotError.xlsx b/ClosedXML_Tests/Resource/Examples/ConditionalFormatting/CFNotError.xlsx index 9b07849..c808164 100644 --- a/ClosedXML_Tests/Resource/Examples/ConditionalFormatting/CFNotError.xlsx +++ b/ClosedXML_Tests/Resource/Examples/ConditionalFormatting/CFNotError.xlsx Binary files differ diff --git a/ClosedXML_Tests/Resource/Examples/ConditionalFormatting/CFStartsWith.xlsx b/ClosedXML_Tests/Resource/Examples/ConditionalFormatting/CFStartsWith.xlsx index e19f30e..cc432eb 100644 --- a/ClosedXML_Tests/Resource/Examples/ConditionalFormatting/CFStartsWith.xlsx +++ b/ClosedXML_Tests/Resource/Examples/ConditionalFormatting/CFStartsWith.xlsx Binary files differ diff --git a/ClosedXML_Tests/Resource/Examples/ConditionalFormatting/CFStopIfTrue.xlsx b/ClosedXML_Tests/Resource/Examples/ConditionalFormatting/CFStopIfTrue.xlsx index 9894731..de67d1e 100644 --- a/ClosedXML_Tests/Resource/Examples/ConditionalFormatting/CFStopIfTrue.xlsx +++ b/ClosedXML_Tests/Resource/Examples/ConditionalFormatting/CFStopIfTrue.xlsx Binary files differ diff --git a/ClosedXML_Tests/Resource/Examples/Delete/DeleteFewWorksheets.xlsx b/ClosedXML_Tests/Resource/Examples/Delete/DeleteFewWorksheets.xlsx index 0bfcae5..df718c9 100644 --- a/ClosedXML_Tests/Resource/Examples/Delete/DeleteFewWorksheets.xlsx +++ b/ClosedXML_Tests/Resource/Examples/Delete/DeleteFewWorksheets.xlsx Binary files differ diff --git a/ClosedXML_Tests/Resource/Examples/Delete/RemoveRows.xlsx b/ClosedXML_Tests/Resource/Examples/Delete/RemoveRows.xlsx index 3a4822a..31ef954 100644 --- a/ClosedXML_Tests/Resource/Examples/Delete/RemoveRows.xlsx +++ b/ClosedXML_Tests/Resource/Examples/Delete/RemoveRows.xlsx Binary files differ diff --git a/ClosedXML_Tests/Resource/Examples/ImageHandling/ImageAnchors.xlsx b/ClosedXML_Tests/Resource/Examples/ImageHandling/ImageAnchors.xlsx index d2a90ba..40e2d5d 100644 --- a/ClosedXML_Tests/Resource/Examples/ImageHandling/ImageAnchors.xlsx +++ b/ClosedXML_Tests/Resource/Examples/ImageHandling/ImageAnchors.xlsx Binary files differ diff --git a/ClosedXML_Tests/Resource/Examples/ImageHandling/ImageFormats.xlsx b/ClosedXML_Tests/Resource/Examples/ImageHandling/ImageFormats.xlsx index 3ec78e0..ecd11ca 100644 --- a/ClosedXML_Tests/Resource/Examples/ImageHandling/ImageFormats.xlsx +++ b/ClosedXML_Tests/Resource/Examples/ImageHandling/ImageFormats.xlsx Binary files differ diff --git a/ClosedXML_Tests/Resource/Examples/Loading/ChangingBasicTable.xlsx b/ClosedXML_Tests/Resource/Examples/Loading/ChangingBasicTable.xlsx index 30a397a..a27f51c 100644 --- a/ClosedXML_Tests/Resource/Examples/Loading/ChangingBasicTable.xlsx +++ b/ClosedXML_Tests/Resource/Examples/Loading/ChangingBasicTable.xlsx Binary files differ diff --git a/ClosedXML_Tests/Resource/Examples/Misc/AddingDataSet.xlsx b/ClosedXML_Tests/Resource/Examples/Misc/AddingDataSet.xlsx index c5abda2..cd861ef 100644 --- a/ClosedXML_Tests/Resource/Examples/Misc/AddingDataSet.xlsx +++ b/ClosedXML_Tests/Resource/Examples/Misc/AddingDataSet.xlsx Binary files differ diff --git a/ClosedXML_Tests/Resource/Examples/Misc/AddingDataTableAsWorksheet.xlsx b/ClosedXML_Tests/Resource/Examples/Misc/AddingDataTableAsWorksheet.xlsx index 3dcec19..7c3a2ec 100644 --- a/ClosedXML_Tests/Resource/Examples/Misc/AddingDataTableAsWorksheet.xlsx +++ b/ClosedXML_Tests/Resource/Examples/Misc/AddingDataTableAsWorksheet.xlsx Binary files differ diff --git a/ClosedXML_Tests/Resource/Examples/Misc/AdjustToContents.xlsx b/ClosedXML_Tests/Resource/Examples/Misc/AdjustToContents.xlsx index ec9111e..0d98696 100644 --- a/ClosedXML_Tests/Resource/Examples/Misc/AdjustToContents.xlsx +++ b/ClosedXML_Tests/Resource/Examples/Misc/AdjustToContents.xlsx Binary files differ diff --git a/ClosedXML_Tests/Resource/Examples/Misc/AdjustToContentsWithAutoFilter.xlsx b/ClosedXML_Tests/Resource/Examples/Misc/AdjustToContentsWithAutoFilter.xlsx index c71500f..5b1a0db 100644 --- a/ClosedXML_Tests/Resource/Examples/Misc/AdjustToContentsWithAutoFilter.xlsx +++ b/ClosedXML_Tests/Resource/Examples/Misc/AdjustToContentsWithAutoFilter.xlsx Binary files differ diff --git a/ClosedXML_Tests/Resource/Examples/Misc/AutoFilter.xlsx b/ClosedXML_Tests/Resource/Examples/Misc/AutoFilter.xlsx index e18cf50..9765c38 100644 --- a/ClosedXML_Tests/Resource/Examples/Misc/AutoFilter.xlsx +++ b/ClosedXML_Tests/Resource/Examples/Misc/AutoFilter.xlsx Binary files differ diff --git a/ClosedXML_Tests/Resource/Examples/Misc/BasicTable.xlsx b/ClosedXML_Tests/Resource/Examples/Misc/BasicTable.xlsx index 7109c2e..fc3c33f 100644 --- a/ClosedXML_Tests/Resource/Examples/Misc/BasicTable.xlsx +++ b/ClosedXML_Tests/Resource/Examples/Misc/BasicTable.xlsx Binary files differ diff --git a/ClosedXML_Tests/Resource/Examples/Misc/BlankCells.xlsx b/ClosedXML_Tests/Resource/Examples/Misc/BlankCells.xlsx index 3f4195a..6c5eccc 100644 --- a/ClosedXML_Tests/Resource/Examples/Misc/BlankCells.xlsx +++ b/ClosedXML_Tests/Resource/Examples/Misc/BlankCells.xlsx Binary files differ diff --git a/ClosedXML_Tests/Resource/Examples/Misc/CellValues.xlsx b/ClosedXML_Tests/Resource/Examples/Misc/CellValues.xlsx index ec4c484..d7b945b 100644 --- a/ClosedXML_Tests/Resource/Examples/Misc/CellValues.xlsx +++ b/ClosedXML_Tests/Resource/Examples/Misc/CellValues.xlsx Binary files differ diff --git a/ClosedXML_Tests/Resource/Examples/Misc/Collections.xlsx b/ClosedXML_Tests/Resource/Examples/Misc/Collections.xlsx index d791985..d628b28 100644 --- a/ClosedXML_Tests/Resource/Examples/Misc/Collections.xlsx +++ b/ClosedXML_Tests/Resource/Examples/Misc/Collections.xlsx Binary files differ diff --git a/ClosedXML_Tests/Resource/Examples/Misc/CopyingRowsAndColumns.xlsx b/ClosedXML_Tests/Resource/Examples/Misc/CopyingRowsAndColumns.xlsx index 961f52c..f313701 100644 --- a/ClosedXML_Tests/Resource/Examples/Misc/CopyingRowsAndColumns.xlsx +++ b/ClosedXML_Tests/Resource/Examples/Misc/CopyingRowsAndColumns.xlsx Binary files differ diff --git a/ClosedXML_Tests/Resource/Examples/Misc/CopyingWorksheets.xlsx b/ClosedXML_Tests/Resource/Examples/Misc/CopyingWorksheets.xlsx index 28c4b9b..03b9b20 100644 --- a/ClosedXML_Tests/Resource/Examples/Misc/CopyingWorksheets.xlsx +++ b/ClosedXML_Tests/Resource/Examples/Misc/CopyingWorksheets.xlsx Binary files differ diff --git a/ClosedXML_Tests/Resource/Examples/Misc/DataTypes.xlsx b/ClosedXML_Tests/Resource/Examples/Misc/DataTypes.xlsx index d7b9afd..7b3e5a2 100644 --- a/ClosedXML_Tests/Resource/Examples/Misc/DataTypes.xlsx +++ b/ClosedXML_Tests/Resource/Examples/Misc/DataTypes.xlsx Binary files differ diff --git a/ClosedXML_Tests/Resource/Examples/Misc/DataTypesUnderDifferentCulture.xlsx b/ClosedXML_Tests/Resource/Examples/Misc/DataTypesUnderDifferentCulture.xlsx index f451273..e86beba 100644 --- a/ClosedXML_Tests/Resource/Examples/Misc/DataTypesUnderDifferentCulture.xlsx +++ b/ClosedXML_Tests/Resource/Examples/Misc/DataTypesUnderDifferentCulture.xlsx Binary files differ diff --git a/ClosedXML_Tests/Resource/Examples/Misc/DataValidation.xlsx b/ClosedXML_Tests/Resource/Examples/Misc/DataValidation.xlsx index d2e119b..c5979d8 100644 --- a/ClosedXML_Tests/Resource/Examples/Misc/DataValidation.xlsx +++ b/ClosedXML_Tests/Resource/Examples/Misc/DataValidation.xlsx Binary files differ diff --git a/ClosedXML_Tests/Resource/Examples/Misc/Formulas.xlsx b/ClosedXML_Tests/Resource/Examples/Misc/Formulas.xlsx index c49d20a..513d951 100644 --- a/ClosedXML_Tests/Resource/Examples/Misc/Formulas.xlsx +++ b/ClosedXML_Tests/Resource/Examples/Misc/Formulas.xlsx Binary files differ diff --git a/ClosedXML_Tests/Resource/Examples/Misc/FormulasWithEvaluation.xlsx b/ClosedXML_Tests/Resource/Examples/Misc/FormulasWithEvaluation.xlsx index f1dde09..131fba0 100644 --- a/ClosedXML_Tests/Resource/Examples/Misc/FormulasWithEvaluation.xlsx +++ b/ClosedXML_Tests/Resource/Examples/Misc/FormulasWithEvaluation.xlsx Binary files differ diff --git a/ClosedXML_Tests/Resource/Examples/Misc/FreezePanes.xlsx b/ClosedXML_Tests/Resource/Examples/Misc/FreezePanes.xlsx index 65e4082..ac2714c 100644 --- a/ClosedXML_Tests/Resource/Examples/Misc/FreezePanes.xlsx +++ b/ClosedXML_Tests/Resource/Examples/Misc/FreezePanes.xlsx Binary files differ diff --git a/ClosedXML_Tests/Resource/Examples/Misc/HideSheets.xlsx b/ClosedXML_Tests/Resource/Examples/Misc/HideSheets.xlsx index 084e291..2587ee6 100644 --- a/ClosedXML_Tests/Resource/Examples/Misc/HideSheets.xlsx +++ b/ClosedXML_Tests/Resource/Examples/Misc/HideSheets.xlsx Binary files differ diff --git a/ClosedXML_Tests/Resource/Examples/Misc/HideUnhide.xlsx b/ClosedXML_Tests/Resource/Examples/Misc/HideUnhide.xlsx index 1f99477..792f768 100644 --- a/ClosedXML_Tests/Resource/Examples/Misc/HideUnhide.xlsx +++ b/ClosedXML_Tests/Resource/Examples/Misc/HideUnhide.xlsx Binary files differ diff --git a/ClosedXML_Tests/Resource/Examples/Misc/Hyperlinks.xlsx b/ClosedXML_Tests/Resource/Examples/Misc/Hyperlinks.xlsx index d724e36..a4ab6f6 100644 --- a/ClosedXML_Tests/Resource/Examples/Misc/Hyperlinks.xlsx +++ b/ClosedXML_Tests/Resource/Examples/Misc/Hyperlinks.xlsx Binary files differ diff --git a/ClosedXML_Tests/Resource/Examples/Misc/InsertingData.xlsx b/ClosedXML_Tests/Resource/Examples/Misc/InsertingData.xlsx index d9d1a57..f5db9c4 100644 --- a/ClosedXML_Tests/Resource/Examples/Misc/InsertingData.xlsx +++ b/ClosedXML_Tests/Resource/Examples/Misc/InsertingData.xlsx Binary files differ diff --git a/ClosedXML_Tests/Resource/Examples/Misc/LambdaExpressions.xlsx b/ClosedXML_Tests/Resource/Examples/Misc/LambdaExpressions.xlsx index 939001d..368f016 100644 --- a/ClosedXML_Tests/Resource/Examples/Misc/LambdaExpressions.xlsx +++ b/ClosedXML_Tests/Resource/Examples/Misc/LambdaExpressions.xlsx Binary files differ diff --git a/ClosedXML_Tests/Resource/Examples/Misc/MergeCells.xlsx b/ClosedXML_Tests/Resource/Examples/Misc/MergeCells.xlsx index e5120d4..3860d72 100644 --- a/ClosedXML_Tests/Resource/Examples/Misc/MergeCells.xlsx +++ b/ClosedXML_Tests/Resource/Examples/Misc/MergeCells.xlsx Binary files differ diff --git a/ClosedXML_Tests/Resource/Examples/Misc/MergeMoves.xlsx b/ClosedXML_Tests/Resource/Examples/Misc/MergeMoves.xlsx index 2cbaac9..f0c9c03 100644 --- a/ClosedXML_Tests/Resource/Examples/Misc/MergeMoves.xlsx +++ b/ClosedXML_Tests/Resource/Examples/Misc/MergeMoves.xlsx Binary files differ diff --git a/ClosedXML_Tests/Resource/Examples/Misc/Outline.xlsx b/ClosedXML_Tests/Resource/Examples/Misc/Outline.xlsx index 4590850..5f01c13 100644 --- a/ClosedXML_Tests/Resource/Examples/Misc/Outline.xlsx +++ b/ClosedXML_Tests/Resource/Examples/Misc/Outline.xlsx Binary files differ diff --git a/ClosedXML_Tests/Resource/Examples/Misc/RightToLeft.xlsx b/ClosedXML_Tests/Resource/Examples/Misc/RightToLeft.xlsx index 235f17a..1017afd 100644 --- a/ClosedXML_Tests/Resource/Examples/Misc/RightToLeft.xlsx +++ b/ClosedXML_Tests/Resource/Examples/Misc/RightToLeft.xlsx Binary files differ diff --git a/ClosedXML_Tests/Resource/Examples/Misc/SheetProtection.xlsx b/ClosedXML_Tests/Resource/Examples/Misc/SheetProtection.xlsx index abeeb15..65936c4 100644 --- a/ClosedXML_Tests/Resource/Examples/Misc/SheetProtection.xlsx +++ b/ClosedXML_Tests/Resource/Examples/Misc/SheetProtection.xlsx Binary files differ diff --git a/ClosedXML_Tests/Resource/Examples/Misc/SheetViews.xlsx b/ClosedXML_Tests/Resource/Examples/Misc/SheetViews.xlsx index 9102f0a..4d275a2 100644 --- a/ClosedXML_Tests/Resource/Examples/Misc/SheetViews.xlsx +++ b/ClosedXML_Tests/Resource/Examples/Misc/SheetViews.xlsx Binary files differ diff --git a/ClosedXML_Tests/Resource/Examples/Misc/ShiftingFormulas.xlsx b/ClosedXML_Tests/Resource/Examples/Misc/ShiftingFormulas.xlsx index a1aa8d0..1a15711 100644 --- a/ClosedXML_Tests/Resource/Examples/Misc/ShiftingFormulas.xlsx +++ b/ClosedXML_Tests/Resource/Examples/Misc/ShiftingFormulas.xlsx Binary files differ diff --git a/ClosedXML_Tests/Resource/Examples/Misc/ShowCase.xlsx b/ClosedXML_Tests/Resource/Examples/Misc/ShowCase.xlsx index b02ab54..d988cd1 100644 --- a/ClosedXML_Tests/Resource/Examples/Misc/ShowCase.xlsx +++ b/ClosedXML_Tests/Resource/Examples/Misc/ShowCase.xlsx Binary files differ diff --git a/ClosedXML_Tests/Resource/Examples/Misc/TabColors.xlsx b/ClosedXML_Tests/Resource/Examples/Misc/TabColors.xlsx index 3b08f53..5c55455 100644 --- a/ClosedXML_Tests/Resource/Examples/Misc/TabColors.xlsx +++ b/ClosedXML_Tests/Resource/Examples/Misc/TabColors.xlsx Binary files differ diff --git a/ClosedXML_Tests/Resource/Examples/Misc/WorkbookProperties.xlsx b/ClosedXML_Tests/Resource/Examples/Misc/WorkbookProperties.xlsx index 7e28ec6..d9fba2c 100644 --- a/ClosedXML_Tests/Resource/Examples/Misc/WorkbookProperties.xlsx +++ b/ClosedXML_Tests/Resource/Examples/Misc/WorkbookProperties.xlsx Binary files differ diff --git a/ClosedXML_Tests/Resource/Examples/Misc/WorkbookProtection.xlsx b/ClosedXML_Tests/Resource/Examples/Misc/WorkbookProtection.xlsx index 2e7c839..12aad44 100644 --- a/ClosedXML_Tests/Resource/Examples/Misc/WorkbookProtection.xlsx +++ b/ClosedXML_Tests/Resource/Examples/Misc/WorkbookProtection.xlsx Binary files differ diff --git a/ClosedXML_Tests/Resource/Examples/PageSetup/HeaderFooters.xlsx b/ClosedXML_Tests/Resource/Examples/PageSetup/HeaderFooters.xlsx index 5464356..f0d7374 100644 --- a/ClosedXML_Tests/Resource/Examples/PageSetup/HeaderFooters.xlsx +++ b/ClosedXML_Tests/Resource/Examples/PageSetup/HeaderFooters.xlsx Binary files differ diff --git a/ClosedXML_Tests/Resource/Examples/PageSetup/Margins.xlsx b/ClosedXML_Tests/Resource/Examples/PageSetup/Margins.xlsx index 062d427..2f6805b 100644 --- a/ClosedXML_Tests/Resource/Examples/PageSetup/Margins.xlsx +++ b/ClosedXML_Tests/Resource/Examples/PageSetup/Margins.xlsx Binary files differ diff --git a/ClosedXML_Tests/Resource/Examples/PageSetup/Page.xlsx b/ClosedXML_Tests/Resource/Examples/PageSetup/Page.xlsx index 13debb0..c55e060 100644 --- a/ClosedXML_Tests/Resource/Examples/PageSetup/Page.xlsx +++ b/ClosedXML_Tests/Resource/Examples/PageSetup/Page.xlsx Binary files differ diff --git a/ClosedXML_Tests/Resource/Examples/PageSetup/SheetTab.xlsx b/ClosedXML_Tests/Resource/Examples/PageSetup/SheetTab.xlsx index e03a6b5..30bfbcc 100644 --- a/ClosedXML_Tests/Resource/Examples/PageSetup/SheetTab.xlsx +++ b/ClosedXML_Tests/Resource/Examples/PageSetup/SheetTab.xlsx Binary files differ diff --git a/ClosedXML_Tests/Resource/Examples/PageSetup/Sheets.xlsx b/ClosedXML_Tests/Resource/Examples/PageSetup/Sheets.xlsx index fd83a80..f91eecc 100644 --- a/ClosedXML_Tests/Resource/Examples/PageSetup/Sheets.xlsx +++ b/ClosedXML_Tests/Resource/Examples/PageSetup/Sheets.xlsx Binary files differ diff --git a/ClosedXML_Tests/Resource/Examples/PageSetup/TwoPages.xlsx b/ClosedXML_Tests/Resource/Examples/PageSetup/TwoPages.xlsx index 03fb5e2..6096e00 100644 --- a/ClosedXML_Tests/Resource/Examples/PageSetup/TwoPages.xlsx +++ b/ClosedXML_Tests/Resource/Examples/PageSetup/TwoPages.xlsx Binary files differ diff --git a/ClosedXML_Tests/Resource/Examples/PivotTables/PivotTables.xlsx b/ClosedXML_Tests/Resource/Examples/PivotTables/PivotTables.xlsx index 61f9aee..d6f65c7 100644 --- a/ClosedXML_Tests/Resource/Examples/PivotTables/PivotTables.xlsx +++ b/ClosedXML_Tests/Resource/Examples/PivotTables/PivotTables.xlsx Binary files differ diff --git a/ClosedXML_Tests/Resource/Examples/Ranges/AddingRowToTables.xlsx b/ClosedXML_Tests/Resource/Examples/Ranges/AddingRowToTables.xlsx index 95291f8..014ea30 100644 --- a/ClosedXML_Tests/Resource/Examples/Ranges/AddingRowToTables.xlsx +++ b/ClosedXML_Tests/Resource/Examples/Ranges/AddingRowToTables.xlsx Binary files differ diff --git a/ClosedXML_Tests/Resource/Examples/Ranges/ClearingRanges.xlsx b/ClosedXML_Tests/Resource/Examples/Ranges/ClearingRanges.xlsx index 5e18500..95daf5a 100644 --- a/ClosedXML_Tests/Resource/Examples/Ranges/ClearingRanges.xlsx +++ b/ClosedXML_Tests/Resource/Examples/Ranges/ClearingRanges.xlsx Binary files differ diff --git a/ClosedXML_Tests/Resource/Examples/Ranges/CopyingRanges.xlsx b/ClosedXML_Tests/Resource/Examples/Ranges/CopyingRanges.xlsx index 064601a..faa24e2 100644 --- a/ClosedXML_Tests/Resource/Examples/Ranges/CopyingRanges.xlsx +++ b/ClosedXML_Tests/Resource/Examples/Ranges/CopyingRanges.xlsx Binary files differ diff --git a/ClosedXML_Tests/Resource/Examples/Ranges/CurrentRowColumn.xlsx b/ClosedXML_Tests/Resource/Examples/Ranges/CurrentRowColumn.xlsx index 6148e44..741e75f 100644 --- a/ClosedXML_Tests/Resource/Examples/Ranges/CurrentRowColumn.xlsx +++ b/ClosedXML_Tests/Resource/Examples/Ranges/CurrentRowColumn.xlsx Binary files differ diff --git a/ClosedXML_Tests/Resource/Examples/Ranges/DefiningRanges.xlsx b/ClosedXML_Tests/Resource/Examples/Ranges/DefiningRanges.xlsx index 8e79c44..31c5290 100644 --- a/ClosedXML_Tests/Resource/Examples/Ranges/DefiningRanges.xlsx +++ b/ClosedXML_Tests/Resource/Examples/Ranges/DefiningRanges.xlsx Binary files differ diff --git a/ClosedXML_Tests/Resource/Examples/Ranges/DeletingRanges.xlsx b/ClosedXML_Tests/Resource/Examples/Ranges/DeletingRanges.xlsx index 1fbbe5a..ed8b923 100644 --- a/ClosedXML_Tests/Resource/Examples/Ranges/DeletingRanges.xlsx +++ b/ClosedXML_Tests/Resource/Examples/Ranges/DeletingRanges.xlsx Binary files differ diff --git a/ClosedXML_Tests/Resource/Examples/Ranges/InsertingDeletingColumns.xlsx b/ClosedXML_Tests/Resource/Examples/Ranges/InsertingDeletingColumns.xlsx index dabfb5f..0b17544 100644 --- a/ClosedXML_Tests/Resource/Examples/Ranges/InsertingDeletingColumns.xlsx +++ b/ClosedXML_Tests/Resource/Examples/Ranges/InsertingDeletingColumns.xlsx Binary files differ diff --git a/ClosedXML_Tests/Resource/Examples/Ranges/InsertingDeletingRows.xlsx b/ClosedXML_Tests/Resource/Examples/Ranges/InsertingDeletingRows.xlsx index 9588f7d..bfafa65 100644 --- a/ClosedXML_Tests/Resource/Examples/Ranges/InsertingDeletingRows.xlsx +++ b/ClosedXML_Tests/Resource/Examples/Ranges/InsertingDeletingRows.xlsx Binary files differ diff --git a/ClosedXML_Tests/Resource/Examples/Ranges/MultipleRanges.xlsx b/ClosedXML_Tests/Resource/Examples/Ranges/MultipleRanges.xlsx index e3717c5..b0621bc 100644 --- a/ClosedXML_Tests/Resource/Examples/Ranges/MultipleRanges.xlsx +++ b/ClosedXML_Tests/Resource/Examples/Ranges/MultipleRanges.xlsx Binary files differ diff --git a/ClosedXML_Tests/Resource/Examples/Ranges/NamedRanges.xlsx b/ClosedXML_Tests/Resource/Examples/Ranges/NamedRanges.xlsx index 2b450d6..a4a86da 100644 --- a/ClosedXML_Tests/Resource/Examples/Ranges/NamedRanges.xlsx +++ b/ClosedXML_Tests/Resource/Examples/Ranges/NamedRanges.xlsx Binary files differ diff --git a/ClosedXML_Tests/Resource/Examples/Ranges/SelectingRanges.xlsx b/ClosedXML_Tests/Resource/Examples/Ranges/SelectingRanges.xlsx index adecfee..b4e6aeb 100644 --- a/ClosedXML_Tests/Resource/Examples/Ranges/SelectingRanges.xlsx +++ b/ClosedXML_Tests/Resource/Examples/Ranges/SelectingRanges.xlsx Binary files differ diff --git a/ClosedXML_Tests/Resource/Examples/Ranges/ShiftingRanges.xlsx b/ClosedXML_Tests/Resource/Examples/Ranges/ShiftingRanges.xlsx index 453328f..1c6a1ed 100644 --- a/ClosedXML_Tests/Resource/Examples/Ranges/ShiftingRanges.xlsx +++ b/ClosedXML_Tests/Resource/Examples/Ranges/ShiftingRanges.xlsx Binary files differ diff --git a/ClosedXML_Tests/Resource/Examples/Ranges/SortExample.xlsx b/ClosedXML_Tests/Resource/Examples/Ranges/SortExample.xlsx index bd2c3d6..e426613 100644 --- a/ClosedXML_Tests/Resource/Examples/Ranges/SortExample.xlsx +++ b/ClosedXML_Tests/Resource/Examples/Ranges/SortExample.xlsx Binary files differ diff --git a/ClosedXML_Tests/Resource/Examples/Ranges/Sorting.xlsx b/ClosedXML_Tests/Resource/Examples/Ranges/Sorting.xlsx index 08344e9..36b889d 100644 --- a/ClosedXML_Tests/Resource/Examples/Ranges/Sorting.xlsx +++ b/ClosedXML_Tests/Resource/Examples/Ranges/Sorting.xlsx Binary files differ diff --git a/ClosedXML_Tests/Resource/Examples/Ranges/TransposeRanges.xlsx b/ClosedXML_Tests/Resource/Examples/Ranges/TransposeRanges.xlsx index 4d136e2..c7f029d 100644 --- a/ClosedXML_Tests/Resource/Examples/Ranges/TransposeRanges.xlsx +++ b/ClosedXML_Tests/Resource/Examples/Ranges/TransposeRanges.xlsx Binary files differ diff --git a/ClosedXML_Tests/Resource/Examples/Ranges/TransposeRangesPlus.xlsx b/ClosedXML_Tests/Resource/Examples/Ranges/TransposeRangesPlus.xlsx index 037fc86..0303805 100644 --- a/ClosedXML_Tests/Resource/Examples/Ranges/TransposeRangesPlus.xlsx +++ b/ClosedXML_Tests/Resource/Examples/Ranges/TransposeRangesPlus.xlsx Binary files differ diff --git a/ClosedXML_Tests/Resource/Examples/Ranges/WalkingRanges.xlsx b/ClosedXML_Tests/Resource/Examples/Ranges/WalkingRanges.xlsx index e12dfc5..ee46beb 100644 --- a/ClosedXML_Tests/Resource/Examples/Ranges/WalkingRanges.xlsx +++ b/ClosedXML_Tests/Resource/Examples/Ranges/WalkingRanges.xlsx Binary files differ diff --git a/ClosedXML_Tests/Resource/Examples/Rows/RowCells.xlsx b/ClosedXML_Tests/Resource/Examples/Rows/RowCells.xlsx index 2f0be53..f7a57c8 100644 --- a/ClosedXML_Tests/Resource/Examples/Rows/RowCells.xlsx +++ b/ClosedXML_Tests/Resource/Examples/Rows/RowCells.xlsx Binary files differ diff --git a/ClosedXML_Tests/Resource/Examples/Rows/RowCollection.xlsx b/ClosedXML_Tests/Resource/Examples/Rows/RowCollection.xlsx index 5c98025..8855354 100644 --- a/ClosedXML_Tests/Resource/Examples/Rows/RowCollection.xlsx +++ b/ClosedXML_Tests/Resource/Examples/Rows/RowCollection.xlsx Binary files differ diff --git a/ClosedXML_Tests/Resource/Examples/Rows/RowSettings.xlsx b/ClosedXML_Tests/Resource/Examples/Rows/RowSettings.xlsx index 69a0c15..457bb99 100644 --- a/ClosedXML_Tests/Resource/Examples/Rows/RowSettings.xlsx +++ b/ClosedXML_Tests/Resource/Examples/Rows/RowSettings.xlsx Binary files differ diff --git a/ClosedXML_Tests/Resource/Examples/Styles/DefaultStyles.xlsx b/ClosedXML_Tests/Resource/Examples/Styles/DefaultStyles.xlsx index 86e20d3..9e9a109 100644 --- a/ClosedXML_Tests/Resource/Examples/Styles/DefaultStyles.xlsx +++ b/ClosedXML_Tests/Resource/Examples/Styles/DefaultStyles.xlsx Binary files differ diff --git a/ClosedXML_Tests/Resource/Examples/Styles/PurpleWorksheet.xlsx b/ClosedXML_Tests/Resource/Examples/Styles/PurpleWorksheet.xlsx index 4422537..ea00b0c 100644 --- a/ClosedXML_Tests/Resource/Examples/Styles/PurpleWorksheet.xlsx +++ b/ClosedXML_Tests/Resource/Examples/Styles/PurpleWorksheet.xlsx Binary files differ diff --git a/ClosedXML_Tests/Resource/Examples/Styles/StyleAlignment.xlsx b/ClosedXML_Tests/Resource/Examples/Styles/StyleAlignment.xlsx index abe42a8..b2670c0 100644 --- a/ClosedXML_Tests/Resource/Examples/Styles/StyleAlignment.xlsx +++ b/ClosedXML_Tests/Resource/Examples/Styles/StyleAlignment.xlsx Binary files differ diff --git a/ClosedXML_Tests/Resource/Examples/Styles/StyleBorder.xlsx b/ClosedXML_Tests/Resource/Examples/Styles/StyleBorder.xlsx index 2af3891..4d52bd6 100644 --- a/ClosedXML_Tests/Resource/Examples/Styles/StyleBorder.xlsx +++ b/ClosedXML_Tests/Resource/Examples/Styles/StyleBorder.xlsx Binary files differ diff --git a/ClosedXML_Tests/Resource/Examples/Styles/StyleFill.xlsx b/ClosedXML_Tests/Resource/Examples/Styles/StyleFill.xlsx index 389f0f6..9e19202 100644 --- a/ClosedXML_Tests/Resource/Examples/Styles/StyleFill.xlsx +++ b/ClosedXML_Tests/Resource/Examples/Styles/StyleFill.xlsx Binary files differ diff --git a/ClosedXML_Tests/Resource/Examples/Styles/StyleFont.xlsx b/ClosedXML_Tests/Resource/Examples/Styles/StyleFont.xlsx index a9c9728..af7d4b4 100644 --- a/ClosedXML_Tests/Resource/Examples/Styles/StyleFont.xlsx +++ b/ClosedXML_Tests/Resource/Examples/Styles/StyleFont.xlsx Binary files differ diff --git a/ClosedXML_Tests/Resource/Examples/Styles/StyleNumberFormat.xlsx b/ClosedXML_Tests/Resource/Examples/Styles/StyleNumberFormat.xlsx index 5a5ee64..23184a3 100644 --- a/ClosedXML_Tests/Resource/Examples/Styles/StyleNumberFormat.xlsx +++ b/ClosedXML_Tests/Resource/Examples/Styles/StyleNumberFormat.xlsx Binary files differ diff --git a/ClosedXML_Tests/Resource/Examples/Styles/StyleRowsColumns.xlsx b/ClosedXML_Tests/Resource/Examples/Styles/StyleRowsColumns.xlsx index 472f826..f10a5f6 100644 --- a/ClosedXML_Tests/Resource/Examples/Styles/StyleRowsColumns.xlsx +++ b/ClosedXML_Tests/Resource/Examples/Styles/StyleRowsColumns.xlsx Binary files differ diff --git a/ClosedXML_Tests/Resource/Examples/Styles/StyleWorksheet.xlsx b/ClosedXML_Tests/Resource/Examples/Styles/StyleWorksheet.xlsx index 407d189..2201621 100644 --- a/ClosedXML_Tests/Resource/Examples/Styles/StyleWorksheet.xlsx +++ b/ClosedXML_Tests/Resource/Examples/Styles/StyleWorksheet.xlsx Binary files differ diff --git a/ClosedXML_Tests/Resource/Examples/Styles/UsingColors.xlsx b/ClosedXML_Tests/Resource/Examples/Styles/UsingColors.xlsx index f7421af..2ada7d9 100644 --- a/ClosedXML_Tests/Resource/Examples/Styles/UsingColors.xlsx +++ b/ClosedXML_Tests/Resource/Examples/Styles/UsingColors.xlsx Binary files differ diff --git a/ClosedXML_Tests/Resource/Examples/Styles/UsingPhonetics.xlsx b/ClosedXML_Tests/Resource/Examples/Styles/UsingPhonetics.xlsx index 86fe3e6..b334a6d 100644 --- a/ClosedXML_Tests/Resource/Examples/Styles/UsingPhonetics.xlsx +++ b/ClosedXML_Tests/Resource/Examples/Styles/UsingPhonetics.xlsx Binary files differ diff --git a/ClosedXML_Tests/Resource/Examples/Styles/UsingRichText.xlsx b/ClosedXML_Tests/Resource/Examples/Styles/UsingRichText.xlsx index 90ef8fc..b83ccde 100644 --- a/ClosedXML_Tests/Resource/Examples/Styles/UsingRichText.xlsx +++ b/ClosedXML_Tests/Resource/Examples/Styles/UsingRichText.xlsx Binary files differ diff --git a/ClosedXML_Tests/Resource/Examples/Tables/InsertingTables.xlsx b/ClosedXML_Tests/Resource/Examples/Tables/InsertingTables.xlsx index 89de679..05cfa2c 100644 --- a/ClosedXML_Tests/Resource/Examples/Tables/InsertingTables.xlsx +++ b/ClosedXML_Tests/Resource/Examples/Tables/InsertingTables.xlsx Binary files differ diff --git a/ClosedXML_Tests/Resource/Examples/Tables/ResizingTables.xlsx b/ClosedXML_Tests/Resource/Examples/Tables/ResizingTables.xlsx index dad3954..5d223ac 100644 --- a/ClosedXML_Tests/Resource/Examples/Tables/ResizingTables.xlsx +++ b/ClosedXML_Tests/Resource/Examples/Tables/ResizingTables.xlsx Binary files differ diff --git a/ClosedXML_Tests/Resource/Examples/Tables/UsingTables.xlsx b/ClosedXML_Tests/Resource/Examples/Tables/UsingTables.xlsx index 288d1fe..39402fe 100644 --- a/ClosedXML_Tests/Resource/Examples/Tables/UsingTables.xlsx +++ b/ClosedXML_Tests/Resource/Examples/Tables/UsingTables.xlsx Binary files differ