LittleChanges

This commit is contained in:
shadowik 2023-04-20 04:55:07 +04:00
parent 3787a8f033
commit 442ebcea15
2 changed files with 11 additions and 11 deletions

View File

@ -119,13 +119,13 @@ namespace PizzeriaBusinessLogic.Implements
_wordDocument.Close(); _wordDocument.Close();
} }
private Table? _table; private Table? _lastTable;
protected override void CreateTable(List<string> columns) protected override void CreateTable(List<string> columns)
{ {
if (_docBody == null) if (_docBody == null)
return; return;
_table = new Table(); _lastTable = new Table();
var tableProp = new TableProperties(); var tableProp = new TableProperties();
tableProp.AppendChild(new TableLayout { Type = TableLayoutValues.Fixed }); tableProp.AppendChild(new TableLayout { Type = TableLayoutValues.Fixed });
@ -138,23 +138,24 @@ namespace PizzeriaBusinessLogic.Implements
new InsideVerticalBorder() { Val = new EnumValue<BorderValues>(BorderValues.Single), Size = 4 } new InsideVerticalBorder() { Val = new EnumValue<BorderValues>(BorderValues.Single), Size = 4 }
)); ));
tableProp.AppendChild(new TableWidth { Type = TableWidthUnitValues.Auto }); tableProp.AppendChild(new TableWidth { Type = TableWidthUnitValues.Auto });
_table.AppendChild(tableProp); _lastTable.AppendChild(tableProp);
TableGrid tableGrid = new TableGrid(); TableGrid tableGrid = new TableGrid();
foreach (var column in columns) 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) protected override void CreateRow(WordRowParameters rowParameters)
{ {
if (_docBody == null || _table == null) if (_docBody == null || _lastTable == null)
return; return;
TableRow docRow = new TableRow(); TableRow docRow = new TableRow();
TableCell docCell = new TableCell();
foreach (var column in rowParameters.Texts) foreach (var column in rowParameters.Texts)
{ {
var docParagraph = new Paragraph(); var docParagraph = new Paragraph();
@ -183,11 +184,10 @@ namespace PizzeriaBusinessLogic.Implements
docParagraph.AppendChild(docRun); docParagraph.AppendChild(docRun);
} }
TableCell docCell = new TableCell();
docCell.AppendChild(docParagraph); docCell.AppendChild(docParagraph);
docRow.AppendChild(docCell); docRow.AppendChild(docCell);
} }
_table.AppendChild(docRow); _lastTable.AppendChild(docRow);
} }
} }
} }

View File

@ -57,7 +57,7 @@ namespace PizzeriaBusinessLogic.OfficePackage
} }
}); });
CreateTable(new List<string> { "3413", "3413", "3000" }); CreateTable(new List<string> { "3000", "3000", "3000" });
CreateRow(new WordRowParameters CreateRow(new WordRowParameters
{ {
Texts = new List<string> { "Название", "Адрес", "Дата открытия" }, Texts = new List<string> { "Название", "Адрес", "Дата открытия" },
@ -76,7 +76,7 @@ namespace PizzeriaBusinessLogic.OfficePackage
Texts = new List<string> { shop.ShopName, shop.Adress, shop.OpeningDate.ToString() }, Texts = new List<string> { shop.ShopName, shop.Adress, shop.OpeningDate.ToString() },
TextProperties = new WordTextProperties TextProperties = new WordTextProperties
{ {
Size = "24", Size = "22",
JustificationType = WordJustificationType.Both JustificationType = WordJustificationType.Both
} }
}); });