xlnt::workbook wb;
wb.load(WBurl);
auto ws = wb.active_sheet();
auto rows = ws.rows(false);
for (int i = 0; i < rows.length(); i++)
{
for (auto cell: rows[i])
{
xlnt::color cell_color = cell.font().color(); //
Я получаю это сообщение об ошибке: < /p>
Unhandled standard exception of type "N4xlnt17invalid_attributeE" with message
"xlnt::exception : bad attribute"; terminating the application.
for (auto& cell : row)
< /code>
Я получаю эту ошибку: < /p>
error: cannot bind non-const lvalue reference of type
‘xlnt::cell&’ to an rvalue of type
‘xlnt::cell_iterator::reference’ {aka ‘xlnt::cell’}
< /code>
Единственный способ не иметь такого рода ошибок: < /p>
for(auto row : rows)
{
for (auto cell : row)
{
}
}
< /code>
Но с: < /p>
xlnt::workbook wb;
wb.load(WBurl);
auto ws = wb.active_sheet();
auto rows = ws.rows(false);
for(auto row : rows)
{
for (auto cell : row)
{
if (cell.font().has_color())
{
xlnt::color cell_color = cell.font().color();
}
}
}
< /code>
Я все еще получаю ошибку: < /p>
Unhandled standard exception of type "N4xlnt17invalid_attributeE"
with message "xlnt::exception : bad attribute"; terminating the
application.
for (int i = 0; i < rows.length(); i++) { for (auto cell: rows[i]) { xlnt::color cell_color = cell.font().color(); // Я получаю это сообщение об ошибке: < /p> Unhandled standard exception of type "N4xlnt17invalid_attributeE" with message "xlnt::exception : bad attribute"; terminating the application. [/code] Но, основываясь на документах xlnt-community: https://xlnt-community.github.io/xlnt/classxlnt_1_1font.html#adefcdbf6c053764bb5a80fad725ff208 функции alte alte ». src = "https://i.sstatic.net/vtkzy8po.png"/> Обновление 1) с: [code]for (auto& cell : row) < /code> Я получаю эту ошибку: < /p> error: cannot bind non-const lvalue reference of type ‘xlnt::cell&’ to an rvalue of type ‘xlnt::cell_iterator::reference’ {aka ‘xlnt::cell’} < /code> Единственный способ не иметь такого рода ошибок: < /p> for(auto row : rows) { for (auto cell : row) {
} } < /code> Но с: < /p> xlnt::workbook wb; wb.load(WBurl); auto ws = wb.active_sheet(); auto rows = ws.rows(false);
for(auto row : rows) { for (auto cell : row) { if (cell.font().has_color()) { xlnt::color cell_color = cell.font().color(); } } } < /code> Я все еще получаю ошибку: < /p> Unhandled standard exception of type "N4xlnt17invalid_attributeE" with message "xlnt::exception : bad attribute"; terminating the application. [/code] та же ошибка только с has_color () : [code] if (cell.font().has_color()) { std::cout