remove ".Add*" and debugs

This commit is contained in:
melekhin
2026-09-02 16:42:34 +07:00
parent e5d291713a
commit da68c0754b
6 changed files with 87 additions and 87 deletions
@@ -16,9 +16,9 @@ public record FontProps
}
uint? _SizeD;
public bool? IsItalic { get; init; } = false;
public bool? IsItalic { get; init; }
public bool? IsBold { get; init; } = false;
public bool? IsBold { get; init; }
public UnderlineValues? Underline { get; init; }
+32 -32
View File
@@ -8,24 +8,24 @@ public interface ITable
/// <summary>Добавляет строку в таблицу, настраиваемую с помощью <paramref name="configure"/>.</summary>
/// <param name="configure">Делегат для конфигурации строки через <see cref="IRow"/>.</param>
/// <returns>Тот же экземпляр <see cref="ITable"/> для цепочки вызовов.</returns>
ITable AddRow(Action<IRow> configure);
ITable Row(Action<IRow> configure);
/// <summary>Добавляет строку с указанной высотой, настраиваемую с помощью <paramref name="configure"/>.</summary>
/// <param name="height">Высота строки в сантиметрах.</param>
/// <param name="configure">Делегат для конфигурации строки через <see cref="IRow"/>.</param>
/// <returns>Тот же экземпляр <see cref="ITable"/> для цепочки вызовов.</returns>
ITable AddRow(double height, Action<IRow> configure);
ITable Row(double height, Action<IRow> configure);
/// <summary>Добавляет строку с ячейками, содержащими заданные тексты, используя указанный шрифт.</summary>
/// <param name="font">Шрифт для всех ячеек строки.</param>
/// <param name="cellTexts">Массив текстов для ячеек.</param>
/// <returns>Тот же экземпляр <see cref="ITable"/> для цепочки вызовов.</returns>
ITable AddRowWithCells(FontProps font, params string[] cellTexts);
ITable RowWithCells(FontProps font, params string[] cellTexts);
/// <summary>Добавляет строку с ячейками, содержащими заданные тексты, используя базовый шрифт таблицы.</summary>
/// <param name="cellTexts">Массив текстов для ячеек.</param>
/// <returns>Тот же экземпляр <see cref="ITable"/> для цепочки вызовов.</returns>
ITable AddRowWithCells(params string[] cellTexts);
ITable RowWithCells(params string[] cellTexts);
/// <summary>Задаёт свойства таблицы: ширину и стиль границ, выравнивание.</summary>
/// <param name="borderWidth">Ширина границ в пунктах (1/8 pt). По умолчанию 8.</param>
@@ -47,47 +47,47 @@ public interface IRow
/// <summary>Добавляет ячейку, настраиваемую с помощью <paramref name="configure"/>.</summary>
/// <param name="configure">Делегат для конфигурации ячейки через <see cref="ICell"/>.</param>
/// <returns>Тот же экземпляр <see cref="IRow"/> для цепочки вызовов.</returns>
IRow AddCell(Action<ICell> configure);
IRow Cell(Action<ICell> configure);
/// <summary>Добавляет ячейку с заданными свойствами (без текста).</summary>
/// <param name="cellProps">Свойства ячейки (ширина, объединение, вертикальное выравнивание).</param>
/// <returns>Тот же экземпляр <see cref="IRow"/> для цепочки вызовов.</returns>
IRow AddCell(CellProps cellProps);
IRow Cell(CellProps cellProps);
/// <summary>Добавляет ячейку с заданными свойствами и текстом (используется базовый шрифт).</summary>
/// <param name="cellProps">Свойства ячейки.</param>
/// <param name="text">Текст ячейки.</param>
/// <returns>Тот же экземпляр <see cref="IRow"/> для цепочки вызовов.</returns>
IRow AddCell(CellProps cellProps, string text);
IRow Cell(CellProps cellProps, string text);
/// <summary>Добавляет ячейку с заданными свойствами, текстом и указанным шрифтом.</summary>
/// <param name="cellProps">Свойства ячейки.</param>
/// <param name="text">Текст ячейки.</param>
/// <param name="font">Шрифт для текста. Если <see langword="null"/>, используется базовый шрифт.</param>
/// <returns>Тот же экземпляр <see cref="IRow"/> для цепочки вызовов.</returns>
IRow AddCell(CellProps cellProps, string text, FontProps font);
IRow Cell(CellProps cellProps, string text, FontProps font);
/// <summary>Добавляет ячейку с простым текстом (используется базовый шрифт).</summary>
/// <param name="text">Текст ячейки.</param>
/// <returns>Тот же экземпляр <see cref="IRow"/> для цепочки вызовов.</returns>
IRow AddCell(string text);
IRow Cell(string text);
/// <summary>Добавляет ячейку с простым текстом и указанным шрифтом.</summary>
/// <param name="text">Текст ячейки.</param>
/// <param name="font">Шрифт для текста. Если <see langword="null"/>, используется базовый шрифт.</param>
/// <returns>Тот же экземпляр <see cref="IRow"/> для цепочки вызовов.</returns>
IRow AddCell(string text, FontProps font);
IRow Cell(string text, FontProps font);
/// <summary>Добавляет ячейку, содержащую один абзац, построенный с помощью <paramref name="configure"/>.</summary>
/// <param name="configure">Делегат для конфигурации абзаца через <see cref="IParagraph"/>.</param>
/// <returns>Тот же экземпляр <see cref="IRow"/> для цепочки вызовов.</returns>
IRow AddCellWithPara(Action<IParagraph> configure);
IRow CellWithPara(Action<IParagraph> configure);
/// <summary>Добавляет ячейку с указанными свойствами, содержащую один абзац, построенный с помощью <paramref name="configure"/>.</summary>
/// <param name="cellProps">Свойства ячейки.</param>
/// <param name="configure">Делегат для конфигурации абзаца через <see cref="IParagraph"/>.</param>
/// <returns>Тот же экземпляр <see cref="IRow"/> для цепочки вызовов.</returns>
IRow AddCellWithPara(CellProps cellProps, Action<IParagraph> configure);
IRow CellWithPara(CellProps cellProps, Action<IParagraph> configure);
/// <summary>Устанавливает точную высоту строки (свойство Exact).</summary>
/// <param name="heightInCm">Высота в сантиметрах.</param>
@@ -117,23 +117,23 @@ public interface ICell
/// <summary>Добавляет в ячейку абзац, содержащий математическую формулу.</summary>
/// <param name="configure">Делегат для конфигурации формулы через <see cref="IFormula"/>.</param>
/// <returns>Тот же экземпляр <see cref="ICell"/> для цепочки вызовов.</returns>
ICell AddFormula(Action<IFormula> configure);
ICell Formula(Action<IFormula> configure);
/// <summary>Добавляет в ячейку абзац, построенный с помощью <paramref name="configure"/>.</summary>
/// <param name="configure">Делегат для конфигурации абзаца через <see cref="IParagraph"/>.</param>
/// <returns>Тот же экземпляр <see cref="ICell"/> для цепочки вызовов.</returns>
ICell AddParagraph(Action<IParagraph> configure);
ICell Paragraph(Action<IParagraph> configure);
/// <summary>Добавляет в ячейку абзац, состоящий из нескольких строк текста (разделённых переносами).</summary>
/// <param name="lines">Массив строк, каждая строка будет размещена на новой строке абзаца.</param>
/// <returns>Тот же экземпляр <see cref="ICell"/> для цепочки вызовов.</returns>
ICell AddParagraph(params string[] lines);
ICell Paragraph(params string[] lines);
/// <summary>Добавляет в ячейку абзац с указанным текстом и опциональным шрифтом.</summary>
/// <param name="text">Текст абзаца.</param>
/// <param name="font">Шрифт для текста. Если <see langword="null"/>, используется базовый шрифт.</param>
/// <returns>Тот же экземпляр <see cref="ICell"/> для цепочки вызовов.</returns>
ICell AddParagraph(string text, FontProps? font = null);
ICell Paragraph(string text, FontProps? font = null);
/// <summary>Устанавливает свойства ячейки (ширина, объединение, вертикальное выравнивание).</summary>
/// <param name="props">Свойства ячейки.</param>
@@ -153,25 +153,25 @@ public interface IText
/// <summary>Добавляет в документ абзац, содержащий математическую формулу.</summary>
/// <param name="configure">Делегат для конфигурации формулы через <see cref="IFormula"/>.</param>
/// <returns>Тот же экземпляр <see cref="IText"/> для цепочки вызовов.</returns>
IText AddFormula(Action<IFormula> configure);
IText Formula(Action<IFormula> configure);
/// <summary>Добавляет абзац, построенный с помощью <paramref name="configure"/>.</summary>
/// <param name="configure">Делегат для конфигурации абзаца через <see cref="IParagraph"/>.</param>
/// <returns>Тот же экземпляр <see cref="IText"/> для цепочки вызовов.</returns>
IText AddParagraph(Action<IParagraph> configure);
IText Paragraph(Action<IParagraph> configure);
/// <summary>Добавляет абзац, состоящий из нескольких строк текста (разделённых переносами).</summary>
/// <param name="lines">Массив строк, каждая строка будет размещена на новой строке абзаца.</param>
/// <returns>Тот же экземпляр <see cref="IText"/> для цепочки вызовов.</returns>
IText AddParagraph(params string[] lines);
IText Paragraph(params string[] lines);
/// <summary>Добавляет абзац с указанным текстом и опциональным шрифтом.</summary>
/// <param name="text">Текст абзаца.</param>
/// <param name="font">Шрифт для текста. Если <see langword="null"/>, используется базовый шрифт.</param>
/// <returns>Тот же экземпляр <see cref="IText"/> для цепочки вызовов.</returns>
IText AddParagraph(string text, FontProps? font = null);
IText Paragraph(string text, FontProps? font = null);
/// <summary>Создаёт список абзацев <see cref="Paragraph"/> на основе выполненных настроек.</summary>
/// <summary>Создаёт список абзацев <see cref="DocumentFormat.OpenXml.Wordprocessing.Paragraph"/> на основе выполненных настроек.</summary>
/// <returns>Список готовых абзацев для вставки в документ.</returns>
internal List<Paragraph> Build();
}
@@ -181,15 +181,15 @@ public interface IParagraph
/// <summary>Базовый шрифт, используемый по умолчанию для содержимого абзаца.</summary>
FontProps BaseFont { get; }
/// <summary>Добавляет в абзац математическую формулу (внутри отдельного <see cref="Run"/>).</summary>
/// <summary>Добавляет в абзац математическую формулу (внутри отдельного <see cref="DocumentFormat.OpenXml.Wordprocessing.Run"/>).</summary>
/// <param name="configure">Делегат для конфигурации формулы через <see cref="IFormula"/>.</param>
/// <returns>Тот же экземпляр <see cref="IParagraph"/> для цепочки вызовов.</returns>
IParagraph AddFormula(Action<IFormula> configure);
IParagraph Formula(Action<IFormula> configure);
/// <summary>Добавляет в абзац математическую формулу (внутри отдельного <see cref="Run"/>) и разрыв строки (<see cref="DocumentFormat.OpenXml.Wordprocessing.Break"/>) в текущий абзац.</summary>
/// <summary>Добавляет в абзац математическую формулу (внутри отдельного <see cref="DocumentFormat.OpenXml.Wordprocessing.Run"/>) и разрыв строки (<see cref="DocumentFormat.OpenXml.Wordprocessing.Break"/>) в текущий абзац.</summary>
/// <param name="configure">Делегат для конфигурации формулы через <see cref="IFormula"/>.</param>
/// <returns>Тот же экземпляр <see cref="IParagraph"/> для цепочки вызовов.</returns>
IParagraph AddFormulaBreak(Action<IFormula> configure);
IParagraph FormulaBreak(Action<IFormula> configure);
/// <summary>Добавляет разрыв строки (<see cref="DocumentFormat.OpenXml.Wordprocessing.Break"/>) в текущий абзац.</summary>
/// <returns>Тот же экземпляр <see cref="IParagraph"/> для цепочки вызовов.</returns>
@@ -199,35 +199,35 @@ public interface IParagraph
/// <returns>Тот же экземпляр <see cref="IParagraph"/> для цепочки вызовов.</returns>
IParagraph BreakPage();
/// <summary>Добавляет текстовый фрагмент (<see cref="Run"/>) с указанным текстом и опциональным шрифтом.</summary>
/// <summary>Добавляет текстовый фрагмент (<see cref="DocumentFormat.OpenXml.Wordprocessing.Run"/>) с указанным текстом и опциональным шрифтом.</summary>
/// <param name="text">Текст фрагмента.</param>
/// <param name="font">Шрифт для текста. Если <see langword="null"/>, используется базовый шрифт.</param>
/// <returns>Тот же экземпляр <see cref="IParagraph"/> для цепочки вызовов.</returns>
IParagraph AddRun(string text, FontProps? font = null);
IParagraph Run(string text, FontProps? font = null);
/// <summary>Добавляет текстовый фрагмент (<see cref="Run"/>) с указанным текстом и опциональным шрифтом и разрыв строки (<see cref="DocumentFormat.OpenXml.Wordprocessing.Break"/>) в текущий абзац.</summary>
/// <summary>Добавляет текстовый фрагмент (<see cref="DocumentFormat.OpenXml.Wordprocessing.Run"/>) с указанным текстом и опциональным шрифтом и разрыв строки (<see cref="DocumentFormat.OpenXml.Wordprocessing.Break"/>) в текущий абзац.</summary>
/// <param name="text">Текст фрагмента.</param>
/// <param name="font">Шрифт для текста. Если <see langword="null"/>, используется базовый шрифт.</param>
/// <returns>Тот же экземпляр <see cref="IParagraph"/> для цепочки вызовов.</returns>
IParagraph AddRunBreak(string text, FontProps? font = null);
IParagraph RunBreak(string text, FontProps? font = null);
/// <summary>Добавляет текстовый фрагмент с полным контролем над свойствами <see cref="RunProperties"/>.</summary>
/// <param name="text">Текст фрагмента.</param>
/// <param name="configure">Делегат для настройки свойств фрагмента.</param>
/// <returns>Тот же экземпляр <see cref="IParagraph"/> для цепочки вызовов.</returns>
IParagraph AddRunWithCustomProps(string text, Action<RunProperties> configure);
IParagraph RunWithCustomProps(string text, Action<RunProperties> configure);
/// <summary>Добавляет текстовый фрагмент, отформатированный как нижний индекс (<see cref="VerticalPositionValues.Subscript"/>).</summary>
/// <param name="text">Текст фрагмента.</param>
/// <param name="font">Базовый шрифт (свойства <see cref="SubSup"/> будут переопределены).</param>
/// <returns>Тот же экземпляр <see cref="IParagraph"/> для цепочки вызовов.</returns>
IParagraph AddSubRun(string text, FontProps? font = null);
IParagraph Sub(string text, FontProps? font = null);
/// <summary>Добавляет текстовый фрагмент, отформатированный как верхний индекс (<see cref="VerticalPositionValues.Superscript"/>).</summary>
/// <param name="text">Текст фрагмента.</param>
/// <param name="font">Базовый шрифт (свойства <see cref="SubSup"/> будут переопределены).</param>
/// <returns>Тот же экземпляр <see cref="IParagraph"/> для цепочки вызовов.</returns>
IParagraph AddSupRun(string text, FontProps? font = null);
IParagraph Sup(string text, FontProps? font = null);
/// <summary>Устанавливает выравнивание абзаца.</summary>
/// <param name="alignment">Тип выравнивания (лево, право, центр, по ширине).</param>
@@ -69,7 +69,7 @@ abstract class ParagraphBuilderBase : IParagraph, IFormula
}
// Добавление текста
public IParagraph AddRun(string text, FontProps? font = null)
public IParagraph Run(string text, FontProps? font = null)
{
// Заменяем обычные пробелы на неразрывные для сохранения видимости
string processedText = text.Replace(' ', '\u00A0');
@@ -91,7 +91,7 @@ abstract class ParagraphBuilderBase : IParagraph, IFormula
}
// Добавление текста
public IParagraph AddRunBreak(string text, FontProps? font = null)
public IParagraph RunBreak(string text, FontProps? font = null)
{
// Заменяем обычные пробелы на неразрывные для сохранения видимости
string processedText = text.Replace(' ', '\u00A0');
@@ -116,7 +116,7 @@ abstract class ParagraphBuilderBase : IParagraph, IFormula
}
// Добавление текста
public IParagraph AddSupRun(string text, FontProps? font = null)
public IParagraph Sup(string text, FontProps? font = null)
{
var effectiveFont = GetEffectiveFont(font);
Run run;
@@ -135,7 +135,7 @@ abstract class ParagraphBuilderBase : IParagraph, IFormula
}
// Добавление текста
public IParagraph AddSubRun(string text, FontProps? font = null)
public IParagraph Sub(string text, FontProps? font = null)
{
var effectiveFont = GetEffectiveFont(font);
Run run;
@@ -153,7 +153,7 @@ abstract class ParagraphBuilderBase : IParagraph, IFormula
return this;
}
public IParagraph AddRunWithCustomProps(string text, Action<RunProperties> configure)
public IParagraph RunWithCustomProps(string text, Action<RunProperties> configure)
{
var props = new RunProperties();
configure(props);
@@ -175,8 +175,8 @@ abstract class ParagraphBuilderBase : IParagraph, IFormula
return this;
}
// Метод AddFormula для IParagraphBuilder
IParagraph IParagraph.AddFormula(Action<IFormula> configure)
// Метод Formula для IParagraphBuilder
IParagraph IParagraph.Formula(Action<IFormula> configure)
{
var math = new MathOfficeMath();
try
@@ -195,8 +195,8 @@ abstract class ParagraphBuilderBase : IParagraph, IFormula
return this;
}
// Метод AddFormula для IParagraphBuilder
IParagraph IParagraph.AddFormulaBreak(Action<IFormula> configure)
// Метод Formula для IParagraphBuilder
IParagraph IParagraph.FormulaBreak(Action<IFormula> configure)
{
var math = new MathOfficeMath();
try
@@ -40,7 +40,7 @@ internal sealed class TableBuilder : ParagraphBuilderBase, ITable, IRow, ICell
}
// Добавление строк с использованием IRowBuilder
public ITable AddRow(Action<IRow> configure)
public ITable Row(Action<IRow> configure)
{
var IRowBuilder = RowBuilder;
configure(this);
@@ -48,7 +48,7 @@ internal sealed class TableBuilder : ParagraphBuilderBase, ITable, IRow, ICell
return this;
}
public ITable AddRow(double height, Action<IRow> configure)
public ITable Row(double height, Action<IRow> configure)
{
var IRowBuilder = RowBuilder.SetHeight(height);
configure(this);
@@ -57,25 +57,25 @@ internal sealed class TableBuilder : ParagraphBuilderBase, ITable, IRow, ICell
}
// Быстрые методы для добавления строк с ячейками
public ITable AddRowWithCells(params string[] cellTexts)
public ITable RowWithCells(params string[] cellTexts)
{
AddRow(row =>
Row(row =>
{
foreach (var text in cellTexts)
{
row.AddCell(text);
row.Cell(text);
}
});
return this;
}
public ITable AddRowWithCells(FontProps font, params string[] cellTexts)
public ITable RowWithCells(FontProps font, params string[] cellTexts)
{
AddRow(row =>
Row(row =>
{
foreach (var text in cellTexts)
{
row.AddCell(text, font);
row.Cell(text, font);
}
});
return this;
@@ -155,7 +155,7 @@ internal sealed class TableBuilder : ParagraphBuilderBase, ITable, IRow, ICell
}
// Добавление ячеек
public IRow AddCell(Action<ICell> configure)
public IRow Cell(Action<ICell> configure)
{
var cellBuilder = CellBuilder;
configure(this);
@@ -163,47 +163,47 @@ internal sealed class TableBuilder : ParagraphBuilderBase, ITable, IRow, ICell
return this;
}
public IRow AddCell(string text)
public IRow Cell(string text)
{
var cellBuilder = CellBuilder;
cellBuilder.AddParagraph(p => p.AddRun(text));
cellBuilder.Paragraph(p => p.Run(text));
_row.AppendChild(cellBuilder.Build());
return this;
}
public IRow AddCell(string text, FontProps font)
public IRow Cell(string text, FontProps font)
{
var cellBuilder = CellBuilder;
if (font is not null)
cellBuilder.AddParagraph(p => p.AddRun(text, font));
else cellBuilder.AddParagraph(p => p.AddRun(text));
cellBuilder.Paragraph(p => p.Run(text, font));
else cellBuilder.Paragraph(p => p.Run(text));
_row.AppendChild(cellBuilder.Build());
return this;
}
public IRow AddCell(CellProps cellProps, string text, FontProps font)
public IRow Cell(CellProps cellProps, string text, FontProps font)
{
var cellBuilder = CellBuilder.SetCellProps(cellProps);
if (font is not null)
cellBuilder.AddParagraph(p => p.AddRun(text, font));
else cellBuilder.AddParagraph(p => p.AddRun(text));
cellBuilder.Paragraph(p => p.Run(text, font));
else cellBuilder.Paragraph(p => p.Run(text));
_row.AppendChild(cellBuilder.Build());
return this;
}
public IRow AddCell(CellProps cellProps, string text)
public IRow Cell(CellProps cellProps, string text)
{
var cellBuilder = CellBuilder.SetCellProps(cellProps);
cellBuilder.AddParagraph(p => p.AddRun(text));
cellBuilder.Paragraph(p => p.Run(text));
_row.AppendChild(cellBuilder.Build());
return this;
}
public IRow AddCell(CellProps cellProps)
public IRow Cell(CellProps cellProps)
{
var cellBuilder = CellBuilder.SetCellProps(cellProps);
_row.AppendChild(cellBuilder.Build());
@@ -219,17 +219,17 @@ internal sealed class TableBuilder : ParagraphBuilderBase, ITable, IRow, ICell
}
public IRow AddCellWithPara(Action<IParagraph> configure)
public IRow CellWithPara(Action<IParagraph> configure)
{
var cellBuilder = CellBuilder;
cellBuilder.AddParagraph(configure);
cellBuilder.Paragraph(configure);
_row.AppendChild(cellBuilder.Build());
return this;
}
public IRow AddCellWithPara(CellProps cellProps, Action<IParagraph> configure)
public IRow CellWithPara(CellProps cellProps, Action<IParagraph> configure)
{
var cellBuilder = CellBuilder.SetCellProps(cellProps);
cellBuilder.AddParagraph(configure);
cellBuilder.Paragraph(configure);
_row.AppendChild(cellBuilder.Build());
return this;
}
@@ -276,7 +276,7 @@ internal sealed class TableBuilder : ParagraphBuilderBase, ITable, IRow, ICell
}
// Добавление параграфов
public ICell AddParagraph(Action<IParagraph> configure)
public ICell Paragraph(Action<IParagraph> configure)
{
var paraBuilder = ParagraphBuilder;
configure(paraBuilder);
@@ -284,44 +284,44 @@ internal sealed class TableBuilder : ParagraphBuilderBase, ITable, IRow, ICell
return this;
}
public ICell AddParagraph(string text, FontProps? font = null)
public ICell Paragraph(string text, FontProps? font = null)
{
var paraBuilder = ParagraphBuilder;
if (font is not null)
{
paraBuilder.AddRun(text, font);
paraBuilder.Run(text, font);
}
else
{
paraBuilder.AddRun(text);
paraBuilder.Run(text);
}
_paragraphs.Add(paraBuilder.Build());
return this;
}
public ICell AddParagraph(params string[] lines)
public ICell Paragraph(params string[] lines)
{
var paraBuilder = ParagraphBuilder;
if (lines.Length > 0)
{
paraBuilder.AddRun(lines[0]);
paraBuilder.Run(lines[0]);
for (int i = 1; i < lines.Length; i++)
{
paraBuilder.Break();
paraBuilder.AddRun(lines[i]);
paraBuilder.Run(lines[i]);
}
}
_paragraphs.Add(paraBuilder.Build());
return this;
}
// Метод AddFormula для ICellBuilder
ICell ICell.AddFormula(Action<IFormula> configure)
// Метод Formula для ICellBuilder
ICell ICell.Formula(Action<IFormula> configure)
{
var paraBuilder = ParagraphBuilder;
paraBuilder.AddFormula(configure);
paraBuilder.Formula(configure);
_paragraphs.Add(paraBuilder.Build());
return this;
}
@@ -58,16 +58,16 @@ internal sealed class TextBuilder : ParagraphBuilderBase, IText
private readonly List<Paragraph> _paragraphs = [];
public List<Paragraph> Build() => _paragraphs;
IText IText.AddFormula(Action<IFormula> configure)
IText IText.Formula(Action<IFormula> configure)
{
var paraBuilder = ParagraphBuilder;
paraBuilder.AddFormula(configure);
paraBuilder.Formula(configure);
_paragraphs.Add(paraBuilder.Build());
return this;
}
// Добавление параграфов
public IText AddParagraph(Action<IParagraph> configure)
public IText Paragraph(Action<IParagraph> configure)
{
var paraBuilder = ParagraphBuilder;
configure(paraBuilder);
@@ -75,33 +75,33 @@ internal sealed class TextBuilder : ParagraphBuilderBase, IText
return this;
}
public IText AddParagraph(string text, FontProps? font = null)
public IText Paragraph(string text, FontProps? font = null)
{
var paraBuilder = ParagraphBuilder;
if (font is not null)
{
paraBuilder.AddRun(text, font);
paraBuilder.Run(text, font);
}
else
{
paraBuilder.AddRun(text);
paraBuilder.Run(text);
}
_paragraphs.Add(paraBuilder.Build());
return this;
}
public IText AddParagraph(params string[] lines)
public IText Paragraph(params string[] lines)
{
var paraBuilder = ParagraphBuilder;
if (lines.Length > 0)
{
paraBuilder.AddRun(lines[0]);
paraBuilder.Run(lines[0]);
for (int i = 1; i < lines.Length; i++)
{
paraBuilder.Break();
paraBuilder.AddRun(lines[i]);
paraBuilder.Run(lines[i]);
}
}
_paragraphs.Add(paraBuilder.Build());
+1 -1
View File
@@ -67,7 +67,7 @@ internal static class ReplaceToTableExt
var fontProps = ExtractFontPropsFromParagraph(paragraph, oldValue);
if (fontProps is { } props)
props.Override(baseFont);
fontProps = props.Override(baseFont);
// Заменяем параграф на таблицу
ReplaceWithTableBuilder(paragraph, buildTable, fontProps);