Xlnt :: Исключение: плохой атрибутC++

Программы на C++. Форум разработчиков
Anonymous
Xlnt :: Исключение: плохой атрибут

Сообщение Anonymous »

Код: Выделить всё

    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.
Но, основываясь на документах xlnt-community:
https://xlnt-community.github.io/xlnt/c ... ad725ff208 функции alte alte ». src = "https://i.sstatic.net/vtkzy8po.png"/>
Обновление 1)
с:

Код: Выделить всё

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.
та же ошибка только с has_color () :

Код: Выделить всё

            if (cell.font().has_color())
{
std::cout 

Подробнее здесь: [url]https://stackoverflow.com/questions/79684631/xlntexception-bad-attribute[/url]

Вернуться в «C++»