Apache OpenOffice (AOO) Bugzilla – Issue 2916
WW: Export anchored to character as line anchored not para anchored.
Last modified: 2013-08-07 14:43:39 UTC
When a StarOffice 6.0 text document contains images with wrapped text (a good example is a converted web page), export to Microsoft Word 6, 95 and 97/2000/XP will result in a file where the images are displaced or missing and the text may be missing. The example was created by converting http://gofree.indigo.ie/nitz/Night_Photography.html to StarOffice 6 text, then to Microsoft word
Created attachment 973 [details] Document which does not export to any version of Microsoft word.
Created attachment 974 [details] resulting file when Night_Photography.sxw is exported as Microsoft word contains misplaced graphics and no text when read in.
erassigned
Reassigned to Michael.
MRU: The first two graphics are anchored "To character". On export their anchor moves to the upper left.
Damn. We aren't exporting anchored to character correctly to word format at all. It look so bad in this example because the whole page is one paragraph, all the line breaks are hard line breaks. All anchored to character anchors are being exported as anchored to (beginning of) paragraph
cmc->markm: precis; Anchored to character is getting the anchor exported at the beginning of the para, not at the appropiate position inside the para.
Having looked thorugh some of the code, the Attribute Iterator used by OutWW8_SwTxtNode does not recognise an anchored image as being an attribute of the character.
Created attachment 3081 [details] Initial patch
Attached an initial patch. Results seem promising. The anchor code, 0x08, appears in the correct place in the text stream. Independent of this fix is an apparent problem with the export of graphic properties. The position and relative anchor point (i.e. paragraph, page, character, etc.) are not being exported correctly. Will try to resolve before finally applying patch. The attached 'Initial Patch' works as follows: - OutWW8_SwTxtNode is called to write the contents of a paragraph. - MOD: The initial call to OutFlyFrms does *not* dump character anchored graphics. - NEW: As part of the constructor for the WW8_SwAttrIter object, a list of all fly frames (graphics) associated with the text node is gathered. - NEW: As part of the search for attributes within the text, graphics anchored within the paragraph are checked. The position of a graphic anchor may be returned as the location of the next attribute in the text. - CUR: The text is written up until the next attribute position. - NEW: As an attribute is written, if its position maps to that of a graphic, the graphic anchored to that position is mapped. Further modifications may be made to the way the searching of graphics anchored to the node are handled.
The major problem with the export of character anchored graphics is that there is no information for them in the export. The options for paragraph anchored and character anchored properties are for the most part the same, but paragraph anchored graphics don't have an option to anchor the graphic relative to a character. In WinwordAnchoring::SetAnchoring (wrtw8esh.cxx) the two are treated the same, but no information is present to handle export of anchoring that is relative to a character. Consequently, character anchored graphics that have a horizontal position relative to the character end up with a default of a left alignment relative to the page.
Tested with Night Photography (a version with all graphics embedded). Exports to Word relatively okay. Anchoring information is correct. Graphics are above text but that is due to Word's interpretation of what aligned bottom relative to page means. Only way to get exact match is to use absolute positioning in Word. This is something that cannot be calculated by Writer. Looking at other issues: - Export of vertical alignment, anchored to character 'from bottom' does not ahve a matching option in Word. Only Word alternative is to use absolute positioning. - Import of character anchored graphics has problems with vertical alignment. This is due to Writer's vertical character anchoring not having an option 'From Top' as paragraph anchored graphics do. Paragraph anchored graphics import correctly for all horizontal relative alignments. Will file a feature request to see if that functionality can be added to character anchored vertical alignments. Will clean up patch file and submit patch.
Created attachment 3131 [details] Updated Night_Photography with the images embedded in the file.
Created attachment 3165 [details] Patch for wrtw8esh.cxx and wrtw8nds.cxx resolving this issue.
Commited, SRX644 e or something like that will have it.
This is working well in SRX644f
mru->cmc: maybe the fix didn't make its way to the 644 set. I can see no difference between 641 and 644o.
cmc->mru: In SRC641u the Updated Night_Photography final .sxw attached here crashes office, I'll leave it to you to log a bug for that! My memory is that the SRC641 series would export these pictures all at the top left of the huge paragraph that is this document, i.e. anchored to paragraph, and there is only one paragraph. Not at various points in the document itself like the source. The SRX644(q2) will export these graphic anchored "to character" to the closest character which places the graphics close to where they appear in the sxw, which resolves this bug as much as is currently possible. Stack trace for SRC641q is as follows.... TL641MI! ImplStringLen(char const *) + 13 bytes TL641MI! String::String(char const *,unsigned short,unsigned long) + 171 bytes VCL641MI! operator>>(class SvStream &,class JobSetup &) + 479 bytes SFX641MI! SfxPrinter::Create(class SvStream &,class SfxItemSet *) + 55 bytes SW641MI! SwXDocumentSettings::_setSingleValue(struct comphelper::PropertyInfo const &,class com::sun::star::uno::Any const &) + 1209 bytes SW641MI! 21b0c19b() SW641MI! 21b0c19b() SW641MI! 21b03449() XO641MI! 22953b8c() XO641MI! 2295f856() SAX! XmlPrologStateInit + 5786 bytes SAX! XmlPrologStateInit + 5649 bytes SAX! XmlPrologStateInit + 5548 bytes SW641MI! 21b02bd9() SW641MI! 21b02c56() SW641MI! 21b02de1() SFX641MI! 01dd940d() SFX641MI! 01dd8bf8() SFX641MI! 01dcb424() SFX641MI! 01dcb576() SFX641MI! 01dcb576() SFX641MI! 01dcb31b() SFX641MI! 01dcfbc8() FWK641MI! 1e05bd46() FWK641MI! 1e05ca77() SFX641MI! 01dd55ba() SFX641MI! 01dcba1c() SFX641MI! 01dcbdd6() USER32! VRipOutput + 5101 bytes SOFFICE! 01122b28() VCL641MI! 004227c9() SOFFICE! 01122082() KERNEL32! ValidateLCType + 562 bytes
MRU->CMC: still one problem left: the two grphics at the end of the document (both anchored "AS character") are exported with their original size of 0,4cm*0,4cm; and not with the size stated in the properties
Incorrect graphic size must be the same thing as #108180#. i.e. working in SRX644m7 if you scroll through the entire document in writer before exporting to .doc. Or alternatively it should work with jollyfilterteam03
Anchor of graphics is now placed correctly.
Fix will be included in OO 1.1 Beta2 at least.
Closed. Fix available in OO 1.1 Beta2.