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();
}
private Table? _table;
private Table? _lastTable;
protected override void CreateTable(List<string> 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>(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);
}
}
}

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