From 804fc845638880c39519fafc218c89a2298c32f3 Mon Sep 17 00:00:00 2001 From: melekhin Date: Tue, 16 Jun 2026 12:03:56 +0700 Subject: [PATCH] ICellText rename --- QWERTYkez.ExcelProcessor/Editors/ExcelCell.cs | 2 +- .../Editors/ExcelCellText.cs | 26 +++++++++---------- .../Editors/Interfaces.cs | 14 +++++----- 3 files changed, 21 insertions(+), 21 deletions(-) diff --git a/QWERTYkez.ExcelProcessor/Editors/ExcelCell.cs b/QWERTYkez.ExcelProcessor/Editors/ExcelCell.cs index 1ac3ee3..53cf5e7 100644 --- a/QWERTYkez.ExcelProcessor/Editors/ExcelCell.cs +++ b/QWERTYkez.ExcelProcessor/Editors/ExcelCell.cs @@ -445,7 +445,7 @@ internal sealed class ExcelCell : ICell // Преобразуем RunProperties в RunFormat (можно вынести в отдельный метод) format = RunFormat.FromRunProperties(run.RunProperties); } - textObj.AddRun(text, format); + textObj.Run(text, format); } return textObj; } diff --git a/QWERTYkez.ExcelProcessor/Editors/ExcelCellText.cs b/QWERTYkez.ExcelProcessor/Editors/ExcelCellText.cs index d5add4c..0178834 100644 --- a/QWERTYkez.ExcelProcessor/Editors/ExcelCellText.cs +++ b/QWERTYkez.ExcelProcessor/Editors/ExcelCellText.cs @@ -94,7 +94,7 @@ internal sealed class ExcelCellText : ICellText } /// - public ICellText AddBreak() + public ICellText Break() { // Добавляем символ переноса строки в последний существующий Run if (_runs != null && _runs.Count > 0) @@ -105,13 +105,13 @@ internal sealed class ExcelCellText : ICellText else { // Если нет ни одного Run, создаём новый с символом переноса - AddRun("\n", null); + Run("\n", null); } return this; } /// - public ICellText AddRun(string text, RunFormat? format = null) + public ICellText Run(string text, RunFormat? format = null) { if (string.IsNullOrEmpty(text)) return this; @@ -122,15 +122,15 @@ internal sealed class ExcelCellText : ICellText } /// - public ICellText AddRunBreak(string text, RunFormat? format = null) + public ICellText RunBreak(string text, RunFormat? format = null) { - AddRun(text, format); - AddBreak(); + Run(text, format); + Break(); return this; } /// - public ICellText AddSubRun(string text, RunFormat? format = null) + public ICellText Sub(string text, RunFormat? format = null) { var subFormat = format is { } fmt ? new RunFormat @@ -145,11 +145,11 @@ internal sealed class ExcelCellText : ICellText Vertical = VerticalTextRunAlignment.Subscript } : new RunFormat { Vertical = VerticalTextRunAlignment.Subscript }; - return AddRun(text, subFormat); + return Run(text, subFormat); } /// - public ICellText AddSupRun(string text, RunFormat? format = null) + public ICellText Sup(string text, RunFormat? format = null) { var supFormat = format is { } fmt ? new RunFormat @@ -164,7 +164,7 @@ internal sealed class ExcelCellText : ICellText Vertical = VerticalTextRunAlignment.Subscript } : new RunFormat { Vertical = VerticalTextRunAlignment.Superscript }; - return AddRun(text, supFormat); + return Run(text, supFormat); } /// @@ -186,14 +186,14 @@ internal sealed class ExcelCellText : ICellText if (!TryInsertRun(index, text, format)) return false; // После вставленного run добавляем break на следующей позиции - AddBreak(); + Break(); // Сдвигаем? Просто добавляем break в конец – неверно. Break должен быть сразу после вставленного. // Но AddBreak добавляет в конец. Нужно вставить break на index+1. return TryInsertRun(index + 1, "\n", null); } /// - public bool TryInsertSubRun(int index, string text, RunFormat? format = null) + public bool TryInsertSub(int index, string text, RunFormat? format = null) { var subFormat = format is { } fmt ? new RunFormat @@ -212,7 +212,7 @@ internal sealed class ExcelCellText : ICellText } /// - public bool TryInsertSupRun(int index, string text, RunFormat? format = null) + public bool TryInsertSup(int index, string text, RunFormat? format = null) { var supFormat = format is { } fmt ? new RunFormat diff --git a/QWERTYkez.ExcelProcessor/Editors/Interfaces.cs b/QWERTYkez.ExcelProcessor/Editors/Interfaces.cs index cd417b4..e1fc048 100644 --- a/QWERTYkez.ExcelProcessor/Editors/Interfaces.cs +++ b/QWERTYkez.ExcelProcessor/Editors/Interfaces.cs @@ -779,19 +779,19 @@ public interface ICellText bool TryRemoveRun(int index, out IRun? removed); /// Добавляет разрыв строки (перенос внутри ячейки). - ICellText AddBreak(); + ICellText Break(); /// Добавляет обычный текстовый фрагмент. - ICellText AddRun(string text, RunFormat? format = null); + ICellText Run(string text, RunFormat? format = null); /// Добавляет фрагмент с последующим разрывом строки. - ICellText AddRunBreak(string text, RunFormat? format = null); + ICellText RunBreak(string text, RunFormat? format = null); /// Добавляет подстрочный фрагмент (эквивалентно AddRun с Vertical = Subscript). - ICellText AddSubRun(string text, RunFormat? format = null); + ICellText Sub(string text, RunFormat? format = null); /// Добавляет надстрочный фрагмент. - ICellText AddSupRun(string text, RunFormat? format = null); + ICellText Sup(string text, RunFormat? format = null); /// Вставляет фрагмент по индексу. bool TryInsertRun(int index, string text, RunFormat? format = null); @@ -800,10 +800,10 @@ public interface ICellText bool TryInsertRunBreak(int index, string text, RunFormat? format = null); /// Вставляет подстрочный фрагмент по индексу. - bool TryInsertSubRun(int index, string text, RunFormat? format = null); + bool TryInsertSub(int index, string text, RunFormat? format = null); /// Вставляет надстрочный фрагмент по индексу. - bool TryInsertSupRun(int index, string text, RunFormat? format = null); + bool TryInsertSup(int index, string text, RunFormat? format = null); /// Применяет заданный формат ко всем существующим фрагментам (поверх их текущего форматирования, заменяя неуказанные свойства). void ApplyFormatToAllRuns(RunFormat format);