Enhance notes format in Excel Report
This commit is contained in:
@@ -86,6 +86,7 @@ namespace platform {
|
|||||||
} else if (name == "text") {
|
} else if (name == "text") {
|
||||||
format_set_font_size(style, normalSize);
|
format_set_font_size(style, normalSize);
|
||||||
format_set_border(style, LXW_BORDER_THIN);
|
format_set_border(style, LXW_BORDER_THIN);
|
||||||
|
format_set_align(style, LXW_ALIGN_VERTICAL_CENTER);
|
||||||
} else if (name == "bodyHeader") {
|
} else if (name == "bodyHeader") {
|
||||||
format_set_bold(style);
|
format_set_bold(style);
|
||||||
format_set_font_size(style, normalSize);
|
format_set_font_size(style, normalSize);
|
||||||
@@ -118,7 +119,6 @@ namespace platform {
|
|||||||
lxw_format* style;
|
lxw_format* style;
|
||||||
for (std::string name : styleNames) {
|
for (std::string name : styleNames) {
|
||||||
lxw_format* style = workbook_add_format(workbook);
|
lxw_format* style = workbook_add_format(workbook);
|
||||||
style = workbook_add_format(workbook);
|
|
||||||
createStyle(name, style, true);
|
createStyle(name, style, true);
|
||||||
styles[name + "_odd"] = style;
|
styles[name + "_odd"] = style;
|
||||||
style = workbook_add_format(workbook);
|
style = workbook_add_format(workbook);
|
||||||
|
@@ -103,11 +103,17 @@ namespace platform {
|
|||||||
}
|
}
|
||||||
lxw_format* style = NULL;
|
lxw_format* style = NULL;
|
||||||
style = styles.at("text" + suffix);
|
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"]) {
|
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++;
|
row++;
|
||||||
}
|
}
|
||||||
|
worksheet_merge_range(notes_worksheet, initial_row, 0, row - 1, 1, r["dataset"].get<std::string>().c_str(), style);
|
||||||
}
|
}
|
||||||
|
|
||||||
void ReportExcel::body()
|
void ReportExcel::body()
|
||||||
@@ -128,7 +134,7 @@ namespace platform {
|
|||||||
bool only_one_result = data["results"].size() == 1;
|
bool only_one_result = data["results"].size() == 1;
|
||||||
bool first_note = true;
|
bool first_note = true;
|
||||||
lxw_worksheet* notes_worksheet;
|
lxw_worksheet* notes_worksheet;
|
||||||
int notes_row = 0;
|
int notes_row = 1;
|
||||||
for (const auto& r : data["results"]) {
|
for (const auto& r : data["results"]) {
|
||||||
writeString(row, col, r["dataset"].get<std::string>(), "text");
|
writeString(row, col, r["dataset"].get<std::string>(), "text");
|
||||||
writeInt(row, col + 1, r["samples"].get<int>(), "ints");
|
writeInt(row, col + 1, r["samples"].get<int>(), "ints");
|
||||||
|
Reference in New Issue
Block a user