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

write_url produces broken hyperlink #350

Closed
816-8055 opened this Issue Apr 27, 2016 · 5 comments

Comments

2 participants
@816-8055

816-8055 commented Apr 27, 2016

Hi,

I am using XlsxWriter to create an report file with links to problems in other excel documents.
Everything worked great, until i realized that some hyperlinks didn't work when there was a space in the name of a worksheet.

I am using Python version 3.4 and XlsxWriter 0.8.5 (freshly pulled from github) and Excel version 2013.

Here is some code that demonstrates the problem:

import xlsxwriter

filename = 'test.xlsx'

wb = xlsxwriter.Workbook(filename)

ws = wb.add_worksheet('other_sheet')
wb.add_worksheet('test sheet')

# normally one would use an internal link here, but for this demonstration i need an external link:
ws.write_url(0, 0, "external:{}#'test sheet'!A1".format(filename))  
wb.close()

I've already found the problem:
External links are escaped test.xlsx#test sheet!A1 becomes test.xlsx#test%20sheet!A1 which doesn't work. Excel 2013 would like to have test.xlsx#'test sheet'!A1.

@jmcnamara jmcnamara added the bug label Apr 27, 2016

@jmcnamara jmcnamara self-assigned this Apr 27, 2016

@jmcnamara

This comment has been minimized.

Show comment
Hide comment
@jmcnamara

jmcnamara Apr 27, 2016

Owner

Hi,

Thanks for the report.

That looks like a bug. I'll work on a fix in the next few days.

John

Owner

jmcnamara commented Apr 27, 2016

Hi,

Thanks for the report.

That looks like a bug. I'll work on a fix in the next few days.

John

@jmcnamara

This comment has been minimized.

Show comment
Hide comment
@jmcnamara

jmcnamara Apr 27, 2016

Owner

Just a note.

Your example could actually be an internal: link, which isn't broken:

import xlsxwriter

filename = 'test3.xlsx'

wb = xlsxwriter.Workbook(filename)

ws = wb.add_worksheet('other_sheet')
wb.add_worksheet('test sheet')

ws.write_url(0, 0, "internal:'test sheet'!A1")  
wb.close()

However, the external link anchor encoding is broken.

Owner

jmcnamara commented Apr 27, 2016

Just a note.

Your example could actually be an internal: link, which isn't broken:

import xlsxwriter

filename = 'test3.xlsx'

wb = xlsxwriter.Workbook(filename)

ws = wb.add_worksheet('other_sheet')
wb.add_worksheet('test sheet')

ws.write_url(0, 0, "internal:'test sheet'!A1")  
wb.close()

However, the external link anchor encoding is broken.

@jmcnamara

This comment has been minimized.

Show comment
Hide comment
@jmcnamara

jmcnamara Apr 27, 2016

Owner

I've pushed a fix for this issue to master.

Owner

jmcnamara commented Apr 27, 2016

I've pushed a fix for this issue to master.

@jmcnamara

This comment has been minimized.

Show comment
Hide comment
Owner

jmcnamara commented Apr 27, 2016

Fixed in version 0.8.6: http://xlsxwriter.readthedocs.io/changes.html

@jmcnamara jmcnamara closed this Apr 27, 2016

@816-8055

This comment has been minimized.

Show comment
Hide comment
@816-8055

816-8055 Apr 28, 2016

Thank you very much!
That's what I'd call a quick fix!

Thank you very much!
That's what I'd call a quick fix!

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