две колонки хедеров
This commit is contained in:
parent
fc113983ea
commit
c17a7faddc
@ -87,14 +87,15 @@ namespace ExexForm2
|
||||
};
|
||||
|
||||
var headers = new List<string> { "First Name", "Last Name", "Age" };
|
||||
var commonHeaders = new List<string> { "Name", "", "" };
|
||||
var propertyNames = new List<string> { "FirstName", "LastName", "Age" };
|
||||
var rowHeights = new List<double> { 20, 20 };
|
||||
var mergeCells = new List<(int startRow, int endRow, int startColumn, int endColumn)>
|
||||
{
|
||||
//(0, 0, 0, 1) // Îáúåäèíåíèå ïåðâûõ äâóõ ñòîëáöîâ â ïåðâîé ñòðîêå
|
||||
};
|
||||
(0, 1, 0, 0) // 0 è 1 ÿ÷åéêè ïî âåðòèêàëè ïåðâîé êîëîíêè
|
||||
};
|
||||
|
||||
generator.GeneratePdf(fileName, "Example Document", mergeCells, rowHeights, headers, propertyNames, data1);
|
||||
generator.GeneratePdf(fileName, "Example Document", mergeCells, rowHeights, headers, commonHeaders, propertyNames, data1);
|
||||
}
|
||||
}
|
||||
}
|
@ -18,6 +18,7 @@ namespace Library14Petrushin
|
||||
List<(int startRow, int endRow, int startColumn, int endColumn)> mergeCells,
|
||||
List<double> rowHeights,
|
||||
List<string> headers,
|
||||
List<string> commonHeaders,
|
||||
List<string> propertyNames,
|
||||
List<T> data)
|
||||
{
|
||||
@ -58,6 +59,15 @@ namespace Library14Petrushin
|
||||
double columnWidth = (page.Width - 2 * margin) / (headers.Count + 1); // Ширина столбца
|
||||
|
||||
// Отрисовка шапки
|
||||
|
||||
for (int col = 0; col < commonHeaders.Count; col++)
|
||||
{
|
||||
gfx.DrawString(commonHeaders[col], font, XBrushes.Black, new XRect(x, y + col * rowHeight, columnWidth, rowHeight), XStringFormats.CenterLeft);
|
||||
gfx.DrawRectangle(XPens.Black, new XRect(x, y + col * rowHeight, columnWidth, rowHeight)); // Добавляем рамку
|
||||
}
|
||||
|
||||
x += columnWidth;
|
||||
|
||||
for (int col = 0; col < headers.Count; col++)
|
||||
{
|
||||
gfx.DrawString(headers[col], font, XBrushes.Black, new XRect(x, y + col * rowHeight, columnWidth, rowHeight), XStringFormats.CenterLeft);
|
||||
|
Loading…
x
Reference in New Issue
Block a user