diff --git a/Bank/BankBusinessLogic/BusinessLogic/ReportLogic.cs b/Bank/BankBusinessLogic/BusinessLogic/ReportLogic.cs
index 481dbbf..4a7a56a 100644
--- a/Bank/BankBusinessLogic/BusinessLogic/ReportLogic.cs
+++ b/Bank/BankBusinessLogic/BusinessLogic/ReportLogic.cs
@@ -76,7 +76,7 @@ namespace BankBusinessLogic.BusinessLogic
public void SaveTransfersToWordFile(ReportBindingModel model)
{
- _saveToWord.CreateDoc(new WordInfo
+ _saveToWord.CreateTransfersDoc(new WordInfo
{
FileName = model.FileName,
Title = "Список переводов",
diff --git a/Bank/BankBusinessLogic/OfficePackage/AbstractSaveToWord.cs b/Bank/BankBusinessLogic/OfficePackage/AbstractSaveToWord.cs
index 0cd7ba0..6918f02 100644
--- a/Bank/BankBusinessLogic/OfficePackage/AbstractSaveToWord.cs
+++ b/Bank/BankBusinessLogic/OfficePackage/AbstractSaveToWord.cs
@@ -11,39 +11,37 @@ namespace BankBusinessLogic.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
- }
- });
- foreach (var transfer in info.Transfers)
- {
- CreateParagraph(new WordParagraph
- {
- Texts = new List<(string, WordTextProperties)> { (transfer.CardNumber, new WordTextProperties { Size = "24", Bold = true}),
- (" - цена " + transfer.Transfers.ToString(), new WordTextProperties { Size = "24"})
- },
- TextProperties = new WordTextProperties
- {
- Size = "24",
- JustificationType = WordJustificationType.Both,
- }
- });
- }
- SaveWord(info);
- }
- ///
- /// Создание doc-файла
- ///
- ///
- protected abstract void CreateWord(WordInfo info);
+ public void CreateTransfersDoc(WordInfo info)
+ {
+ CreateWord(info);
+ List> list = new List>();
+ foreach (var shop in info.Shops)
+ {
+ var ls = new List
+ {
+ shop.ShopName,
+ shop.Address,
+ shop.DateOpen.ToShortDateString()
+ };
+ list.Add(ls);
+ }
+ var wordTable = new WordTable
+ {
+ Headers = new List {
+ "Название",
+ "Адрес",
+ "Дата открытия"},
+ Columns = 3,
+ RowText = list
+ };
+ CreateTable(wordTable);
+ SaveWord(info);
+ }
+ ///
+ /// Создание doc-файла
+ ///
+ ///
+ protected abstract void CreateWord(WordInfo info);
///
/// Создание абзаца с текстом
///
@@ -55,5 +53,8 @@ namespace BankBusinessLogic.OfficePackage
///
///
protected abstract void SaveWord(WordInfo info);
- }
+
+ protected abstract void CreateTable(WordTable table);
+
+ }
}
diff --git a/Bank/BankBusinessLogic/OfficePackage/HelperModels/WordTable.cs b/Bank/BankBusinessLogic/OfficePackage/HelperModels/WordTable.cs
new file mode 100644
index 0000000..c257442
--- /dev/null
+++ b/Bank/BankBusinessLogic/OfficePackage/HelperModels/WordTable.cs
@@ -0,0 +1,15 @@
+using System;
+using System.Collections.Generic;
+using System.Linq;
+using System.Text;
+using System.Threading.Tasks;
+
+namespace BankBusinessLogic.OfficePackage.HelperModels
+{
+ public class WordTable
+ {
+ public List Headers { get; set; } = new();
+ public List> RowText { get; set; } = new();
+ public int Columns { get; set; }
+ }
+}