Compare commits
1 Commits
282be475d5
...
v0.9.4
| Author | SHA1 | Date | |
|---|---|---|---|
|
|
804fc84563 |
@@ -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;
|
||||
}
|
||||
|
||||
@@ -94,7 +94,7 @@ internal sealed class ExcelCellText : ICellText
|
||||
}
|
||||
|
||||
/// <inheritdoc />
|
||||
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;
|
||||
}
|
||||
|
||||
/// <inheritdoc />
|
||||
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
|
||||
}
|
||||
|
||||
/// <inheritdoc />
|
||||
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;
|
||||
}
|
||||
|
||||
/// <inheritdoc />
|
||||
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);
|
||||
}
|
||||
|
||||
/// <inheritdoc />
|
||||
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);
|
||||
}
|
||||
|
||||
/// <inheritdoc />
|
||||
@@ -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);
|
||||
}
|
||||
|
||||
/// <inheritdoc />
|
||||
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
|
||||
}
|
||||
|
||||
/// <inheritdoc />
|
||||
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
|
||||
|
||||
@@ -779,19 +779,19 @@ public interface ICellText
|
||||
bool TryRemoveRun(int index, out IRun? removed);
|
||||
|
||||
/// <summary>Добавляет разрыв строки (перенос внутри ячейки).</summary>
|
||||
ICellText AddBreak();
|
||||
ICellText Break();
|
||||
|
||||
/// <summary>Добавляет обычный текстовый фрагмент.</summary>
|
||||
ICellText AddRun(string text, RunFormat? format = null);
|
||||
ICellText Run(string text, RunFormat? format = null);
|
||||
|
||||
/// <summary>Добавляет фрагмент с последующим разрывом строки.</summary>
|
||||
ICellText AddRunBreak(string text, RunFormat? format = null);
|
||||
ICellText RunBreak(string text, RunFormat? format = null);
|
||||
|
||||
/// <summary>Добавляет подстрочный фрагмент (эквивалентно AddRun с Vertical = Subscript).</summary>
|
||||
ICellText AddSubRun(string text, RunFormat? format = null);
|
||||
ICellText Sub(string text, RunFormat? format = null);
|
||||
|
||||
/// <summary>Добавляет надстрочный фрагмент.</summary>
|
||||
ICellText AddSupRun(string text, RunFormat? format = null);
|
||||
ICellText Sup(string text, RunFormat? format = null);
|
||||
|
||||
/// <summary>Вставляет фрагмент по индексу.</summary>
|
||||
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);
|
||||
|
||||
/// <summary>Вставляет подстрочный фрагмент по индексу.</summary>
|
||||
bool TryInsertSubRun(int index, string text, RunFormat? format = null);
|
||||
bool TryInsertSub(int index, string text, RunFormat? format = null);
|
||||
|
||||
/// <summary>Вставляет надстрочный фрагмент по индексу.</summary>
|
||||
bool TryInsertSupRun(int index, string text, RunFormat? format = null);
|
||||
bool TryInsertSup(int index, string text, RunFormat? format = null);
|
||||
|
||||
/// <summary>Применяет заданный формат ко всем существующим фрагментам (поверх их текущего форматирования, заменяя неуказанные свойства).</summary>
|
||||
void ApplyFormatToAllRuns(RunFormat format);
|
||||
|
||||
Reference in New Issue
Block a user