Bug 52576 - [PATCH] Change external file reference while preserving the formular itself
Summary: [PATCH] Change external file reference while preserving the formular itself
Status: RESOLVED FIXED
Alias: None
Product: POI
Classification: Unclassified
Component: HSSF (show other bugs)
Version: 3.7-FINAL
Hardware: PC All
: P2 normal (vote)
Target Milestone: ---
Assignee: POI Developers List
URL:
Keywords: PatchAvailable
Depends on:
Blocks:
 
Reported: 2012-02-01 22:58 UTC by SunGard Global Services Germany
Modified: 2012-02-10 08:27 UTC (History)
0 users



Attachments
changeExternalReference.patch - Patch to implement this feature (6.06 KB, application/octet-stream)
2012-02-01 22:58 UTC, SunGard Global Services Germany
Details
changeExternalReference.patch - Patch to implement this feature (7.84 KB, text/plain)
2012-02-01 23:06 UTC, SunGard Global Services Germany
Details
ChangeExternalReferenceWithTest.patch (12.99 KB, patch)
2012-02-07 22:09 UTC, SunGard Global Services Germany
Details | Diff

Note You need to log in before you can comment on or make changes to this bug.
Description SunGard Global Services Germany 2012-02-01 22:58:15 UTC
Created attachment 28249 [details]
changeExternalReference.patch - Patch to implement this feature

In our setup, we have a main XLS which references other (>10) XLS files.
The original author of the main XLS referenced some dummy files to create the formulars in the main XLS.

During our program execution, we generate the "real" XLS files with should be referenced by the main XLS.
The formular itself shouldn't be changed.


The attached patch introduces a new public method on HSSFWorkbook (As the OOXML is completly different and not in our scope I skipped it).

This allows the caller to change the file reference while preserving the formular itself.

As the file-notation is quite strange in the XLS lookup table I'm not 100% sure wether all kind of absolute/relative paths are interpreted corretly.
I tested with
* Relative paths
* Absolute paths with windows drive letters
* Absolute paths with windows UNC path (\\server\share)

I have not signed any kind of NDA from Microsoft and used only the public availible file format information.
Comment 1 SunGard Global Services Germany 2012-02-01 23:06:40 UTC
Created attachment 28250 [details]
changeExternalReference.patch - Patch to implement this feature

SVN diff patch
Comment 2 Yegor Kozlov 2012-02-03 10:14:51 UTC
Please provide unit tests, both low-level for SupBookRecord and usermodel-level that involve calling HSSFWorkbook.changeExternalReference(). If the test requires input workbooks then attach them too.

Regards,
Yegor
Comment 3 SunGard Global Services Germany 2012-02-07 22:09:21 UTC
Created attachment 28280 [details]
ChangeExternalReferenceWithTest.patch

Please find attached the patch applied against the latest SVN revision (trunk).

It includes the feature and unit tests for the user model and the internal translation logic.
Comment 4 Yegor Kozlov 2012-02-10 08:27:25 UTC
Thanks for the patch, applied in r1242701

Regards,
Yegor