table builder debugs

This commit is contained in:
melekhin
2026-09-03 16:28:05 +07:00
parent da68c0754b
commit f786f60d1b
@@ -6,6 +6,32 @@ internal sealed class TableBuilder : ParagraphBuilderBase, ITable, IRow, ICell
internal TableBuilder(FontProps? baseFont) : base(baseFont) internal TableBuilder(FontProps? baseFont) : base(baseFont)
{ {
// Получаем или создаем свойства таблицы
var tblProps = _table.GetFirstChild<TableProperties>();
if (tblProps == null)
{
tblProps = new TableProperties();
_table.PrependChild(tblProps);
}
// --- ОТКЛЮЧАЕМ АВТОПОДБОР ---
// Устанавливаем фиксированный макет таблицы.
// Именно это свойство соответствует отключению "Автоподбор по содержимому".
tblProps.TableLayout = new()
{
Type = TableLayoutValues.Fixed // <-- Ключевое изменение
};
tblProps.TableCellMarginDefault = new([new LeftMargin()
{
Type = TableWidthUnitValues.Dxa,
Width = "0"
},
new RightMargin()
{
Type = TableWidthUnitValues.Dxa,
Width = "0"
}]);
} }
internal static TableBuilder Create(FontProps? baseFont = null) => new(baseFont); internal static TableBuilder Create(FontProps? baseFont = null) => new(baseFont);
@@ -206,6 +232,7 @@ internal sealed class TableBuilder : ParagraphBuilderBase, ITable, IRow, ICell
public IRow Cell(CellProps cellProps) public IRow Cell(CellProps cellProps)
{ {
var cellBuilder = CellBuilder.SetCellProps(cellProps); var cellBuilder = CellBuilder.SetCellProps(cellProps);
cellBuilder.Paragraph(p => p.Run(""));
_row.AppendChild(cellBuilder.Build()); _row.AppendChild(cellBuilder.Build());
return this; return this;
} }