Great library but one trouble here - if you like to copy and modify rows often you touch row's height property . Then library sets height as CustomHeight.
So it seems the most simple way looks like to set CustomHeight off
I suppose to to set height as automatically with special function like int other openexcel libraries
SetAutoHeight()
Name actually does not matter
Could you consider ability to add Function to reset Height of Row to allow Excel automatically set it?
Here code working for me:
IXLRows.cs
namespace ClosedXML.Excel
{
public interface IXLRows: IEnumerable<IXLRow>, IDisposable
{
...
/// <summary>
/// Set the height of all rows as auto. Excel should set height automatically then.
/// </summary>
IXLRows SetAutoHeight();
...
XLRows.cs
namespace ClosedXML.Excel
{
using System.Collections;
internal class XLRows : IXLRows, IXLStylized
{
...
public IXLRows SetAutoHeight()
{
_rows.ForEach(r => r.SetAutoHeight());
return this;
}
...
XLRow.cs
namespace ClosedXML.Excel
{
internal class XLRow : XLRangeBase, IXLRow
{
...
internal object SetAutoHeight()
{
int row = RowNumber();
var thisRow = Worksheet.Internals.RowsCollection[row];
//Ensure for now that row height will be auto
thisRow.HeightChanged = false;
HeightChanged = false;
return this;
}
}
}
So it seems the most simple way looks like to set CustomHeight off
I suppose to to set height as automatically with special function like int other openexcel libraries
SetAutoHeight()
Name actually does not matter
Could you consider ability to add Function to reset Height of Row to allow Excel automatically set it?
Here code working for me:
IXLRows.cs
namespace ClosedXML.Excel
{
public interface IXLRows: IEnumerable<IXLRow>, IDisposable
{
...
/// <summary>
/// Set the height of all rows as auto. Excel should set height automatically then.
/// </summary>
IXLRows SetAutoHeight();
...
XLRows.cs
namespace ClosedXML.Excel
{
using System.Collections;
internal class XLRows : IXLRows, IXLStylized
{
...
public IXLRows SetAutoHeight()
{
_rows.ForEach(r => r.SetAutoHeight());
return this;
}
...
XLRow.cs
namespace ClosedXML.Excel
{
internal class XLRow : XLRangeBase, IXLRow
{
...
internal object SetAutoHeight()
{
int row = RowNumber();
var thisRow = Worksheet.Internals.RowsCollection[row];
//Ensure for now that row height will be auto
thisRow.HeightChanged = false;
HeightChanged = false;
return this;
}
}
}