凸( ̄ヘ ̄)

This commit is contained in:
Polina 2024-05-31 19:11:00 +04:00
parent ff7ff41707
commit 79ac3cf662
4 changed files with 43 additions and 40 deletions

View File

@ -29,9 +29,9 @@ namespace UniversityBusinessLogics.OfficePackage
CreateParagraph(new WordParagraph CreateParagraph(new WordParagraph
{ {
Texts = new List<(string, WordTextProperties)> Texts = new List<(string, WordTextProperties)>
{ {
(text, new WordTextProperties { Size = "24" }) (text, new WordTextProperties { Size = "24" })
}, },
TextProperties = new WordTextProperties TextProperties = new WordTextProperties
{ {
Size = "24", Size = "24",
@ -42,23 +42,23 @@ namespace UniversityBusinessLogics.OfficePackage
SaveWord(info); SaveWord(info);
} }
/// <summary> /// <summary>
/// Создание doc-файла /// Создание doc-файла
/// </summary> /// </summary>
/// <param name="info"></param> /// <param name="info"></param>
protected abstract void CreateWord(WordInfo info); protected abstract void CreateWord(WordInfo info);
/// <summary> /// <summary>
/// Создание абзаца с текстом /// Создание абзаца с текстом
/// </summary> /// </summary>
/// <param name="paragraph"></param> /// <param name="paragraph"></param>
/// <returns></returns> /// <returns></returns>
protected abstract void CreateParagraph(WordParagraph paragraph); protected abstract void CreateParagraph(WordParagraph paragraph);
/// <summary> /// <summary>
/// Сохранение файла /// Сохранение файла
/// </summary> /// </summary>
/// <param name="info"></param> /// <param name="info"></param>
protected abstract void SaveWord(WordInfo info); protected abstract void SaveWord(WordInfo info);
} }
} }

View File

@ -188,17 +188,17 @@ namespace UniversityBusinessLogics.OfficePackage.Implements
_shareStringPart.SharedStringTable = new SharedStringTable(); _shareStringPart.SharedStringTable = new SharedStringTable();
} }
// Create a new worksheet part // Создаем лист в книгу
var workbookPart = _spreadsheetDocument.AddWorkbookPart(); var worksheetPart = workbookpart.AddNewPart<WorksheetPart>();
workbookPart.Workbook = new Workbook(); worksheetPart.Worksheet = new Worksheet(new SheetData());
// Set the new worksheet as the active worksheet // Добавляем лист в книгу
var sheets = workbookPart.Workbook.AppendChild(new Sheets()); var sheets = _spreadsheetDocument.WorkbookPart.Workbook.AppendChild(new Sheets());
var sheet = new Sheet var sheet = new Sheet()
{ {
Id = _spreadsheetDocument.WorkbookPart.GetIdOfPart(worksheetPart), Id = _spreadsheetDocument.WorkbookPart.GetIdOfPart(worksheetPart),
SheetId = (uint)sheets.ChildElements.Count + 1, SheetId = 1,
Name = "Sheet1" // You can change the name as needed Name = "Лист"
}; };
sheets.Append(sheet); sheets.Append(sheet);
@ -290,7 +290,10 @@ namespace UniversityBusinessLogics.OfficePackage.Implements
} }
} }
var mergeCell = new MergeCell { Reference = excelParams.Merge }; var mergeCell = new MergeCell()
{
Reference = new StringValue(excelParams.Merge)
};
mergeCells.Append(mergeCell); mergeCells.Append(mergeCell);
} }

View File

@ -12,11 +12,11 @@ namespace UniversityBusinessLogics.OfficePackage.Implements
private Body? _docBody; private Body? _docBody;
/// <summary> /// <summary>
/// Получение типа выравнивания /// Получение типа выравнивания
/// </summary> /// </summary>
/// <param name="type"></param> /// <param name="type"></param>
/// <returns></returns> /// <returns></returns>
private static JustificationValues GetJustificationValues(WordJustificationType type) private static JustificationValues GetJustificationValues(WordJustificationType type)
{ {
return type switch return type switch
@ -27,10 +27,10 @@ namespace UniversityBusinessLogics.OfficePackage.Implements
}; };
} }
/// <summary> /// <summary>
/// Настройки страницы /// Настройки страницы
/// </summary> /// </summary>
/// <returns></returns> /// <returns></returns>
private static SectionProperties CreateSectionProperties() private static SectionProperties CreateSectionProperties()
{ {
var properties = new SectionProperties(); var properties = new SectionProperties();
@ -45,11 +45,11 @@ namespace UniversityBusinessLogics.OfficePackage.Implements
return properties; return properties;
} }
/// <summary> /// <summary>
/// Задание форматирования для абзаца /// Задание форматирования для абзаца
/// </summary> /// </summary>
/// <param name="paragraphProperties"></param> /// <param name="paragraphProperties"></param>
/// <returns></returns> /// <returns></returns>
private static ParagraphProperties? CreateParagraphProperties(WordTextProperties? paragraphProperties) private static ParagraphProperties? CreateParagraphProperties(WordTextProperties? paragraphProperties)
{ {
if (paragraphProperties == null) if (paragraphProperties == null)
@ -144,3 +144,4 @@ namespace UniversityBusinessLogics.OfficePackage.Implements
} }
} }
} }

View File

@ -18,7 +18,6 @@ builder.Services.AddSession(); //
builder.Services.AddTransient<IClientLogic, ClientLogic>(); builder.Services.AddTransient<IClientLogic, ClientLogic>();
builder.Services.AddTransient<IPurchaseLogic, PurchaseLogic>(); builder.Services.AddTransient<IPurchaseLogic, PurchaseLogic>();
builder.Services.AddTransient<IOperationLogic, OperationLogic>(); builder.Services.AddTransient<IOperationLogic, OperationLogic>();
builder.Services.AddTransient<IReportLogic, ReportLogic>();
builder.Services.AddTransient<IPaymentLogic, PaymentLogic>(); builder.Services.AddTransient<IPaymentLogic, PaymentLogic>();
builder.Services.AddTransient<AbstractSaveToWord, SaveToWord>(); builder.Services.AddTransient<AbstractSaveToWord, SaveToWord>();