diff --git a/ClosedXML/Excel/Cells/XLCell.cs b/ClosedXML/Excel/Cells/XLCell.cs index c3313e0..45bddd5 100644 --- a/ClosedXML/Excel/Cells/XLCell.cs +++ b/ClosedXML/Excel/Cells/XLCell.cs @@ -356,7 +356,7 @@ return cValue; } else - return cValue; + return cValue; } /// @@ -1579,7 +1579,6 @@ get { yield break; } } - public override IXLRanges RangesUsed { get @@ -1694,6 +1693,7 @@ } #region Styles + private XLStyleValue GetStyleForRead() { return StyleValue; diff --git a/ClosedXML/Excel/Columns/XLColumn.cs b/ClosedXML/Excel/Columns/XLColumn.cs index b720034..607f181 100644 --- a/ClosedXML/Excel/Columns/XLColumn.cs +++ b/ClosedXML/Excel/Columns/XLColumn.cs @@ -25,7 +25,7 @@ new XLAddress(xlColumnParameters.Worksheet, XLHelper.MaxRowNumber, column, false, false)), xlColumnParameters.IsReference ? xlColumnParameters.Worksheet.Internals.ColumnsCollection[column].StyleValue - : xlColumnParameters.DefaultStyle?.Value) + : xlColumnParameters.DefaultStyle.Value) { SetColumnNumber(column); diff --git a/ClosedXML/Excel/Rows/XLRow.cs b/ClosedXML/Excel/Rows/XLRow.cs index 190e265..9e263b7 100644 --- a/ClosedXML/Excel/Rows/XLRow.cs +++ b/ClosedXML/Excel/Rows/XLRow.cs @@ -23,7 +23,7 @@ new XLAddress(xlRowParameters.Worksheet, row, XLHelper.MaxColumnNumber, false, false)), xlRowParameters.IsReference ? xlRowParameters.Worksheet.Internals.RowsCollection[row].StyleValue - : xlRowParameters.DefaultStyle?.Value + : xlRowParameters.DefaultStyle.Value ) { SetRowNumber(row); diff --git a/ClosedXML/Excel/XLWorkbook_Save.cs b/ClosedXML/Excel/XLWorkbook_Save.cs index 7c89863..fa3e568 100644 --- a/ClosedXML/Excel/XLWorkbook_Save.cs +++ b/ClosedXML/Excel/XLWorkbook_Save.cs @@ -2137,8 +2137,8 @@ ptfi.DataType = XLDataType.DateTime; ptfi.MixedDataType = false; ptfi.DistinctValues = fieldValueCells - .Select(cell => cell.GetDateTime()) - .Distinct() + .Select(cell => cell.GetDateTime()) + .Distinct() .Cast() .ToArray(); @@ -2969,35 +2969,35 @@ { case Drawings.XLPicturePlacement.FreeFloating: var absoluteAnchor = new Xdr.AbsoluteAnchor( - new Xdr.Position - { - X = ConvertToEnglishMetricUnits(pic.Left, GraphicsUtils.Graphics.DpiX), - Y = ConvertToEnglishMetricUnits(pic.Top, GraphicsUtils.Graphics.DpiY) - }, - new Xdr.Extent - { - Cx = extentsCx, - Cy = extentsCy - }, - new Xdr.Picture( - new Xdr.NonVisualPictureProperties( - new Xdr.NonVisualDrawingProperties { Id = nvpId, Name = pic.Name }, - new Xdr.NonVisualPictureDrawingProperties(new PictureLocks { NoChangeAspect = true }) - ), - new Xdr.BlipFill( - new Blip { Embed = drawingsPart.GetIdOfPart(imagePart), CompressionState = BlipCompressionValues.Print }, - new Stretch(new FillRectangle()) - ), - new Xdr.ShapeProperties( - new Transform2D( - new Offset { X = 0, Y = 0 }, - new Extents { Cx = extentsCx, Cy = extentsCy } + new Xdr.Position + { + X = ConvertToEnglishMetricUnits(pic.Left, GraphicsUtils.Graphics.DpiX), + Y = ConvertToEnglishMetricUnits(pic.Top, GraphicsUtils.Graphics.DpiY) + }, + new Xdr.Extent + { + Cx = extentsCx, + Cy = extentsCy + }, + new Xdr.Picture( + new Xdr.NonVisualPictureProperties( + new Xdr.NonVisualDrawingProperties { Id = nvpId, Name = pic.Name }, + new Xdr.NonVisualPictureDrawingProperties(new PictureLocks { NoChangeAspect = true }) ), - new PresetGeometry { Preset = ShapeTypeValues.Rectangle } - ) - ), - new Xdr.ClientData() - ); + new Xdr.BlipFill( + new Blip { Embed = drawingsPart.GetIdOfPart(imagePart), CompressionState = BlipCompressionValues.Print }, + new Stretch(new FillRectangle()) + ), + new Xdr.ShapeProperties( + new Transform2D( + new Offset { X = 0, Y = 0 }, + new Extents { Cx = extentsCx, Cy = extentsCy } + ), + new PresetGeometry { Preset = ShapeTypeValues.Rectangle } + ) + ), + new Xdr.ClientData() + ); worksheetDrawing.Append(absoluteAnchor); break; @@ -3280,13 +3280,12 @@ pivotTableNumberFormats.Add(ptnf); } - var alignments = xlStyles.Select(s => s.Alignment).Distinct().ToList(); - var borders = xlStyles.Select(s => s.Border).Distinct().ToList(); - var fonts = xlStyles.Select(s => s.Font).Distinct().ToList(); - var fills = xlStyles.Select(s => s.Fill).Distinct().ToList(); + var alignments = xlStyles.Select(s => s.Alignment).Distinct().ToList(); + var borders = xlStyles.Select(s => s.Border).Distinct().ToList(); + var fonts = xlStyles.Select(s => s.Font).Distinct().ToList(); + var fills = xlStyles.Select(s => s.Fill).Distinct().ToList(); var numberFormats = xlStyles.Select(s => s.NumberFormat).Distinct().ToList(); - var protections = xlStyles.Select(s => s.Protection).Distinct().ToList(); - + var protections = xlStyles.Select(s => s.Protection).Distinct().ToList(); for (int i = 0; i < fonts.Count; i++) { @@ -3645,7 +3644,7 @@ && f.FillId != null && styleInfo.FillId == f.FillId && f.FontId != null && styleInfo.FontId == f.FontId && f.NumberFormatId != null && styleInfo.NumberFormatId == f.NumberFormatId - && (f.ApplyFill == null && styleInfo.Style.Fill == XLFillValue.Default || + && (f.ApplyFill == null && styleInfo.Style.Fill == XLFillValue.Default || f.ApplyFill != null && f.ApplyFill == ApplyFill(styleInfo)) && (f.ApplyBorder == null && styleInfo.Style.Border == XLBorderValue.Default || f.ApplyBorder != null && f.ApplyBorder == ApplyBorder(styleInfo)) @@ -3790,10 +3789,10 @@ var DiagonalBorder = new DiagonalBorder { Style = borderInfo.Border.DiagonalBorder.ToOpenXml() }; if (borderInfo.Border.DiagonalBorderColor != XLBorderValue.Default.DiagonalBorderColor || ignoreMod) if (borderInfo.Border.DiagonalBorderColor != null) - { - var DiagonalBorderColor = GetNewColor(borderInfo.Border.DiagonalBorderColor); - DiagonalBorder.AppendChild(DiagonalBorderColor); - } + { + var DiagonalBorderColor = GetNewColor(borderInfo.Border.DiagonalBorderColor); + DiagonalBorder.AppendChild(DiagonalBorderColor); + } border.AppendChild(DiagonalBorder); } @@ -4445,13 +4444,14 @@ var seqRef = new List { selection.ActiveCell.Value }; seqRef.AddRange(xlWorksheet.SelectedRanges - .Select(range => - { - if (range.RangeAddress.FirstAddress.Equals(range.RangeAddress.LastAddress)) - return range.RangeAddress.FirstAddress.ToStringRelative(false); - else - return range.RangeAddress.ToStringRelative(false); - })); + .Select(range => + { + if (range.RangeAddress.FirstAddress.Equals(range.RangeAddress.LastAddress)) + return range.RangeAddress.FirstAddress.ToStringRelative(false); + else + return range.RangeAddress.ToStringRelative(false); + }) + ); selection.SequenceOfReferences = new ListValue { InnerText = String.Join(" ", seqRef.Distinct().ToArray()) }; diff --git a/ClosedXML/XLHelper.cs b/ClosedXML/XLHelper.cs index 0796264..5bb1bd5 100644 --- a/ClosedXML/XLHelper.cs +++ b/ClosedXML/XLHelper.cs @@ -85,9 +85,9 @@ private static readonly string[] letters = new[] { "A", "B", "C", "D", "E", "F", "G", "H", "I", "J", "K", "L", "M", "N", "O", "P", "Q", "R", "S", "T", "U", "V", "W", "X", "Y", "Z" }; /// - /// Gets the column letter of a given column number. + /// Gets the column letter of a given column number. /// - /// The column number to translate into a column letter. + /// The column number to translate into a column letter. /// if set to true the column letter will be restricted to the allowed range. /// public static string GetColumnLetterFromNumber(int columnNumber, bool trimToAllowed = false) diff --git a/ClosedXML_Examples/Creating/CreateFiles.cs b/ClosedXML_Examples/Creating/CreateFiles.cs index c61315c..8f1978f 100644 --- a/ClosedXML_Examples/Creating/CreateFiles.cs +++ b/ClosedXML_Examples/Creating/CreateFiles.cs @@ -88,7 +88,7 @@ new ShiftingFormulas().Create(Path.Combine(path, "ShiftingFormulas.xlsx")); new CopyingRowsAndColumns().Create(Path.Combine(path, "CopyingRowsAndColumns.xlsx")); new UsingRichText().Create(Path.Combine(path, "UsingRichText.xlsx")); - //new UsingPhonetics().Create(Path.Combine(path, "UsingPhonetics.xlsx")); + new UsingPhonetics().Create(Path.Combine(path, "UsingPhonetics.xlsx")); new WalkingRanges().Create(Path.Combine(path, "CellMoves.xlsx")); new AddingComments().Create(Path.Combine(path, "AddingComments.xlsx")); new PivotTables().Create(Path.Combine(path, "PivotTables.xlsx"));