This commit is contained in:
Artyom_Yashin 2024-05-26 16:28:49 +04:00
commit 3a9eb0de13
3 changed files with 74 additions and 15 deletions

View File

@ -89,7 +89,7 @@ namespace BankBusinessLogic.BusinessLogic
public void SaveTransfersToExcelFile(ReportBindingModel model)
{
_saveToExcel.CreateDoc(new ExcelInfo
_saveToExcel.CreateTransfersDoc(new ExcelInfo
{
FileName = model.FileName,
Title = "Список переводов",

View File

@ -11,11 +11,7 @@ namespace BankBusinessLogic.OfficePackage
{
public abstract class AbstractSaveToExcel
{
/// <summary>
/// Создание отчета
/// </summary>
/// <param name="info"></param>
public void CreateDoc(ExcelInfo info)
public void CreateRequestsDoc(ExcelInfo info)
{
CreateExcel(info);
InsertCellInWorksheet(new ExcelCellParameters
@ -78,12 +74,76 @@ namespace BankBusinessLogic.OfficePackage
rowIndex++;
}
SaveExcel(info);
}
/// <summary>
/// Создание excel-файла
/// </summary>
/// <param name="info"></param>
protected abstract void CreateExcel(ExcelInfo info);
}
public void CreateTransfersDoc(ExcelInfo info)
{
CreateExcel(info);
InsertCellInWorksheet(new ExcelCellParameters
{
ColumnName = "A",
RowIndex = 1,
Text = info.Title,
StyleInfo = ExcelStyleInfoType.Title
});
MergeCells(new ExcelMergeParameters
{
CellFromName = "A1",
CellToName = "C1"
});
uint rowIndex = 2;
foreach (var transfer in info.Transfers)
{
InsertCellInWorksheet(new ExcelCellParameters
{
ColumnName = "A",
RowIndex = rowIndex,
Text = "",
StyleInfo = ExcelStyleInfoType.Text
});
rowIndex++;
foreach (var component in transfer.Transfers)
{
InsertCellInWorksheet(new ExcelCellParameters
{
ColumnName = "B",
RowIndex = rowIndex,
Text = "",
StyleInfo =
ExcelStyleInfoType.TextWithBroder
});
InsertCellInWorksheet(new ExcelCellParameters
{
ColumnName = "C",
RowIndex = rowIndex,
Text = "",
StyleInfo =
ExcelStyleInfoType.TextWithBroder
});
rowIndex++;
}
InsertCellInWorksheet(new ExcelCellParameters
{
ColumnName = "A",
RowIndex = rowIndex,
Text = "Итого",
StyleInfo = ExcelStyleInfoType.Text
});
InsertCellInWorksheet(new ExcelCellParameters
{
ColumnName = "C",
RowIndex = rowIndex,
Text = "",
StyleInfo = ExcelStyleInfoType.Text
});
rowIndex++;
}
SaveExcel(info);
}
/// <summary>
/// Создание excel-файла
/// </summary>
/// <param name="info"></param>
protected abstract void CreateExcel(ExcelInfo info);
/// <summary>
/// Добавляем новую ячейку в лист
/// </summary>

View File

@ -38,8 +38,7 @@ namespace BankBusinessLogic.OfficePackage
CreateTable(wordTable);
SaveWord(info);
}
public void CreateTransfersDoc(WordInfo info)
public void CreateTransfersDoc(WordInfo info)
{
CreateWord(info);
List<List<string>> list = new List<List<string>>();
@ -49,7 +48,7 @@ namespace BankBusinessLogic.OfficePackage
{
shop.ShopName,
shop.Address,
shop.DateOpen.ToShortDateString()
shop.OpeningDate.ToShortDateString()
};
list.Add(ls);
}