Header misaligned when saving file as a .doc file

The Application Programming Interface and the OASIS Open Document Format

Header misaligned when saving file as a .doc file

Postby sandyks » Thu Jun 26, 2014 9:48 am

Hello,

I have a scenario which was working in OOO 2.*, but doens't seem to be working in OOO 3.*.

The question is posted in the following link. https://forum.openoffice.org/en/forum/viewtopic.php?f=7&t=70632&p=316412#p316412

Will Briefly describe the problem here.

I have a code snippet which prepares data, uses a templates(*.doc) and replaces the data with the necessary contents. Once done the file is saved as *.doc.
Earlier(in OOO 2.*) the file was saving as expected and the header was aligned as expected. Now( in OOO 3.*) the header is getting misaligned.

I can resolve the issue by saving the file as .odt and then convert into *.doc as opposed to directly saving as *.doc, but the file cannot be opened using Microsoft 2007. I get the following error "Word cannot start the converter mswrd632.wpc". Though that can also be resolved by deleting a registry entry, I do not wanna do that as many other windows based apps run on the machine and the after effects could be anything.

The file is being generated using a java code and have pasted the snippet below.
Code: Select all   Expand viewCollapse view

XComponent document= doc.createDoc("***", templateDir+"/"+templateLocName,***,****,AsOfDate);
XStorable storable = (XStorable) UnoRuntime.queryInterface(XStorable.class, document);

PropertyValue[] properties = new PropertyValue[2];
PropertyValue p = new PropertyValue();
p.Name = "FilterName";
p.Value = format.getFormatCode(); 
properties[0] = p;
           
String loadURL = "file:///"+System.getProperty("*******")+"/"+fileName;
storable.storeToURL(loadURL, properties);   


I need to find an alternative wherein the *.doc file gets saved without the header misalignment and also it should open using Windows 2007.

Can anyone who have faced the issue please help me out here. The suggestions mentioned in the above mentioned link does not work.
OpenOffice 3.3, Windows 7, Linux.
sandyks
 
Posts: 11
Joined: Wed Jan 23, 2013 8:06 am

Re: Header misaligned when saving file as a .doc file

Postby Villeroy » Thu Jun 26, 2014 1:42 pm

Does the problem occur when you save the same document as ODF text? Word 2007 can open ODF.

When you open the .doc in OpenOffice or WinWord, what are the steps to fix the misalignment in the GUI? Does this give any clue how to avoid the problem?

WinWord is the one and only program which can produce 99% perfect WinWord documents. Therefore you should use WinWord and nothing but WinWord as a document generator for WinWord documents.
Please, edit this topic's initial post and add "[Solved]" to the subject line if your problem has been solved.
Ubuntu 18.04, no OpenOffice, LibreOffice 6.4
User avatar
Villeroy
Volunteer
 
Posts: 27760
Joined: Mon Oct 08, 2007 1:35 am
Location: Germany

Re: Header misaligned when saving file as a .doc file

Postby sandyks » Thu Jun 26, 2014 2:58 pm

I haven't tried storing the file as odf and then trying to open the same. Can you please let me know what filter name I can use in the java code to save the file as a .odf file in the proper format.

In the GUI to fix the misalignment I am adding a newline at the top of the file, since the header seems to be gone.
OpenOffice 3.3, Windows 7, Linux.
sandyks
 
Posts: 11
Joined: Wed Jan 23, 2013 8:06 am


Return to UNO API and ODF

Who is online

Users browsing this forum: No registered users and 1 guest