32 lines
1.1 KiB
C#
32 lines
1.1 KiB
C#
using DocumentFormat.OpenXml.Drawing;
|
|
using SushiBarBusinessLogic.OfficePackage.HelpersEnum;
|
|
using SushiBarBusinessLogic.OfficePackage.HelpersModels;
|
|
|
|
namespace SushiBarBusinessLogic.OfficePackage;
|
|
|
|
public abstract class AbstractSaveToWord
|
|
{
|
|
public void CreateDoc(WordInfo info)
|
|
{
|
|
CreateWord(info);
|
|
|
|
var rows = info.Stores
|
|
.Select(store => CreateRow(
|
|
new List<TableCell?>()
|
|
{
|
|
CreateCell(new WordCell { Text = store.StoreName }),
|
|
CreateCell(new WordCell { Text = store.StoreAddress }),
|
|
CreateCell(new WordCell { Text = store.OpeningDate.ToShortDateString() })
|
|
})).ToList();
|
|
|
|
CreateTable(rows);
|
|
SaveWord(info);
|
|
}
|
|
|
|
protected abstract void CreateWord(WordInfo info);
|
|
protected abstract void CreateParagraph(WordParagraph? paragraph);
|
|
protected abstract void SaveWord(WordInfo info);
|
|
protected abstract void CreateTable(List<TableRow?>? rows);
|
|
protected abstract TableRow? CreateRow(List<TableCell?>? cells);
|
|
protected abstract TableCell? CreateCell(WordCell? cell);
|
|
} |