32 lines
1.1 KiB
C#
Raw Normal View History

2023-04-11 08:33:53 +04:00
using DocumentFormat.OpenXml.Drawing;
using SushiBarBusinessLogic.OfficePackage.HelpersEnum;
2023-03-12 20:49:40 +04:00
using SushiBarBusinessLogic.OfficePackage.HelpersModels;
2023-04-11 08:33:53 +04:00
namespace SushiBarBusinessLogic.OfficePackage;
public abstract class AbstractSaveToWord
2023-03-12 20:49:40 +04:00
{
2023-04-11 08:33:53 +04:00
public void CreateDoc(WordInfo info)
2023-03-12 20:49:40 +04:00
{
2023-04-11 08:33:53 +04:00
CreateWord(info);
2023-03-12 20:49:40 +04:00
2023-04-11 08:33:53 +04:00
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();
2023-03-12 20:49:40 +04:00
2023-04-11 08:33:53 +04:00
CreateTable(rows);
SaveWord(info);
2023-03-12 20:49:40 +04:00
}
2023-04-11 08:33:53 +04:00
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);
}