CourseWork_CompShop/ComputerShopProvider/ComputerShopBusinessLogic/OfficePackage/AbstractSaveToWord.cs

63 lines
2.3 KiB
C#
Raw Normal View History

2023-05-18 22:18:40 +04:00
using ComputerShopBusinessLogic.OfficePackage.HelperEnums;
using ComputerShopBusinessLogic.OfficePackage.HelperModels;
using System;
2023-04-09 16:55:38 +04:00
using System.Collections.Generic;
using System.Linq;
using System.Text;
using System.Threading.Tasks;
namespace ComputerShopBusinessLogic.OfficePackage
{
public class AbstractSaveToWord
{
2023-05-18 22:18:40 +04:00
public void CreateDoc(WordInfoProvider info)
{
2023-05-19 18:21:13 +04:00
CreateWord(info);
2023-05-18 22:18:40 +04:00
2023-05-19 18:21:13 +04:00
CreateParagraph(new WordParagraph
{
Texts = new List<(string, WordTextProperties)> { (info.Title, new WordTextProperties { Bold = true, Size = "24", }) },
TextProperties = new WordTextProperties
{
Size = "24",
JustificationType = WordJustificationType.Center
}
});
2023-05-18 22:18:40 +04:00
2023-05-19 18:21:13 +04:00
foreach (var mc in info.MemberConferences)
{
CreateParagraph(new WordParagraph
{
Texts = new List<(string, WordTextProperties)>
{ (mc.MemberFIO, new WordTextProperties { Size = "20", Bold=true})},
TextProperties = new WordTextProperties
{
Size = "24",
JustificationType = WordJustificationType.Both
}
});
2023-05-18 22:18:40 +04:00
2023-05-19 18:21:13 +04:00
foreach (var conference in mc.Conferences)
{
CreateParagraph(new WordParagraph
{
Texts = new List<(string, WordTextProperties)>
{ (conference.Item1 + " - ", new WordTextProperties { Size = "16", Bold=false}),
(conference.Item2.ToShortDateString(), new WordTextProperties { Size = "16", Bold=false})},
TextProperties = new WordTextProperties
{
Size = "24",
JustificationType = WordJustificationType.Both
}
});
}
}
SaveWord(info);
2023-05-18 22:18:40 +04:00
}
2023-05-19 18:21:13 +04:00
protected abstract void CreateWord(WordInfoOrganiser info);
protected abstract void CreateParagraph(WordParagraph paragraph);
protected abstract void SaveWord(WordInfoOrganiser info);
2023-04-09 16:55:38 +04:00
}
}