68 lines
1.4 KiB
C#
68 lines
1.4 KiB
C#
using BankBusinessLogic.OfficePackage.HelperEnums;
|
|
using BankBusinessLogic.OfficePackage.HelperModels;
|
|
|
|
namespace BankBusinessLogic.OfficePackage
|
|
{
|
|
public abstract class AbstractSaveToExcel
|
|
{
|
|
public void CreateReport(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 rec in info.DepositsPrograms)
|
|
{
|
|
InsertCellInWorksheet(new ExcelCellParameters
|
|
{
|
|
ColumnName = "A",
|
|
RowIndex = rowIndex,
|
|
Text = rec.DepositId.ToString(),
|
|
StyleInfo = ExcelStyleInfoType.Text
|
|
});
|
|
|
|
rowIndex++;
|
|
|
|
foreach (var service in rec.Programs)
|
|
{
|
|
InsertCellInWorksheet(new ExcelCellParameters
|
|
{
|
|
ColumnName = "B",
|
|
RowIndex = rowIndex,
|
|
Text = service.ProgramName,
|
|
StyleInfo = ExcelStyleInfoType.TextWithBroder
|
|
});
|
|
|
|
rowIndex++;
|
|
}
|
|
|
|
rowIndex++;
|
|
}
|
|
|
|
SaveExcel(info);
|
|
}
|
|
|
|
protected abstract void CreateExcel(ExcelInfo info);
|
|
|
|
protected abstract void InsertCellInWorksheet(ExcelCellParameters excelParams);
|
|
|
|
protected abstract void MergeCells(ExcelMergeParameters excelParams);
|
|
|
|
protected abstract void SaveExcel(ExcelInfo info);
|
|
}
|
|
}
|