I create a function to create a style to use for cells
xlnt::style ReportGenerator::getTitleStyle(xlnt::workbook& wb)
{
auto style = wb.create_style("title");
auto ft = xlnt::font();
ft.bold(true);
ft.size(24);
style.font(ft);
style.fill(xlnt::fill::solid(xlnt::color::green()));
style.alignment(xlnt::alignment().horizontal(xlnt::horizontal_alignment::center));
return style;
}
And I use this style like this: ws.cell("A1").style(titleStyle), the font and fill in the style is working, but the alignment in the style is not working, and if I add ws.cell("A1").aligment(xlnt::alignment().horizontal(xlnt::horizontal_alignment::center)) below the former code, the alignment of the cell is working. Do I miss something? or How should I make the alignment in the style working? Thank you!
Hi,
I create a function to create a style to use for cells
And I use this style like this:
ws.cell("A1").style(titleStyle)
, the font and fill in the style is working, but the alignment in the style is not working, and if I addws.cell("A1").aligment(xlnt::alignment().horizontal(xlnt::horizontal_alignment::center))
below the former code, the alignment of the cell is working. Do I miss something? or How should I make the alignment in the style working? Thank you!