This commit is contained in:
@@ -18,6 +18,30 @@ public readonly struct CellAlign : IEquatable<CellAlign>
|
||||
/// <summary>Уменьшать размер шрифта, чтобы текст поместился в ячейку.</summary>
|
||||
public bool? ShrinkToFit { get; init; }
|
||||
|
||||
|
||||
internal bool TryMerge(CellAlign other, out CellAlign result)
|
||||
{
|
||||
// Если other не содержит новых значений, возвращаем this
|
||||
if (other.Horizontal == Horizontal &&
|
||||
other.Vertical == Vertical &&
|
||||
other.WrapText == WrapText &&
|
||||
other.ShrinkToFit == ShrinkToFit)
|
||||
{
|
||||
result = default;
|
||||
return false;
|
||||
}
|
||||
|
||||
result = new CellAlign
|
||||
{
|
||||
Horizontal = other.Horizontal ?? Horizontal,
|
||||
Vertical = other.Vertical ?? Vertical,
|
||||
WrapText = other.WrapText ?? WrapText,
|
||||
ShrinkToFit = other.ShrinkToFit ?? ShrinkToFit
|
||||
};
|
||||
return true;
|
||||
}
|
||||
|
||||
|
||||
/// <summary>Преобразует горизонтальное выравнивание в тип Open XML.</summary>
|
||||
public bool TryGetExcelHorizontalAlignment(out HorizontalAlignmentValues value)
|
||||
{
|
||||
@@ -104,7 +128,7 @@ public readonly struct CellAlign : IEquatable<CellAlign>
|
||||
return result;
|
||||
}
|
||||
|
||||
private static CellAlignHorizontal MapHorizontalFromExcel(HorizontalAlignmentValues value)
|
||||
static CellAlignHorizontal MapHorizontalFromExcel(HorizontalAlignmentValues value)
|
||||
{
|
||||
if (value == HorizontalAlignmentValues.Left)
|
||||
{
|
||||
@@ -137,7 +161,7 @@ public readonly struct CellAlign : IEquatable<CellAlign>
|
||||
else throw new NotSupportedException($"Unsupported horizontal alignment: {value}");
|
||||
}
|
||||
|
||||
private static CellAlignVertical MapVerticalFromExcel(VerticalAlignmentValues value)
|
||||
static CellAlignVertical MapVerticalFromExcel(VerticalAlignmentValues value)
|
||||
{
|
||||
if (value == VerticalAlignmentValues.Top)
|
||||
{
|
||||
|
||||
Reference in New Issue
Block a user