This commit is contained in:
melekhin
2026-09-24 14:09:37 +07:00
parent ebec7f724c
commit fab3528e57
7 changed files with 357 additions and 280 deletions
@@ -5,6 +5,7 @@ public readonly struct CellProps(double? width = null!)
public double? Width { get; init; } = width;
public TableVerticalAlignmentValues? VerticalAlignment { get; init; } = default;
public MergedCell? Merge { get; init; } = default;
public TextDirection TextDirection { get; init; } = TextDirection.LeftToRight;
#pragma warning disable IDE1006 // Стили именования
@@ -40,6 +41,19 @@ public readonly struct CellProps(double? width = null!)
Width = ((uint)(Width.Value * 567d)).ToString() // 1 см = 567 DXA
});
if (TextDirection is not TextDirection.LeftToRight)
{
list.Add(new DocumentFormat.OpenXml.Wordprocessing.TextDirection
{
Val = TextDirection switch
{
TextDirection.BottomToTop => TextDirectionValues.BottomToTopLeftToRight,
TextDirection.TopToBottom => TextDirectionValues.TopToBottomRightToLeft,
_ => throw new ArgumentOutOfRangeException(nameof(TextDirection), TextDirection, "Unsupported text direction"),
}
});
}
if (Merge.HasValue)
{
switch (Merge.Value)
@@ -86,4 +100,14 @@ public enum MergedCell
_VH_,
V__H,
}
public enum TextDirection
{
/// <summary> ⇒ ⇒ ⇒ Стандартный свева направо </summary>
LeftToRight,
/// <summary> ⇑ ⇑ ⇑ Снизу вверх </summary>
BottomToTop,
/// <summary> ⇓ ⇓ ⇓ Сверху вниз </summary>
TopToBottom,
}