This commit is contained in:
Pipiaka 2024-12-23 08:07:59 +04:00
parent 2af45433fa
commit 5c8d21f228

View File

@ -30,11 +30,11 @@ internal class ExcelBuilder
public ExcelBuilder AddHeader(string header, int startIndex, int count)
{
CreateCell(startIndex, _rowIndex, header,
StyleIndex.CenteredBoldTextWithBorders);
StyleIndex.BoldTextWithBorders);
for (int i = startIndex + 1; i < startIndex + count; ++i)
{
CreateCell(i, _rowIndex, "",
StyleIndex.CenteredBoldTextWithBorders);
StyleIndex.BoldTextWithBorders);
}
_mergeCells.Append(new MergeCell()
{
@ -46,7 +46,7 @@ internal class ExcelBuilder
public ExcelBuilder AddParagraph(string text, int columnIndex)
{
CreateCell(columnIndex, _rowIndex++, text,
StyleIndex.SimpleTextWithoutBorder);
StyleIndex.BoldTextWithoutBorder);
return this;
}
public ExcelBuilder AddTable(int[] columnsWidths, List<string[]> data)
@ -217,7 +217,35 @@ internal class ExcelBuilder
FillId = 0,
Alignment = new Alignment()
{
Horizontal = HorizontalAlignmentValues.Center,
Horizontal = HorizontalAlignmentValues.Left,
Vertical = VerticalAlignmentValues.Center,
WrapText = true
}
});
cellFormats.Append(new CellFormat
{
NumberFormatId = 2,
FormatId = 0,
FontId = 0,
BorderId = 1,
FillId = 0,
Alignment = new Alignment()
{
Horizontal = HorizontalAlignmentValues.Left,
Vertical = VerticalAlignmentValues.Center,
WrapText = true
}
});
cellFormats.Append(new CellFormat
{
NumberFormatId = 3,
FormatId = 0,
FontId = 1,
BorderId = 0,
FillId = 0,
Alignment = new Alignment()
{
Horizontal = HorizontalAlignmentValues.Left,
Vertical = VerticalAlignmentValues.Center,
WrapText = true
}
@ -227,7 +255,9 @@ internal class ExcelBuilder
private enum StyleIndex
{
SimpleTextWithoutBorder = 0,
CenteredBoldTextWithBorders = 1
BoldTextWithBorders = 1,
SimpleTextWithBorders = 2,
BoldTextWithoutBorder = 3
}
private void CreateCell(int columnIndex, uint rowIndex, string text, StyleIndex styleIndex)
{