Coursach/Course/BusinessLogic/OfficePackage/AbstractSaveToWordGuarantor.cs

46 lines
1.2 KiB
C#

using BusinessLogic.OfficePackage.HelperEnums;
using BusinessLogic.OfficePackage.HelperModels;
using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using System.Threading.Tasks;
namespace BusinessLogic.OfficePackage
{
public abstract class AbstractSaveToWordGuarantor
{
public void CreateDoc(WordInfoGuarantor 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.Both
}
});
foreach (var report in info.Products)
{
CreateNumberedParagraph(1, 0, report.WorkerName);
foreach (var product in report.Products)
{
CreateNumberedParagraph(1, 1, product);
}
}
SaveWord(info);
}
protected abstract void CreateWord(WordInfoGuarantor info);
protected abstract void CreateParagraph(WordParagraph paragraph);
protected abstract void CreateNumberedParagraph(int numId, int ilvl, string text);
protected abstract void SaveWord(WordInfoGuarantor info);
}
}