This commit is contained in:
melekhin
2026-09-07 15:52:23 +07:00
parent f786f60d1b
commit 2229f0f276
3 changed files with 42 additions and 4 deletions
+20
View File
@@ -28,4 +28,24 @@ internal static class Extension
size.Width = new(h.Value);
}
}
/// <summary>
/// Возвращает индекс указанного элемента в коллекции.
/// </summary>
/// <param name="list">Коллекция элементов.</param>
/// <param name="element">Элемент для поиска.</param>
/// <returns>Индекс элемента, или -1, если элемент не найден.</returns>
public static int IndexOf(this OpenXmlElementList list, OpenXmlElement element)
{
if (list == null || element == null)
return -1;
for (int i = 0; i < list.Count; i++)
{
if (list[i] == element)
return i;
}
return -1;
}
}
+20 -3
View File
@@ -1,6 +1,4 @@
using QWERTYkez.WordProcessor;
namespace QWERTYkez.WordProcessor;
namespace QWERTYkez.WordProcessor;
public interface IWordWriter : IWordReader
{
@@ -23,6 +21,25 @@ public interface IWordWriter : IWordReader
void ReplaceToTable(string oldValue, Action<ITable> buildTable);
void ReplaceToTable(string oldValue, FontProps baseFont, Action<ITable> buildTable);
void ReplaceToText(string oldValue, Action<IText> buildText);
void ReplaceString(string oldValue, Func<string, string> newValues);
void ReplaceString(string oldValue, Func<string, IEnumerable<string>> newValues);
void ReplaceString(string oldValue, Func<string, string[]> newValues);
void ReplaceItem(string oldValue, Func<string, ReplaceItem> newValues);
void ReplaceItem(string oldValue, Func<string, IEnumerable<ReplaceItem>> newValues);
void ReplaceItem(string oldValue, Func<string, ReplaceItem[]> newValues);
void ReplaceToTable(string oldValue, Action<string, ITable> buildTable);
void ReplaceToTable(string oldValue, FontProps baseFont, Action<string, ITable> buildTable);
void ReplaceToText(string oldValue, Action<string, IText> buildText);
void Save();
void SaveTo(string path);
Task SaveToAsync(string path, CancellationToken cancellationToken = default);
+2 -1
View File
@@ -8,4 +8,5 @@ global using System.IO;
global using System.Linq;
global using System.Text;
global using System.Threading;
global using System.Threading.Tasks;
global using System.Threading.Tasks;
global using System.Text.RegularExpressions;