Apache OpenOffice (AOO) Bugzilla – Issue 76704
Document variables in Word document get lost on import
Last modified: 2013-08-07 14:41:29 UTC
Writer imports document variables into the DocumentInfo of the ObjectShell. But after importing this object is copied over by the DocumentInfo of the SwDoc instance. Until now the variables didn't get lost because the copy method of SfxDocumentInfo had a bug and didn't copy the custom properties. Obviously fixing this bug broke the import. Easy fix: use the DocumentInfo of SwDoc for import.
Added keyword "regression".
Created attachment 44823 [details] proposed patch
Patch attached. As you can see the changes are in the Writer filter code, additionally sfx2 now will export a method that until now only was used only internally. The same method was used by the old code in Writer, but indirectly through the API that was used here.
Created attachment 44824 [details] corrected patch
Created attachment 44835 [details] Test deocument with document variables
Here's a simple basic macro to test if the fix works: info = ThisComponent.DocumentInfo props = info.PropertySetInfo.Properties for i=0 to UBOUND(props) if props(i).Name = "test1" then print info.test1 if props(i).Name = "test2" then print info.test2 if props(i).Name = "test3" then print info.test3 next i The macro should show "value1", "value2" and "value3". In OOo 2.2 nothing is shown.
Fixed in cws custompropsfix
Please verify
SBA: Verified in CWS custompropsfix.
SBA->MRU: PLease take over, thx.
Checked fix in OO 2.2.1 and OO 2.3 dev 680m221.