А еще лучше так
This commit is contained in:
parent
96f5a5ac76
commit
32635a6eba
@ -55,7 +55,7 @@ namespace SushiBarBusinessLogic.OfficePackage
|
||||
List<WordRow> rows = new List<WordRow>();
|
||||
rows.Add(new WordRow
|
||||
{
|
||||
Texts = new List<(string, WordTextProperties)> {
|
||||
Rows = new List<(string, WordTextProperties)> {
|
||||
("Название", new WordTextProperties { Size = "24", Bold = true }),
|
||||
("Адрес", new WordTextProperties { Size = "24", Bold = true }),
|
||||
("Дата открытия", new WordTextProperties { Size = "24", Bold = true })
|
||||
@ -66,7 +66,7 @@ namespace SushiBarBusinessLogic.OfficePackage
|
||||
{
|
||||
rows.Add(new WordRow
|
||||
{
|
||||
Texts = new List<(string, WordTextProperties)> {
|
||||
Rows = new List<(string, WordTextProperties)> {
|
||||
(shop.ShopName, new WordTextProperties { Size = "24" }),
|
||||
(shop.Address, new WordTextProperties { Size = "24" }),
|
||||
(shop.DateOpening.ToShortDateString(), new WordTextProperties { Size = "24" })
|
||||
|
@ -2,6 +2,6 @@
|
||||
{
|
||||
public class WordRow
|
||||
{
|
||||
public List<(string, WordTextProperties)> Texts { get; set; } = new();
|
||||
public List<(string, WordTextProperties)> Rows { get; set; } = new();
|
||||
}
|
||||
}
|
||||
|
@ -109,7 +109,7 @@ namespace SushiBarBusinessLogic.OfficePackage.Implements
|
||||
tableProp.AppendChild(new TableWidth { Type = TableWidthUnitValues.Auto });
|
||||
table.AppendChild(tableProp);
|
||||
TableGrid tableGrid = new TableGrid();
|
||||
for (int j = 0; j < data[0].Texts.Count; ++j)
|
||||
for (int j = 0; j < data[0].Rows.Count; ++j)
|
||||
{
|
||||
tableGrid.AppendChild(new GridColumn() { Width = "3200" });
|
||||
}
|
||||
@ -117,21 +117,21 @@ namespace SushiBarBusinessLogic.OfficePackage.Implements
|
||||
for (int i = 0; i < data.Count; ++i)
|
||||
{
|
||||
TableRow docRow = new TableRow();
|
||||
for (int j = 0; j < data[i].Texts.Count; ++j)
|
||||
for (int j = 0; j < data[i].Rows.Count; ++j)
|
||||
{
|
||||
var docParagraph = new Paragraph();
|
||||
var docRun = new Run();
|
||||
var runProperties = new RunProperties();
|
||||
|
||||
docParagraph.AppendChild(CreateParagraphProperties(data[i].Texts[j].Item2));
|
||||
docParagraph.AppendChild(CreateParagraphProperties(data[i].Rows[j].Item2));
|
||||
|
||||
runProperties.AppendChild(new RunFonts() { Ascii = "Times New Roman", ComplexScript = "Times New Roman", HighAnsi = "Times New Roman" });
|
||||
runProperties.AppendChild(new FontSize { Val = data[i].Texts[j].Item2.Size == null ? data[i].Texts[j].Item2.Size : "24" });
|
||||
if (data[i].Texts[j].Item2.Bold)
|
||||
runProperties.AppendChild(new FontSize { Val = data[i].Rows[j].Item2.Size == null ? data[i].Rows[j].Item2.Size : "24" });
|
||||
if (data[i].Rows[j].Item2.Bold)
|
||||
runProperties.AppendChild(new Bold());
|
||||
|
||||
docRun.AppendChild(runProperties);
|
||||
docRun.AppendChild(new Text { Text = data[i].Texts[j].Item1.ToString(), Space = SpaceProcessingModeValues.Preserve });
|
||||
docRun.AppendChild(new Text { Text = data[i].Rows[j].Item1.ToString(), Space = SpaceProcessingModeValues.Preserve });
|
||||
|
||||
docParagraph.AppendChild(docRun);
|
||||
TableCell docCell = new TableCell();
|
||||
|
Loading…
Reference in New Issue
Block a user