PIbd-22-Stroev-V.M.-Plumbin.../PlumbingRepair/PlumbingRepairBusinessLogic/OfficePackage/AbstractSaveToWord.cs

48 lines
1.7 KiB
C#
Raw Normal View History

2024-03-27 11:04:28 +04:00
using PlumbingRepairBusinessLogic.OfficePackage.HelperEnum;
using PlumbingRepairBusinessLogic.OfficePackage.HelperModels;
using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using System.Threading.Tasks;
namespace PlumbingRepairBusinessLogic.OfficePackage
{
public abstract class AbstractSaveToWord
{
public void CreateDoc(WordInfo info)
{
CreateWord(info);
CreateParagraph(new WordParagraph
{
Texts = new List<(string, WordTextProperties)> { (info.Title, new
WordTextProperties { Bold = true, Size = "24", }) },
TextProperties = new WordTextProperties
{
Size = "24",
JustificationType = WordJustificationType.Center
}
});
2024-04-09 13:35:33 +04:00
foreach (var work in info.Works)
2024-03-27 11:04:28 +04:00
{
CreateParagraph(new WordParagraph
{
Texts = new List<(string, WordTextProperties)> {
2024-04-10 10:37:22 +04:00
(work.WorkName + " - ", new WordTextProperties { Size = "24", Bold = true, }),
(work.Price.ToString(), new WordTextProperties { Size = "24", }) },
2024-03-27 11:04:28 +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);
}
}