PIbd-22_Bazunov_A.I._SushiBar/SushiBar/SushiBarBusinessLogic/OfficePackage/AbstractSaveToWord.cs

46 lines
1.6 KiB
C#
Raw Normal View History

2023-03-12 20:49:40 +04:00
using SushiBarBusinessLogic.OfficePackage.HelpersEnum;
using SushiBarBusinessLogic.OfficePackage.HelpersModels;
namespace SushiBarBusinessLogic.OfficePackage
{
public abstract class AbstractSaveToWord
{
public void CreateDoc(WordInfo info)
{
CreateWord(info);
CreateParagraph(new WordParagraph
{
2023-03-14 10:12:32 +04:00
Texts = new List<(string, WordTextProperties)> {
(info.Title, new WordTextProperties { Bold = true, Size = "24", })
},
2023-03-12 20:49:40 +04:00
TextProperties = new WordTextProperties
{
Size = "24",
JustificationType = WordJustificationType.Center
}
});
2023-03-14 10:12:32 +04:00
foreach (var sushi in info.Sushi)
2023-03-12 20:49:40 +04:00
{
CreateParagraph(new WordParagraph
{
2023-03-14 10:12:32 +04:00
Texts = new List<(string, WordTextProperties)> {
(sushi.SushiName, new WordTextProperties { Bold = true, Size = "24" }),
($" {sushi.Price}", new WordTextProperties { Size = "24", JustificationType = WordJustificationType.Right }) },
2023-03-12 20:49:40 +04:00
TextProperties = new WordTextProperties
{
Size = "24",
JustificationType = WordJustificationType.Both
}
});
}
SaveWord(info);
}
protected abstract void CreateWord(WordInfo info);
protected abstract void CreateParagraph(WordParagraph paragraph);
protected abstract void SaveWord(WordInfo info);
}
}