diff --git a/QWERTYkez.WordProcessor/Builders/TableBuilder.cs b/QWERTYkez.WordProcessor/Builders/TableBuilder.cs index 7a66061..d22552b 100644 --- a/QWERTYkez.WordProcessor/Builders/TableBuilder.cs +++ b/QWERTYkez.WordProcessor/Builders/TableBuilder.cs @@ -6,6 +6,32 @@ internal sealed class TableBuilder : ParagraphBuilderBase, ITable, IRow, ICell internal TableBuilder(FontProps? baseFont) : base(baseFont) { + // Получаем или создаем свойства таблицы + var tblProps = _table.GetFirstChild(); + 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); @@ -206,6 +232,7 @@ internal sealed class TableBuilder : ParagraphBuilderBase, ITable, IRow, ICell public IRow Cell(CellProps cellProps) { var cellBuilder = CellBuilder.SetCellProps(cellProps); + cellBuilder.Paragraph(p => p.Run("")); _row.AppendChild(cellBuilder.Build()); return this; }