[RT]
This commit is contained in:
@@ -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,
|
||||
}
|
||||
@@ -54,6 +54,10 @@ public interface IRow
|
||||
/// <returns>Тот же экземпляр <see cref="IRow"/> для цепочки вызовов.</returns>
|
||||
IRow Cell(CellProps cellProps);
|
||||
|
||||
/// <summary>Добавляет ячейку (без текста).</summary>
|
||||
/// <returns>Тот же экземпляр <see cref="IRow"/> для цепочки вызовов.</returns>
|
||||
IRow Cell();
|
||||
|
||||
/// <summary>Добавляет ячейку с заданными свойствами и текстом (используется базовый шрифт).</summary>
|
||||
/// <param name="cellProps">Свойства ячейки.</param>
|
||||
/// <param name="text">Текст ячейки.</param>
|
||||
|
||||
@@ -237,6 +237,14 @@ internal sealed class TableBuilder : ParagraphBuilderBase, ITable, IRow, ICell
|
||||
return this;
|
||||
}
|
||||
|
||||
public IRow Cell()
|
||||
{
|
||||
var cellBuilder = CellBuilder;
|
||||
cellBuilder.Paragraph(p => p.Run(""));
|
||||
_row.AppendChild(cellBuilder.Build());
|
||||
return this;
|
||||
}
|
||||
|
||||
// Метод для установки произвольных свойств строки
|
||||
public IRow SetProperties(Action<TableRowProperties> configure)
|
||||
{
|
||||
|
||||
Reference in New Issue
Block a user