diff options
author | Andras Timar <andras.timar@collabora.com> | 2014-10-25 21:47:55 +0200 |
---|---|---|
committer | Andras Timar <andras.timar@collabora.com> | 2014-10-25 23:58:01 +0200 |
commit | 3f5251675eeeeae56ea282fdeb09dbc53ce4aae6 (patch) | |
tree | 52e55ec1c4f6a01fe5243aaec0c5d8b13edadc63 /sc/source | |
parent | 863bed8dd4414e995eb59e868edc4ac94a085b34 (diff) |
bnc#893791 XLS export: external sheet references on Linux/OSX
The commit solves two problems.
1. Make sure we save absolute paths on Linux/OSX
2. Make sure we don't save invalid XLS (VirtualPath longer than 255 chars)
The first problem has always been there, so after a few load/save cycles
an XLS with reference to other XLS on a Unix-like file system became
invalid, and only LibreOffice could open it, Excel could not. These
broken XLS files can be repaired by saving after this patch, however,
the original reference will remain broken.
Change-Id: I8f575acb1d560d539c1da61a1afdaac3f0c13977
Diffstat (limited to 'sc/source')
-rw-r--r-- | sc/source/filter/excel/xehelper.cxx | 10 |
1 files changed, 10 insertions, 0 deletions
diff --git a/sc/source/filter/excel/xehelper.cxx b/sc/source/filter/excel/xehelper.cxx index 79da723f7a40..f58d19291866 100644 --- a/sc/source/filter/excel/xehelper.cxx +++ b/sc/source/filter/excel/xehelper.cxx @@ -908,6 +908,11 @@ OUString lclEncodeDosUrl( aBuf.append(EXC_URL_DOSDRIVE).append(cDrive); aOldUrl = aOldUrl.copy(3); } + else + { + // URL probably points to a document on a Unix-like file system + aBuf.append(EXC_URL_DRIVEROOT); + } // directories sal_Int32 nPos = -1; @@ -949,6 +954,11 @@ OUString lclEncodeDosUrl( if (pTableName) aBuf.append(*pTableName); + // VirtualPath must be shorter than 255 chars ([MS-XLS].pdf 2.5.277) + // It's better to truncate, than generate invalid file that Excel cannot open. + if (aBuf.getLength() > 255) + aBuf.setLength(255); + return aBuf.makeStringAndClear(); } |