Apache OpenOffice (AOO) Bugzilla – Issue 85423
storeAsURL for writer/web document into MS Word 97 (and less) produce corrupted document
Last modified: 2017-08-16 22:31:07 UTC
In case we need to save writer/web document (e.g. HTML) into MS Word (except MS Word 2003 XML) we got document that could be viewed and edited with Open Office, but wrong for Microsoft Office 2003 (maybe other versions too). This only happens if you do that in Basic or via API by methods storeToURL or storeAsURL. The problem discovered with following code: Sub SaveAs(cFilter As String, cSource As String, cTarget As String) cUrl = ConvertToURL( cSource ) oDoc = StarDesktop.LoadComponentFromURL(cUrl, "_blank", 0, _ Array(MakePropertyValue( "Hidden", True ),)) cUrl = ConvertToURL( cTarget ) oDoc.storeToURL( cUrl, Array( MakePropertyValue( "FilterName", cFilter ),)) oDoc.close( True ) End Sub Function MakePropertyValue( Optional cName As String, Optional uValue ) _ As com.sun.star.beans.PropertyValue Dim oPropertyValue As New com.sun.star.beans.PropertyValue If Not IsMissing( cName ) Then oPropertyValue.Name = cName EndIf If Not IsMissing( uValue ) Then oPropertyValue.Value = uValue EndIf MakePropertyValue() = oPropertyValue End Function The value for cFilter is "MS Word 97", cSource is filename of HTML document, cTarget is name of new file with extension .doc. I also check this behavior with JodConverter with same result. The document we got in result looks like normal. But if you open this document with MS Word you find set of ````` (depends on original text length) drew on window form without page (for Print layout). For Normal layout the text visible, but each character placed on separate line. Only in Outline layout the content visible as it should be. At the same time Open Office show the document without any artifacts. Moreover, it's not clear why API allows save writer/web document into MS Word document if UI limit me to do that. The bug was reproduced with Windows XP, Windows 2000 and Windows 2003 in Open Office v 2.0.4 and Open Office 2.2.1.
Created attachment 51043 [details] Converted document in MS Word 2003
Created attachment 51044 [details] Same document in Open Office
Created attachment 51045 [details] The MS Word document
Created attachment 51046 [details] and original HTML from wich MS document was created
The problem was applicable not only for case writer/web document that need to be saved to MS Word document. I also found that saving writer/web document into RTF produce absolutely wrong content. Transitional saving via ODT also not helps...
Reassigned to JSK
I found that partial solution for problem is using method insertDocumentFromUrl() to insert required document into blank and then save new document as we need.
This is more API like, forwarding to CN
cn->tl: for you
ups, wrong target
TL->HB: please have a look. Thanks!
not for me.
cn->tl: due to the fact of missing MS-Office I forward this Issue blindly.
jsk->tl: It would be pretty cool if you could have a look at this issue shortly so we at least could get a decent status other than "unconfirmed".
SBA: This issue has a target set but is still in state of "Unconfirmed". Please re-check with OOo 3.0 or younger if it is (still) valid. Then confirm it or set an appropriate resolution. Thank you.
Not time left to fix this one in OO0 3.1 because of other issues.
@ashtokalo: Can you please re-check with OOo 3.0 if the bug still occurs? And in case it still exists, can you please check if it goes away if you don't use the "Hidden" property when you load the document?
Sure, I will try to check the issue with OOo 3.0 this or next week.
Hi, any news?
No news from OP