Лабораторная_4

This commit is contained in:
yuliya.mavrina@internet.ru 2024-04-11 22:10:45 +03:00
parent 132e421d93
commit 7bfc1d2ebd
12 changed files with 89 additions and 76 deletions

View File

@ -107,7 +107,7 @@
// //
AutoScaleDimensions = new SizeF(7F, 15F); AutoScaleDimensions = new SizeF(7F, 15F);
AutoScaleMode = AutoScaleMode.Font; AutoScaleMode = AutoScaleMode.Font;
ClientSize = new Size(800, 450); ClientSize = new Size(807, 450);
Controls.Add(panel); Controls.Add(panel);
Name = "FormReportOrders"; Name = "FormReportOrders";
Text = "Заказы"; Text = "Заказы";

View File

@ -29,7 +29,7 @@ namespace RenovationWorkView
{ {
Dock = DockStyle.Fill Dock = DockStyle.Fill
}; };
reportViewer.LocalReport.LoadReportDefinition(new FileStream("ReportOrder.rdlc", FileMode.Open)); reportViewer.LocalReport.LoadReportDefinition(new FileStream("..\\..\\..\\ReportOrders.rdlc", FileMode.Open));
Controls.Clear(); Controls.Clear();
Controls.Add(reportViewer); Controls.Add(reportViewer);
Controls.Add(panel); Controls.Add(panel);
@ -96,3 +96,4 @@ namespace RenovationWorkView
} }
} }
} }

View File

@ -1,4 +1,6 @@
using RenovationWorkBusinessLogic.BusinessLogics; using RenovationWorkBusinessLogic.BusinessLogics;
using RenovationWorkBusinessLogic.OfficePackage.Implements;
using RenovationWorkBusinessLogic.OfficePackage;
using RenovationWorkContracts.BusinessLogicsContracts; using RenovationWorkContracts.BusinessLogicsContracts;
using RenovationWorkContracts.StoragesContracts; using RenovationWorkContracts.StoragesContracts;
using RenovationWorkDatabaseImplement.Implements; using RenovationWorkDatabaseImplement.Implements;
@ -40,6 +42,10 @@ namespace RenovationWorkView
services.AddTransient<IComponentLogic, ComponentLogic>(); services.AddTransient<IComponentLogic, ComponentLogic>();
services.AddTransient<IOrderLogic, OrderLogic>(); services.AddTransient<IOrderLogic, OrderLogic>();
services.AddTransient<IRepairLogic, RepairLogic>(); services.AddTransient<IRepairLogic, RepairLogic>();
services.AddTransient<IReportLogic, ReportLogic>();
services.AddTransient<AbstractSaveToExcel, SaveToExcel>();
services.AddTransient<AbstractSaveToWord, SaveToWord>();
services.AddTransient<AbstractSaveToPdf, SaveToPdf>();
services.AddTransient<FormMain>(); services.AddTransient<FormMain>();
services.AddTransient<FormComponent>(); services.AddTransient<FormComponent>();
services.AddTransient<FormComponents>(); services.AddTransient<FormComponents>();
@ -47,6 +53,8 @@ namespace RenovationWorkView
services.AddTransient<FormRepair>(); services.AddTransient<FormRepair>();
services.AddTransient<FormRepairComponent>(); services.AddTransient<FormRepairComponent>();
services.AddTransient<FormRepairs>(); services.AddTransient<FormRepairs>();
services.AddTransient<FormReportRepairComponents>();
services.AddTransient<FormReportOrders>();
} }
} }
} }

View File

@ -16,8 +16,10 @@
<PackageReference Include="Microsoft.Extensions.DependencyInjection" Version="8.0.0" /> <PackageReference Include="Microsoft.Extensions.DependencyInjection" Version="8.0.0" />
<PackageReference Include="Microsoft.Extensions.Logging" Version="8.0.0" /> <PackageReference Include="Microsoft.Extensions.Logging" Version="8.0.0" />
<PackageReference Include="Microsoft.Extensions.Logging.Abstractions" Version="8.0.0" /> <PackageReference Include="Microsoft.Extensions.Logging.Abstractions" Version="8.0.0" />
<PackageReference Include="MigraDocCore.Rendering" Version="1.3.63" />
<PackageReference Include="NLog" Version="5.2.8" /> <PackageReference Include="NLog" Version="5.2.8" />
<PackageReference Include="NLog.Extensions.Logging" Version="5.3.8" /> <PackageReference Include="NLog.Extensions.Logging" Version="5.3.8" />
<PackageReference Include="PdfSharp.MigraDoc.Standard" Version="1.51.15" />
<PackageReference Include="ReportViewerCore.WinForms" Version="15.1.19" /> <PackageReference Include="ReportViewerCore.WinForms" Version="15.1.19" />
</ItemGroup> </ItemGroup>
@ -44,4 +46,10 @@
</EmbeddedResource> </EmbeddedResource>
</ItemGroup> </ItemGroup>
<ItemGroup>
<None Update="ReportOrders.rdlc">
<CopyToOutputDirectory>Always</CopyToOutputDirectory>
</None>
</ItemGroup>
</Project> </Project>

View File

@ -7,7 +7,7 @@
<DataProvider>System.Data.DataSet</DataProvider> <DataProvider>System.Data.DataSet</DataProvider>
<ConnectString>/* Local Connection */</ConnectString> <ConnectString>/* Local Connection */</ConnectString>
</ConnectionProperties> </ConnectionProperties>
<rd:DataSourceID>10791c83-cee8-4a38-bbd0-245fc17cefb3</rd:DataSourceID> <rd:DataSourceID>47cb53f0-7dde-4717-ba03-866a0bc4f4dd</rd:DataSourceID>
</DataSource> </DataSource>
</DataSources> </DataSources>
<DataSets> <DataSets>
@ -25,27 +25,23 @@
<DataField>DateCreate</DataField> <DataField>DateCreate</DataField>
<rd:TypeName>System.DateTime</rd:TypeName> <rd:TypeName>System.DateTime</rd:TypeName>
</Field> </Field>
<Field Name="Status"> <Field Name="ManufactureName">
<DataField>Status</DataField> <DataField>ManufactureName</DataField>
<rd:TypeName>System.String</rd:TypeName>
</Field>
<Field Name="RepairName">
<DataField>RepairName</DataField>
<rd:TypeName>System.String</rd:TypeName>
</Field>
<Field Name="OrderStatus">
<DataField>OrderStatus</DataField>
<rd:TypeName>System.String</rd:TypeName> <rd:TypeName>System.String</rd:TypeName>
</Field> </Field>
<Field Name="Sum"> <Field Name="Sum">
<DataField>Sum</DataField> <DataField>Sum</DataField>
<rd:TypeName>System.Decimal</rd:TypeName> <rd:TypeName>System.Decimal</rd:TypeName>
</Field> </Field>
<Field Name="OrderStatus">
<DataField>OrderStatus</DataField>
<rd:TypeName>RenovationWorkDataModels.OrderStatus</rd:TypeName>
</Field>
</Fields> </Fields>
<rd:DataSetInfo> <rd:DataSetInfo>
<rd:DataSetName>RenovationWorkContracts.ViewModels</rd:DataSetName> <rd:DataSetName>RenovationWorkContracts.ViewModels</rd:DataSetName>
<rd:TableName>ReportOrdersViewModel</rd:TableName> <rd:TableName>ReportOrderViewModel</rd:TableName>
<rd:ObjectDataSourceType>RenovationWorkContracts.ViewModels.ReportOrdersViewModel, RenovationWorkContracts, Version=1.0.0.0, Culture=neutral, PublicKeyToken=null</rd:ObjectDataSourceType> <rd:ObjectDataSourceType>RenovationWorkContracts.ViewModels.ReportOrderViewModel, RenovationWorkContracts, Version=1.0.0.0, Culture=neutral, PublicKeyToken=null</rd:ObjectDataSourceType>
</rd:DataSetInfo> </rd:DataSetInfo>
</DataSet> </DataSet>
</DataSets> </DataSets>
@ -75,7 +71,7 @@
<rd:DefaultName>ReportParameterPeriod</rd:DefaultName> <rd:DefaultName>ReportParameterPeriod</rd:DefaultName>
<Top>1cm</Top> <Top>1cm</Top>
<Height>1cm</Height> <Height>1cm</Height>
<Width>17.4445cm</Width> <Width>21cm</Width>
<Style> <Style>
<Border> <Border>
<Style>None</Style> <Style>None</Style>
@ -94,7 +90,7 @@
<Paragraph> <Paragraph>
<TextRuns> <TextRuns>
<TextRun> <TextRun>
<Value>Заказы</Value> <Value>Список заказов</Value>
<Style> <Style>
<FontSize>16pt</FontSize> <FontSize>16pt</FontSize>
<FontWeight>Bold</FontWeight> <FontWeight>Bold</FontWeight>
@ -107,7 +103,7 @@
</Paragraph> </Paragraph>
</Paragraphs> </Paragraphs>
<Height>1cm</Height> <Height>1cm</Height>
<Width>17.4445cm</Width> <Width>21cm</Width>
<ZIndex>1</ZIndex> <ZIndex>1</ZIndex>
<Style> <Style>
<Border> <Border>
@ -124,19 +120,19 @@
<TablixBody> <TablixBody>
<TablixColumns> <TablixColumns>
<TablixColumn> <TablixColumn>
<Width>2.0889cm</Width> <Width>2.5cm</Width>
</TablixColumn> </TablixColumn>
<TablixColumn> <TablixColumn>
<Width>2.80328cm</Width> <Width>3.21438cm</Width>
</TablixColumn> </TablixColumn>
<TablixColumn> <TablixColumn>
<Width>7.82207cm</Width> <Width>8.23317cm</Width>
</TablixColumn> </TablixColumn>
<TablixColumn> <TablixColumn>
<Width>2.0889cm</Width> <Width>2.5cm</Width>
</TablixColumn> </TablixColumn>
<TablixColumn> <TablixColumn>
<Width>2.0889cm</Width> <Width>2.5cm</Width>
</TablixColumn> </TablixColumn>
</TablixColumns> </TablixColumns>
<TablixRows> <TablixRows>
@ -184,7 +180,7 @@
<Paragraph> <Paragraph>
<TextRuns> <TextRuns>
<TextRun> <TextRun>
<Value>Дата создания</Value> <Value>Дата заказа</Value>
<Style> <Style>
<FontWeight>Bold</FontWeight> <FontWeight>Bold</FontWeight>
</Style> </Style>
@ -216,7 +212,7 @@
<Paragraph> <Paragraph>
<TextRuns> <TextRuns>
<TextRun> <TextRun>
<Value>Ремонт</Value> <Value>Изделие</Value>
<Style> <Style>
<FontWeight>Bold</FontWeight> <FontWeight>Bold</FontWeight>
</Style> </Style>
@ -248,7 +244,7 @@
<Paragraph> <Paragraph>
<TextRuns> <TextRuns>
<TextRun> <TextRun>
<Value>Status</Value> <Value>Сумма</Value>
<Style> <Style>
<FontWeight>Bold</FontWeight> <FontWeight>Bold</FontWeight>
</Style> </Style>
@ -280,7 +276,7 @@
<Paragraph> <Paragraph>
<TextRuns> <TextRuns>
<TextRun> <TextRun>
<Value>Сумма</Value> <Value>Статус</Value>
<Style> <Style>
<FontWeight>Bold</FontWeight> <FontWeight>Bold</FontWeight>
</Style> </Style>
@ -402,21 +398,21 @@
</TablixCell> </TablixCell>
<TablixCell> <TablixCell>
<CellContents> <CellContents>
<Textbox Name="Status"> <Textbox Name="Sum1">
<CanGrow>true</CanGrow> <CanGrow>true</CanGrow>
<KeepTogether>true</KeepTogether> <KeepTogether>true</KeepTogether>
<Paragraphs> <Paragraphs>
<Paragraph> <Paragraph>
<TextRuns> <TextRuns>
<TextRun> <TextRun>
<Value>=Fields!Status.Value</Value> <Value>=Fields!Sum.Value</Value>
<Style /> <Style />
</TextRun> </TextRun>
</TextRuns> </TextRuns>
<Style /> <Style />
</Paragraph> </Paragraph>
</Paragraphs> </Paragraphs>
<rd:DefaultName>Status</rd:DefaultName> <rd:DefaultName>Sum1</rd:DefaultName>
<Style> <Style>
<Border> <Border>
<Color>LightGrey</Color> <Color>LightGrey</Color>
@ -432,21 +428,21 @@
</TablixCell> </TablixCell>
<TablixCell> <TablixCell>
<CellContents> <CellContents>
<Textbox Name="Sum"> <Textbox Name="OrderStatus">
<CanGrow>true</CanGrow> <CanGrow>true</CanGrow>
<KeepTogether>true</KeepTogether> <KeepTogether>true</KeepTogether>
<Paragraphs> <Paragraphs>
<Paragraph> <Paragraph>
<TextRuns> <TextRuns>
<TextRun> <TextRun>
<Value>=Fields!Sum.Value</Value> <Value>=Fields!OrderStatus.Value</Value>
<Style /> <Style />
</TextRun> </TextRun>
</TextRuns> </TextRuns>
<Style /> <Style />
</Paragraph> </Paragraph>
</Paragraphs> </Paragraphs>
<rd:DefaultName>Sum</rd:DefaultName> <rd:DefaultName>OrderStatus</rd:DefaultName>
<Style> <Style>
<Border> <Border>
<Color>LightGrey</Color> <Color>LightGrey</Color>
@ -487,7 +483,7 @@
<Top>2.48391cm</Top> <Top>2.48391cm</Top>
<Left>0.55245cm</Left> <Left>0.55245cm</Left>
<Height>1.2cm</Height> <Height>1.2cm</Height>
<Width>16.89205cm</Width> <Width>18.94755cm</Width>
<ZIndex>2</ZIndex> <ZIndex>2</ZIndex>
<Style> <Style>
<Border> <Border>
@ -562,10 +558,10 @@
</Style> </Style>
</Textbox> </Textbox>
</ReportItems> </ReportItems>
<Height>6.27908cm</Height> <Height>5.72875cm</Height>
<Style /> <Style />
</Body> </Body>
<Width>23.52167cm</Width> <Width>21cm</Width>
<Page> <Page>
<PageHeight>29.7cm</PageHeight> <PageHeight>29.7cm</PageHeight>
<PageWidth>21cm</PageWidth> <PageWidth>21cm</PageWidth>
@ -587,7 +583,7 @@
</ReportParameters> </ReportParameters>
<ReportParametersLayout> <ReportParametersLayout>
<GridLayoutDefinition> <GridLayoutDefinition>
<NumberOfColumns>4</NumberOfColumns> <NumberOfColumns>5</NumberOfColumns>
<NumberOfRows>2</NumberOfRows> <NumberOfRows>2</NumberOfRows>
<CellDefinitions> <CellDefinitions>
<CellDefinition> <CellDefinition>
@ -599,5 +595,5 @@
</GridLayoutDefinition> </GridLayoutDefinition>
</ReportParametersLayout> </ReportParametersLayout>
<rd:ReportUnitType>Cm</rd:ReportUnitType> <rd:ReportUnitType>Cm</rd:ReportUnitType>
<rd:ReportID>2de0031a-4d17-449d-922d-d9fc54572312</rd:ReportID> <rd:ReportID>1c0c12af-b9e8-41db-8d1f-26d1acbf91cc</rd:ReportID>
</Report> </Report>

View File

@ -15,18 +15,25 @@ namespace RenovationWorkBusinessLogic.OfficePackage
public void CreateDoc(PdfInfo info) public void CreateDoc(PdfInfo info)
{ {
CreatePdf(info); CreatePdf(info);
CreateParagraph(new PdfParagraph { Text = info.Title, Style = "NormalTitle", ParagraphAlignment = PdfParagraphAlignmentType.Center }); CreateParagraph(new PdfParagraph
CreateParagraph(new PdfParagraph { Text = $"с {info.DateFrom.ToShortDateString()} по {info.DateTo.ToShortDateString()}", Style = "Normal", ParagraphAlignment = PdfParagraphAlignmentType.Center });
CreateTable(new List<string> { "2cm", "3cm", "6cm", "3cm", "3cm" });
CreateRow(new PdfRowParameters
{ {
Texts = new List<string> { "Номер", "Дата заказа", "Пицца", "Статус", "Сумма" }, Text = info.Title,
Style = "NormalTitle",
ParagraphAlignment = PdfParagraphAlignmentType.Center
});
CreateParagraph(new PdfParagraph
{
Text = $"с {info.DateFrom.ToShortDateString()} по {info.DateTo.ToShortDateString()}",
Style = "Normal",
ParagraphAlignment = PdfParagraphAlignmentType.Center
});
CreateTable(new List<string> { "2cm", "3cm", "6cm", "4cm", "3cm" });
CreateRow(new PdfRowParameters
{
Texts = new List<string> { "Номер", "Дата заказа", "Изделие", "Статус", "Сумма" },
Style = "NormalTitle", Style = "NormalTitle",
ParagraphAlignment = PdfParagraphAlignmentType.Center ParagraphAlignment = PdfParagraphAlignmentType.Center
}); });
foreach (var order in info.Orders) foreach (var order in info.Orders)
{ {
CreateRow(new PdfRowParameters CreateRow(new PdfRowParameters
@ -36,8 +43,12 @@ namespace RenovationWorkBusinessLogic.OfficePackage
ParagraphAlignment = PdfParagraphAlignmentType.Left ParagraphAlignment = PdfParagraphAlignmentType.Left
}); });
} }
CreateParagraph(new PdfParagraph { Text = $"Итого: {info.Orders.Sum(x => x.Sum)}\t", Style = "Normal", ParagraphAlignment = PdfParagraphAlignmentType.Rigth }); CreateParagraph(new PdfParagraph
{
Text = $"Итого: {info.Orders.Sum(x => x.Sum)}\t",
Style = "Normal",
ParagraphAlignment = PdfParagraphAlignmentType.Right
});
SavePdf(info); SavePdf(info);
} }
protected abstract void CreatePdf(PdfInfo info); protected abstract void CreatePdf(PdfInfo info);
@ -46,4 +57,5 @@ namespace RenovationWorkBusinessLogic.OfficePackage
protected abstract void CreateRow(PdfRowParameters rowParameters); protected abstract void CreateRow(PdfRowParameters rowParameters);
protected abstract void SavePdf(PdfInfo info); protected abstract void SavePdf(PdfInfo info);
} }
} }

View File

@ -10,7 +10,7 @@ namespace RenovationWorkBusinessLogic.OfficePackage.HelperEnums
{ {
Center, Center,
Left, Left,
Rigth Right
} }
} }

View File

@ -281,8 +281,10 @@ namespace RenovationWorkBusinessLogic.OfficePackage.Implements
return; return;
} }
_spreadsheetDocument.WorkbookPart!.Workbook.Save(); _spreadsheetDocument.WorkbookPart!.Workbook.Save();
_spreadsheetDocument.Close();
_spreadsheetDocument.Dispose();
} }
} }
} }

View File

@ -7,11 +7,7 @@ using System.Collections.Generic;
using System.Linq; using System.Linq;
using System.Text; using System.Text;
using System.Threading.Tasks; using System.Threading.Tasks;
using RenovationWorkBusinessLogic.OfficePackage.HelperEnums;
using RenovationWorkBusinessLogic.OfficePackage.HelperModels;
using MigraDoc.DocumentObjectModel;
using MigraDoc.DocumentObjectModel.Tables; using MigraDoc.DocumentObjectModel.Tables;
using MigraDoc.Rendering;
namespace RenovationWorkBusinessLogic.OfficePackage.Implements namespace RenovationWorkBusinessLogic.OfficePackage.Implements
@ -21,36 +17,30 @@ namespace RenovationWorkBusinessLogic.OfficePackage.Implements
private Document? _document; private Document? _document;
private Section? _section; private Section? _section;
private Table? _table; private Table? _table;
private static ParagraphAlignment GetParagraphAlignment(PdfParagraphAlignmentType type) private static ParagraphAlignment GetParagraphAlignment(PdfParagraphAlignmentType type)
{ {
return type switch return type switch
{ {
PdfParagraphAlignmentType.Center => ParagraphAlignment.Center, PdfParagraphAlignmentType.Center => ParagraphAlignment.Center,
PdfParagraphAlignmentType.Left => ParagraphAlignment.Left, PdfParagraphAlignmentType.Left => ParagraphAlignment.Left,
PdfParagraphAlignmentType.Rigth => ParagraphAlignment.Right, PdfParagraphAlignmentType.Right => ParagraphAlignment.Right,
_ => ParagraphAlignment.Justify, _ => ParagraphAlignment.Justify,
}; };
} }
private static void DefineStyles(Document document) private static void DefineStyles(Document document)
{ {
var style = document.Styles["Normal"]; var style = document.Styles["Normal"];
style.Font.Name = "Times New Roman"; style.Font.Name = "Times New Roman";
style.Font.Size = 14; style.Font.Size = 14;
style = document.Styles.AddStyle("NormalTitle", "Normal"); style = document.Styles.AddStyle("NormalTitle", "Normal");
style.Font.Bold = true; style.Font.Bold = true;
} }
protected override void CreatePdf(PdfInfo info) protected override void CreatePdf(PdfInfo info)
{ {
_document = new Document(); _document = new Document();
DefineStyles(_document); DefineStyles(_document);
_section = _document.AddSection(); _section = _document.AddSection();
} }
protected override void CreateParagraph(PdfParagraph pdfParagraph) protected override void CreateParagraph(PdfParagraph pdfParagraph)
{ {
if (_section == null) if (_section == null)
@ -59,10 +49,10 @@ namespace RenovationWorkBusinessLogic.OfficePackage.Implements
} }
var paragraph = _section.AddParagraph(pdfParagraph.Text); var paragraph = _section.AddParagraph(pdfParagraph.Text);
paragraph.Format.SpaceAfter = "1cm"; paragraph.Format.SpaceAfter = "1cm";
paragraph.Format.Alignment = GetParagraphAlignment(pdfParagraph.ParagraphAlignment); paragraph.Format.Alignment =
GetParagraphAlignment(pdfParagraph.ParagraphAlignment);
paragraph.Style = pdfParagraph.Style; paragraph.Style = pdfParagraph.Style;
} }
protected override void CreateTable(List<string> columns) protected override void CreateTable(List<string> columns)
{ {
if (_document == null) if (_document == null)
@ -70,13 +60,11 @@ namespace RenovationWorkBusinessLogic.OfficePackage.Implements
return; return;
} }
_table = _document.LastSection.AddTable(); _table = _document.LastSection.AddTable();
foreach (var elem in columns) foreach (var elem in columns)
{ {
_table.AddColumn(elem); _table.AddColumn(elem);
} }
} }
protected override void CreateRow(PdfRowParameters rowParameters) protected override void CreateRow(PdfRowParameters rowParameters)
{ {
if (_table == null) if (_table == null)
@ -87,24 +75,20 @@ namespace RenovationWorkBusinessLogic.OfficePackage.Implements
for (int i = 0; i < rowParameters.Texts.Count; ++i) for (int i = 0; i < rowParameters.Texts.Count; ++i)
{ {
row.Cells[i].AddParagraph(rowParameters.Texts[i]); row.Cells[i].AddParagraph(rowParameters.Texts[i]);
if (!string.IsNullOrEmpty(rowParameters.Style)) if (!string.IsNullOrEmpty(rowParameters.Style))
{ {
row.Cells[i].Style = rowParameters.Style; row.Cells[i].Style = rowParameters.Style;
} }
Unit borderWidth = 0.5; Unit borderWidth = 0.5;
row.Cells[i].Borders.Left.Width = borderWidth; row.Cells[i].Borders.Left.Width = borderWidth;
row.Cells[i].Borders.Right.Width = borderWidth; row.Cells[i].Borders.Right.Width = borderWidth;
row.Cells[i].Borders.Top.Width = borderWidth; row.Cells[i].Borders.Top.Width = borderWidth;
row.Cells[i].Borders.Bottom.Width = borderWidth; row.Cells[i].Borders.Bottom.Width = borderWidth;
row.Cells[i].Format.Alignment =
row.Cells[i].Format.Alignment = GetParagraphAlignment(rowParameters.ParagraphAlignment); GetParagraphAlignment(rowParameters.ParagraphAlignment);
row.Cells[i].VerticalAlignment = VerticalAlignment.Center; row.Cells[i].VerticalAlignment = VerticalAlignment.Center;
} }
} }
protected override void SavePdf(PdfInfo info) protected override void SavePdf(PdfInfo info)
{ {
var renderer = new PdfDocumentRenderer(true) var renderer = new PdfDocumentRenderer(true)
@ -116,3 +100,4 @@ namespace RenovationWorkBusinessLogic.OfficePackage.Implements
} }
} }
} }

View File

@ -114,7 +114,7 @@ namespace RenovationWorkBusinessLogic.OfficePackage.Implements
_wordDocument.MainDocumentPart!.Document.Save(); _wordDocument.MainDocumentPart!.Document.Save();
_wordDocument.Close(); _wordDocument.Dispose();
} }
} }
} }

View File

@ -9,7 +9,8 @@
<ItemGroup> <ItemGroup>
<PackageReference Include="DocumentFormat.OpenXml" Version="3.0.0" /> <PackageReference Include="DocumentFormat.OpenXml" Version="3.0.0" />
<PackageReference Include="Microsoft.Extensions.Logging.Abstractions" Version="8.0.0" /> <PackageReference Include="Microsoft.Extensions.Logging.Abstractions" Version="8.0.0" />
<PackageReference Include="PdfSharp.MigraDoc.Standard" Version="1.51.9" /> <PackageReference Include="PDFsharp-MigraDoc" Version="6.0.0" />
<PackageReference Include="PdfSharp.MigraDoc.Standard" Version="1.51.15" />
</ItemGroup> </ItemGroup>
<ItemGroup> <ItemGroup>

View File

@ -10,6 +10,6 @@ namespace RenovationWorkContracts.ViewModels
{ {
public string RepairName { get; set; } = string.Empty; public string RepairName { get; set; } = string.Empty;
public int TotalCount { get; set; } public int TotalCount { get; set; }
public List<(string Component, int Count)> Components { get; set; } = new(); public List<(string, int)> Components { get; set; } = new();
} }
} }