diff --git a/Pizzeria/PizzeriaBusinessLogic/Implements/SaveToWord.cs b/Pizzeria/PizzeriaBusinessLogic/Implements/SaveToWord.cs index d4ffa0b..f906a32 100644 --- a/Pizzeria/PizzeriaBusinessLogic/Implements/SaveToWord.cs +++ b/Pizzeria/PizzeriaBusinessLogic/Implements/SaveToWord.cs @@ -119,13 +119,13 @@ namespace PizzeriaBusinessLogic.Implements _wordDocument.Close(); } - private Table? _table; + private Table? _lastTable; protected override void CreateTable(List columns) { if (_docBody == null) return; - _table = new Table(); + _lastTable = new Table(); var tableProp = new TableProperties(); tableProp.AppendChild(new TableLayout { Type = TableLayoutValues.Fixed }); @@ -138,23 +138,24 @@ namespace PizzeriaBusinessLogic.Implements new InsideVerticalBorder() { Val = new EnumValue(BorderValues.Single), Size = 4 } )); tableProp.AppendChild(new TableWidth { Type = TableWidthUnitValues.Auto }); - _table.AppendChild(tableProp); + _lastTable.AppendChild(tableProp); TableGrid tableGrid = new TableGrid(); foreach (var column in columns) { - tableGrid.AppendChild(new GridColumn() { Width = column });//3413 + tableGrid.AppendChild(new GridColumn() { Width = column }); } - _table.AppendChild(tableGrid); + _lastTable.AppendChild(tableGrid); - _docBody.AppendChild(_table); + _docBody.AppendChild(_lastTable); } protected override void CreateRow(WordRowParameters rowParameters) { - if (_docBody == null || _table == null) + if (_docBody == null || _lastTable == null) return; TableRow docRow = new TableRow(); + TableCell docCell = new TableCell(); foreach (var column in rowParameters.Texts) { var docParagraph = new Paragraph(); @@ -183,11 +184,10 @@ namespace PizzeriaBusinessLogic.Implements docParagraph.AppendChild(docRun); } - TableCell docCell = new TableCell(); docCell.AppendChild(docParagraph); docRow.AppendChild(docCell); } - _table.AppendChild(docRow); + _lastTable.AppendChild(docRow); } } } diff --git a/Pizzeria/PizzeriaBusinessLogic/OfficePackage/AbstractSaveToWord.cs b/Pizzeria/PizzeriaBusinessLogic/OfficePackage/AbstractSaveToWord.cs index 5fafeaf..a35bda9 100644 --- a/Pizzeria/PizzeriaBusinessLogic/OfficePackage/AbstractSaveToWord.cs +++ b/Pizzeria/PizzeriaBusinessLogic/OfficePackage/AbstractSaveToWord.cs @@ -57,7 +57,7 @@ namespace PizzeriaBusinessLogic.OfficePackage } }); - CreateTable(new List { "3413", "3413", "3000" }); + CreateTable(new List { "3000", "3000", "3000" }); CreateRow(new WordRowParameters { Texts = new List { "Название", "Адрес", "Дата открытия" }, @@ -76,7 +76,7 @@ namespace PizzeriaBusinessLogic.OfficePackage Texts = new List { shop.ShopName, shop.Adress, shop.OpeningDate.ToString() }, TextProperties = new WordTextProperties { - Size = "24", + Size = "22", JustificationType = WordJustificationType.Both } });