word table base font
This commit is contained in:
@@ -20,7 +20,7 @@ public interface IWordWriter : IWordReader
|
||||
void ReplaceString(IEnumerable<KeyValuePair<string, string>> replacements);
|
||||
void ReplaceString(string oldValue, IEnumerable<string> newValues);
|
||||
void ReplaceString(string oldValue, params string[] newValues);
|
||||
void ReplaceToTable(string oldValue, Action<ITable> buildTable);
|
||||
void ReplaceToTable(string oldValue, Action<ITable> buildTable, FontProps? baseFont = null);
|
||||
void ReplaceToText(string oldValue, Action<IText> buildText);
|
||||
void Save();
|
||||
void SaveTo(string path);
|
||||
|
||||
@@ -44,7 +44,7 @@ internal static class ReplaceToTableExt
|
||||
/// Заменяет все параграфы, содержащие указанный текст, на таблицы
|
||||
/// </summary>
|
||||
internal static void ReplaceParagraphsContainingTextToTable(Body body,
|
||||
string oldValue, Action<TableBuilder> buildTable)
|
||||
string oldValue, Action<TableBuilder> buildTable, FontProps? baseFont = null)
|
||||
{
|
||||
if (body is null || string.IsNullOrEmpty(oldValue) || buildTable is null)
|
||||
return;
|
||||
@@ -64,10 +64,10 @@ internal static class ReplaceToTableExt
|
||||
continue;
|
||||
|
||||
// Извлекаем свойства шрифта для передачи в TableBuilder
|
||||
var fontProps = ExtractFontPropsFromParagraph(paragraph, oldValue);
|
||||
baseFont ??= ExtractFontPropsFromParagraph(paragraph, oldValue);
|
||||
|
||||
// Заменяем параграф на таблицу
|
||||
ReplaceWithTableBuilder(paragraph, buildTable, fontProps);
|
||||
ReplaceWithTableBuilder(paragraph, buildTable, baseFont);
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
@@ -382,7 +382,7 @@ internal sealed class WordWriter : WordReader, IWordWriter
|
||||
/// </summary>
|
||||
/// <param name="oldValue">Текст для поиска в параграфах</param>
|
||||
/// <param name="buildTable">Действие для настройки таблицы через TableBuilder</param>
|
||||
public void ReplaceToTable(string oldValue, Action<ITable> buildTable)
|
||||
public void ReplaceToTable(string oldValue, Action<ITable> buildTable, FontProps? baseFont = null)
|
||||
{
|
||||
ThrowIfDisposed();
|
||||
|
||||
@@ -398,7 +398,7 @@ internal sealed class WordWriter : WordReader, IWordWriter
|
||||
lock (_syncLock)
|
||||
{
|
||||
// Используем метод расширения для Body с TableBuilder
|
||||
ReplaceToTableExt.ReplaceParagraphsContainingTextToTable(_body, oldValue, buildTable);
|
||||
ReplaceToTableExt.ReplaceParagraphsContainingTextToTable(_body, oldValue, buildTable, baseFont);
|
||||
_isModified = true;
|
||||
}
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user