This commit is contained in:
анна 2024-05-31 16:39:24 +04:00
parent ea5afbeaf6
commit e5c8b35348
3 changed files with 127 additions and 134 deletions

View File

@ -1,18 +1,15 @@
using System; 
using System.Collections.Generic;
using System.Linq;
using System.Text;
using System.Threading.Tasks;
using UniversityBusinessLogics.MailWorker; using UniversityBusinessLogics.MailWorker;
using UniversityBusinessLogics.OfficePackage; using UniversityBusinessLogics.OfficePackage;
using UniversityContracts.BindingModels; using UniversityContracts.BindingModels;
using UniversityContracts.BusinessLogicContracts; using UniversityContracts.BusinessLogicContracts;
using UniversityContracts.StoragesContracts; using UniversityContracts.StoragesContracts;
namespace UniversityBusinessLogics.BusinessLogic namespace UniversityBusinessLogics.BusinessLogics;
public class ReportLogic : IReportLogic
{ {
public class ReportLogic : IReportLogic
{
private readonly AbstractSaveToWord _saveToWord; private readonly AbstractSaveToWord _saveToWord;
private readonly IPurchaseStorage _purchaseStorage; private readonly IPurchaseStorage _purchaseStorage;
private readonly IOperationStorage _carStorage; private readonly IOperationStorage _carStorage;
@ -54,7 +51,7 @@ namespace UniversityBusinessLogics.BusinessLogic
Title = "Список сделок вместе с операциями", Title = "Список сделок вместе с операциями",
ReportObjects = _purchaseStorage.GetFilteredList(new() { OperationsIds = option.Ids.ToList() }) ReportObjects = _purchaseStorage.GetFilteredList(new() { OperationsIds = option.Ids.ToList() })
.Select(x => (object)x).ToList(), .Select(x => (object)x).ToList(),
Headers = new() { "Сделка", "Дата сделки", } Headers = new() { "Сделка", "Дата сделки",}
}); });
} }
@ -105,7 +102,7 @@ namespace UniversityBusinessLogics.BusinessLogic
Title = "Список операций вместе с сделками", Title = "Список операций вместе с сделками",
ReportObjects = _carStorage.GetFilteredList(new() { PurchasesIds = option.Ids.ToList() }) ReportObjects = _carStorage.GetFilteredList(new() { PurchasesIds = option.Ids.ToList() })
.Select(x => (object)x).ToList(), .Select(x => (object)x).ToList(),
Headers = new() { "Вид", "Тип", "Дата" } Headers = new() { "Вид", "Тип", "Дата"}
}); });
} }
@ -133,6 +130,4 @@ namespace UniversityBusinessLogics.BusinessLogic
MailAddress = email, MailAddress = email,
}); });
} }
}
} }

View File

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

View File

@ -1,5 +1,6 @@
using Serilog; using Serilog;
using UniversityBusinessLogics.BusinessLogic; using UniversityBusinessLogics.BusinessLogic;
using UniversityBusinessLogics.BusinessLogics;
using UniversityBusinessLogics.MailWorker; using UniversityBusinessLogics.MailWorker;
using UniversityBusinessLogics.OfficePackage; using UniversityBusinessLogics.OfficePackage;
using UniversityBusinessLogics.OfficePackage.Implements; using UniversityBusinessLogics.OfficePackage.Implements;