Merge branch 'LabWork_3' into LabWork_4
This commit is contained in:
commit
4659147c9d
@ -31,7 +31,7 @@ internal class ExcelBuilder
|
|||||||
|
|
||||||
public ExcelBuilder AddHeader(string header, int startIndex, int count)
|
public ExcelBuilder AddHeader(string header, int startIndex, int count)
|
||||||
{
|
{
|
||||||
CreateCell(startIndex, _rowIndex, header, StyleIndex.SimpleTextWithoutBorder);
|
CreateCell(startIndex, _rowIndex, header, StyleIndex.BoldTextWithoutBorder);
|
||||||
for (int i = startIndex + 1; i < startIndex + count; ++i)
|
for (int i = startIndex + 1; i < startIndex + count; ++i)
|
||||||
CreateCell(i, _rowIndex, "", StyleIndex.SimpleTextWithoutBorder);
|
CreateCell(i, _rowIndex, "", StyleIndex.SimpleTextWithoutBorder);
|
||||||
|
|
||||||
@ -74,18 +74,18 @@ internal class ExcelBuilder
|
|||||||
}));
|
}));
|
||||||
|
|
||||||
for (var j = 0; j < data.First().Length; ++j)
|
for (var j = 0; j < data.First().Length; ++j)
|
||||||
CreateCell(j, _rowIndex, data.First()[j], StyleIndex.SimpleTextWithoutBorder);
|
CreateCell(j, _rowIndex, data.First()[j], StyleIndex.BoldTextWithBorder);
|
||||||
|
|
||||||
_rowIndex++;
|
_rowIndex++;
|
||||||
for (var i = 1; i < data.Count - 1; ++i)
|
for (var i = 1; i < data.Count - 1; ++i)
|
||||||
{
|
{
|
||||||
for (var j = 0; j < data[i].Length; ++j)
|
for (var j = 0; j < data[i].Length; ++j)
|
||||||
CreateCell(j, _rowIndex, data[i][j], StyleIndex.SimpleTextWithoutBorder);
|
CreateCell(j, _rowIndex, data[i][j], StyleIndex.SimpleTextWithBorder);
|
||||||
_rowIndex++;
|
_rowIndex++;
|
||||||
}
|
}
|
||||||
|
|
||||||
for (var j = 0; j < data.Last().Length; ++j)
|
for (var j = 0; j < data.Last().Length; ++j)
|
||||||
CreateCell(j, _rowIndex, data.Last()[j], StyleIndex.SimpleTextWithoutBorder);
|
CreateCell(j, _rowIndex, data.Last()[j], StyleIndex.BoldTextWithBorder);
|
||||||
|
|
||||||
_rowIndex++;
|
_rowIndex++;
|
||||||
return this;
|
return this;
|
||||||
@ -242,18 +242,18 @@ internal class ExcelBuilder
|
|||||||
WrapText = true
|
WrapText = true
|
||||||
}
|
}
|
||||||
});
|
});
|
||||||
// TODO дополнить форматы
|
|
||||||
workbookStylesPart.Stylesheet.Append(cellFormats);
|
workbookStylesPart.Stylesheet.Append(cellFormats);
|
||||||
}
|
}
|
||||||
|
|
||||||
private enum StyleIndex
|
private enum StyleIndex
|
||||||
{
|
{
|
||||||
SimpleTextWithoutBorder = 0,
|
SimpleTextWithoutBorder = 0,
|
||||||
// TODO дополнить стили
|
BoldTextWithoutBorder = 1,
|
||||||
|
SimpleTextWithBorder = 2,
|
||||||
|
BoldTextWithBorder = 3,
|
||||||
}
|
}
|
||||||
|
|
||||||
private void CreateCell(int columnIndex, uint rowIndex, string text,
|
private void CreateCell(int columnIndex, uint rowIndex, string text, StyleIndex styleIndex)
|
||||||
StyleIndex styleIndex)
|
|
||||||
{
|
{
|
||||||
var columnName = GetExcelColumnName(columnIndex);
|
var columnName = GetExcelColumnName(columnIndex);
|
||||||
var cellReference = columnName + rowIndex;
|
var cellReference = columnName + rowIndex;
|
||||||
|
Loading…
x
Reference in New Issue
Block a user