Enhance notes format in Excel Report

This commit is contained in:
2024-02-10 10:37:51 +01:00
parent 52d2004915
commit 4b5d2b4f82
2 changed files with 10 additions and 4 deletions

View File

@@ -86,6 +86,7 @@ namespace platform {
} else if (name == "text") {
format_set_font_size(style, normalSize);
format_set_border(style, LXW_BORDER_THIN);
format_set_align(style, LXW_ALIGN_VERTICAL_CENTER);
} else if (name == "bodyHeader") {
format_set_bold(style);
format_set_font_size(style, normalSize);
@@ -118,7 +119,6 @@ namespace platform {
lxw_format* style;
for (std::string name : styleNames) {
lxw_format* style = workbook_add_format(workbook);
style = workbook_add_format(workbook);
createStyle(name, style, true);
styles[name + "_odd"] = style;
style = workbook_add_format(workbook);

View File

@@ -103,11 +103,17 @@ namespace platform {
}
lxw_format* style = NULL;
style = styles.at("text" + suffix);
worksheet_merge_range(notes_worksheet, row, 0, row, 1, r["dataset"].get<std::string>().c_str(), style);
if (row == 1) {
// Add header
worksheet_merge_range(notes_worksheet, 0, 0, 0, 1, "Dataset", styles["bodyHeader_even"]);
worksheet_merge_range(notes_worksheet, 0, 2, 0, 9, "Note", styles["bodyHeader_even"]);
}
auto initial_row = row;
for (const auto& note : r["notes"]) {
worksheet_merge_range(notes_worksheet, row, 2, row, 8, note.get<std::string>().c_str(), style);
worksheet_merge_range(notes_worksheet, row, 2, row, 9, note.get<std::string>().c_str(), style);
row++;
}
worksheet_merge_range(notes_worksheet, initial_row, 0, row - 1, 1, r["dataset"].get<std::string>().c_str(), style);
}
void ReportExcel::body()
@@ -128,7 +134,7 @@ namespace platform {
bool only_one_result = data["results"].size() == 1;
bool first_note = true;
lxw_worksheet* notes_worksheet;
int notes_row = 0;
int notes_row = 1;
for (const auto& r : data["results"]) {
writeString(row, col, r["dataset"].get<std::string>(), "text");
writeInt(row, col + 1, r["samples"].get<int>(), "ints");