为什么Apache POI能够编写超过255个字符的超链接,而不能编写XLSXWriter?

时间:2021-03-07 20:24:23

I'm trying to embed a bunch of URLs into an Excel file using Python with XLSXWriter's function write_url(), but it gives me the warning of it exceeding the 255 character limit. I think this is happening because it may be using the built-in HYPERLINK Excel function.

我尝试使用XLSXWriter的函数write_url()将一些url嵌入到Excel文件中,但是它会警告我它超过255个字符的限制。我认为这是因为它可能使用了内置的超链接Excel功能。

However, I found that Apache POI from Java doesn't seem to have that issue. Is it because they directly write it into the cell itself or is there a different reason? Also, is there a workaround in Python that can solve this issue?

然而,我发现来自Java的Apache POI似乎没有这个问题。是因为它们直接把它写进细胞本身还是有不同的原因?另外,在Python中是否有解决这个问题的方法?

2 个解决方案

#1


1  

Obviously the length limitation of a hyperlink address in .xlsx (using Excel 2013) is 2084 characters. Generating a file with a longer address using POI, repairing it with Excel and saving it will yield an address with a length of 2084 characters.

显然,在.xlsx(使用Excel 2013)中,超链接地址的长度限制为2084个字符。使用POI生成一个具有更长的地址的文件,使用Excel对其进行修复并保存,将生成一个长度为2084个字符的地址。

The Excel UI and .xls files seem to have a limit of 255 characters, as already mentioned by other commenters.

Excel UI和.xls文件似乎有255个字符的限制,其他评论者已经提到了这一点。

#2


0  

255 characters in a URL is an Excel 2007+ limitation. Try it in Excel.

URL中的255个字符是Excel 2007+的限制。试一试在Excel中。

I think the XLS format allowed longer URLs (so perhaps that is the difference).

我认为XLS格式允许更长的url(所以这可能就是区别所在)。

Also XlsxWriter doesn't use the HYPERLINK() function internally (although it is available to the user via the standard interface).

此外,XlsxWriter在内部也不使用超链接()函数(尽管用户可以通过标准界面获得它)。

#1


1  

Obviously the length limitation of a hyperlink address in .xlsx (using Excel 2013) is 2084 characters. Generating a file with a longer address using POI, repairing it with Excel and saving it will yield an address with a length of 2084 characters.

显然,在.xlsx(使用Excel 2013)中,超链接地址的长度限制为2084个字符。使用POI生成一个具有更长的地址的文件,使用Excel对其进行修复并保存,将生成一个长度为2084个字符的地址。

The Excel UI and .xls files seem to have a limit of 255 characters, as already mentioned by other commenters.

Excel UI和.xls文件似乎有255个字符的限制,其他评论者已经提到了这一点。

#2


0  

255 characters in a URL is an Excel 2007+ limitation. Try it in Excel.

URL中的255个字符是Excel 2007+的限制。试一试在Excel中。

I think the XLS format allowed longer URLs (so perhaps that is the difference).

我认为XLS格式允许更长的url(所以这可能就是区别所在)。

Also XlsxWriter doesn't use the HYPERLINK() function internally (although it is available to the user via the standard interface).

此外,XlsxWriter在内部也不使用超链接()函数(尽管用户可以通过标准界面获得它)。