[Libreoffice] [PUSHED] Re: [PATCH] Fix field values in export to docx

Jan Holesovsky kendy at suse.cz
Fri Aug 5 17:15:22 PDT 2011

Hi Troy, Lubos,

Lubos Lunak píše v Pá 29. 07. 2011 v 19:52 +0200:

> > > > +        sExpand.SearchAndReplaceAll( 0x0A, 0x0B );
> > >
> > >  This line looks strange. What is the reason for this?
> >
> > You'll find the same pattern in the binary .doc import/export. Newlines
> > embedded in fields are 0x0B in .doc and 0x0A for us. Presumably the same
> > is true in .docx
>  I've noticed it in .doc as well, but .docx is XML, so this doesn't look right 
> there. That's why I'm asking if there's any specific reason for this.

Thank you very much for the patch! :-)  I've pushed that:


And added a comment:


And then thought a bit more; and the 0xa -> 0xb is really necessary.
The sExpand value goes to RunText, and only 0xb is handled as a newline
there, see void DocxAttributeOutput::RunText().  So in the end, I had to
push an amendment:


Maybe instead of converting the 0xa to 0xb we could update
DocxAttributeOutput::RunText(), but I think the conversion just in the
field output is safer, who knows what other 0xa's we could have that
should not be converted to newlines :-)


More information about the LibreOffice mailing list