Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Error when delete sheet #220

Open
yzhperseverance opened this issue Feb 13, 2024 · 0 comments
Open

Error when delete sheet #220

yzhperseverance opened this issue Feb 13, 2024 · 0 comments

Comments

@yzhperseverance
Copy link

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;
 }
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

1 participant