diff --git a/ClosedXML/ClosedXML/ClosedXML/Excel/Rows/IXLRow.cs b/ClosedXML/ClosedXML/ClosedXML/Excel/Rows/IXLRow.cs index ae77455..e77686d 100644 --- a/ClosedXML/ClosedXML/ClosedXML/Excel/Rows/IXLRow.cs +++ b/ClosedXML/ClosedXML/ClosedXML/Excel/Rows/IXLRow.cs @@ -38,6 +38,8 @@ /// The number of rows to insert. IXLRows InsertRowsAbove(Int32 numberOfRows); + IXLRow AdjustToContents(); + /// /// Adjusts the height of the row based on its contents, starting from the startColumn. /// diff --git a/ClosedXML/ClosedXML/ClosedXML/Excel/Rows/XLRow.cs b/ClosedXML/ClosedXML/ClosedXML/Excel/Rows/XLRow.cs index 5ff43df..262a42c 100644 --- a/ClosedXML/ClosedXML/ClosedXML/Excel/Rows/XLRow.cs +++ b/ClosedXML/ClosedXML/ClosedXML/Excel/Rows/XLRow.cs @@ -289,7 +289,7 @@ Double maxLongCol = kpList.Max(kp => kp.Value.Length); Double maxHeightCol = kpList.Max(kp => kp.Key.GetHeight()); - Int32 lineCount = kpList.Count(kp => kp.Value.Contains(Environment.NewLine)); + Int32 lineCount = kpList.Count(kp => kp.Value.Contains(Environment.NewLine)) + 1; if (textRotation == 0) thisHeight = maxHeightCol * lineCount; else