QtXlsxWriter
QtXlsxWriter copied to clipboard
Error when delete sheet
When deleting a table, if the index of the table to be deleted is smaller than the index of the current table, the index of the current table will not change after deletion, which will cause the array to go out of range. To fix this bug,you need to add the change to activesheetIndex in the "deleteSheet" function of xlsxworkbook.cpp
bool Workbook::deleteSheet(int index)
{
Q_D(Workbook);
if (d->sheets.size() <= 1)
return false;
if (index < 0 || index >= d->sheets.size())
return false;
d->sheets.removeAt(index);
d->sheetNames.removeAt(index);
if(index <= d->activesheetIndex) d->activesheetIndex--;
return true;
}