Hello Georg,

On Tue, Jan 12, 2016 at 11:50 AM, Georg Füchsle <[email protected]>
wrote:

> Hallo Wolf hallo Svante,
>
>
>
> thank You for your reply. Now we tested our created odf documents with
> different MS-Word versions. And we found out, that this problem exists in
> versions older than MS Word 2013.
>
> Unfortunately our customers will use these older versions.
>
>
>
> @Svante:
>
> After confirming the alert dialogs Ms Office displays the document in a
> correct way. But we don‘t want our customers to see this alerts.
>
>
> The clean way would indeed to fix the bad behavior of the Microsoft
office, the realistic one is to always remove the version attribute from
the manifest.


>
> In the created ODF-document we deleted the version-attribute in the
> manifest.xml by hand. In this way the alerts will not be displayed. Would
> there be an opportunity to set the version by the simpleOdfApi or by the
> ODFDOM-Api?
>

There is only one internal file format model in the ODF Toolkit for the the
latest version of the ODF XML grammar .
Just imagine in 100 years there might be dozen of ODF versions. Would it
make sense to have an internal model for each one of them or wouldn't be
the best thing to have transformations between the versions and focus on
the latest?

Unfortunately these transformations are neither specified nor implemented.
Therefore only the latest model is being used.

As I worked in different ODFDOM implementations, I am not 100% sure how it
react, when the model is saved, if:

   1. the ODF package is switched to the latest ODF version, only when
   something is changed
   2. always switched to the latest ODF version (my guess!)
   3. or the version is being kept in general

In your case you need to explicitly remove the version attribute from the
manifest.xml of valid ODF 1.2 files to satisfy your customer, unfortunately
making the documents invalid.
For instance, check yourself using our online validator
http://odf-validator.rhcloud.com/


>
>
> We also tried to use a odf-template-file, that we created in MS-Word 2010
> and save as  „*.odt“:
>
>
>
>            TextDocument target = TextDocument.*loadDocument*(
> "vorlageWord.odt");
>
>            Paragraph *firstPara* = target.getParagraphByIndex(0, *false*);
>
>            firstPara.appendTextContent("hello World");
>
>            target.save("C:/temp/odf/test.odt");
>
>
>
> Now this created file is opened in MS Word without problems. We would
> prefer this way. Will this work also, when we insert al lot of different
> formatted content ?
>
> To be honest, I doubt it. You likely have to remove the version from the
manifest from all documents you are saving..

Remember there are several locations of the version attribute, in all major
XML files, see
http://docs.oasis-open.org/office/v1.2/os/OpenDocument-v1.2-os-part1.html#attribute-office_version

and in the manifest.xml
http://docs.oasis-open.org/office/v1.2/os/OpenDocument-v1.2-os-part3.html#attribute-manifest_version_element-manifest_manifest

and for each embedded file
http://docs.oasis-open.org/office/v1.2/os/OpenDocument-v1.2-os-part3.html#attribute-manifest_version_element-manifest_file-entry
the latter should not be a problem and seldom used..

Kind regards,
Svante


>
> Best regards,
>
> Georg
>
>
>
>
>
>
>
>
>
>
>
> 2016-01-11 22:28 GMT+01:00 Svante Schubert <[email protected]>:
>
> > Hello Georg,
> >
> > I am not able to see the pictures, is MS Office "repairing" the document?
> > Have you compared the XML after the repair?
> > Microsoft once validated very strict against ODF 1.1 and when ODF 1.2
> added
> > a new version attribute it states the ODF is invalid.
> > Indeed sounds a little like one of those jokes with a Djinn..
> >
> > The common work around is to make the ODF 1.2 invalid and removing the
> > version attribute from the root XML element and avoiding the misleading
> > error message from Microsoft.
> >
> > Best regards,
> > Svante
> >
> >
> > On Fri, Jan 8, 2016 at 2:51 PM, Georg Füchsle <[email protected]>
> > wrote:
> >
> > > Hello,
> > >
> > >
> > >
> > > I’m a beginner with odf and try to create a small example odf-File
> using
> > > simple-odf  0.8.1:
> > >
> > >
> > >
> > > import org.odftoolkit.simple.TextDocument;
> > >
> > > private TextDocument target;
> > >
> > > …
> > >
> > >                     target = TextDocument.*newTextDocument*();
> > >
> > >                     target.addParagraph("hello world");
> > >
> > >                     target.save("C:/temp/odf/test.odt");
> > >
> > >
> > > When I open this file with MS Word 2010 (or 2007) then I get this
> > message:
> > >
> > >
> > > ​
> > >
> > >
> > > I press the button „ok“ and get this:
> > >
> > >
> > >
> > > ​
> > >
> > > When I press „Ja“, it looks good.
> > >
> > >
> > >
> > > ​
> > >
> > >
> > > When I use Apache OpenOffice 4, I don’t get an error and see the line
> > > correct.
> > >
> > > How can I avoid this errors?
> > >
> > >
> > > Our customers will use MS Word. For this reason we try to open it by MS
> > > Word too.
> > >
> >
>

Reply via email to