Created
July 9, 2015 21:13
-
-
Save kjosib/97564bb295dd6e7f3b7a to your computer and use it in GitHub Desktop.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
# CauseBug.py | |
# Run this program. Open the generated file ('bugged.xlsx') in Excel 2007, | |
# hide row 8 or something, and save it back again. Close it, and re-open. | |
# It will cause the graphic to disappear and be considered as "corruption". | |
import xlsxwriter | |
workbook = xlsxwriter.Workbook('bugged.xlsx') | |
sheet = workbook.add_worksheet('Sheet1') | |
## Please note: test.png is 208 x 49, made in ms-paint and arbitrary. | |
sheet.insert_image(0,10, 'test.png', {'x_offset':-210, 'y_offset':1}) | |
workbook.close() | |
## SENSITIVITY ANALYSIS: | |
# It seems to save OK if the x_offset is at least -207, which puts at least | |
# one pixel of the image within the host cell. |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment