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

Invalid table names lead to corrupted files #319

Closed
rotten opened this Issue Dec 17, 2015 · 3 comments

Comments

2 participants
@rotten

rotten commented Dec 17, 2015

Since you explicitly asked for examples that end up with corrupted (but reparable) xlsx files, here is an easy one to reproduce:

If you start with your example file: http://xlsxwriter.readthedocs.org/example_tables.html

And then name the empty data table on line 53 like this:

    worksheet1.add_table('B3:F7', {'name': 'test/broken'})

If you have a "/" in the name, as I do above, it will cause Excel to complain the file is corrupted.

[I'm using Excel for Mac version 15.16.]

@rotten

This comment has been minimized.

Show comment
Hide comment
@rotten

rotten Dec 17, 2015

Another, similar way to corrupt the xlsx is to give two of the tables (even though they are on different sheets) the same name:

worksheet1.add_table('B3:F7', {'name': 'test'})
worksheet2.add_table('B3:F7', {'data': data, 'name': 'test'})

Apparently names have to be globally unique - not just within a sheet.

rotten commented Dec 17, 2015

Another, similar way to corrupt the xlsx is to give two of the tables (even though they are on different sheets) the same name:

worksheet1.add_table('B3:F7', {'name': 'test'})
worksheet2.add_table('B3:F7', {'data': data, 'name': 'test'})

Apparently names have to be globally unique - not just within a sheet.

@jmcnamara

This comment has been minimized.

Show comment
Hide comment
@jmcnamara

jmcnamara Dec 18, 2015

Owner

Excel is very fussy about the allowable table names.

I'll put in some checks to make sure these types of error don't occur in future.

In the meantime point the gun a bit further away from your foot. ;-)

Owner

jmcnamara commented Dec 18, 2015

Excel is very fussy about the allowable table names.

I'll put in some checks to make sure these types of error don't occur in future.

In the meantime point the gun a bit further away from your foot. ;-)

@jmcnamara jmcnamara self-assigned this Dec 18, 2015

@jmcnamara jmcnamara changed the title from an easy way to corrupt an xlsx to Invalid table names lead to corrupted files Dec 18, 2015

jmcnamara added a commit that referenced this issue Jan 5, 2016

jmcnamara added a commit that referenced this issue Jan 6, 2016

@jmcnamara

This comment has been minimized.

Show comment
Hide comment
@jmcnamara

jmcnamara Jan 6, 2016

Owner

Both issues fixes in version 0.7.8, now on PyPi.

Thanks for the report.

Owner

jmcnamara commented Jan 6, 2016

Both issues fixes in version 0.7.8, now on PyPi.

Thanks for the report.

@jmcnamara jmcnamara closed this Jan 6, 2016

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment