Adding user defined attributes to odt xml

Java, C++, C#, Delphi... - Using the UNO bridges
Post Reply
virtualj
Posts: 1
Joined: Wed May 14, 2008 9:19 pm

Adding user defined attributes to odt xml

Post by virtualj »

We are currently working on a java project to add concurrency control and locking for odt documents to open office.
But we are stuck on the problem of adding identifiers to elements in the odt xml representation.
Is there a way to use the api (java) to add an identifier attribute to, for example, a paragraph?
example: <text:p text:style-name="Text_20_body" text:my_id="123">This is a paragraph</text:p>
We have tried several approaches but there seems to be no good way to add your own attributes in the content.xml.
We have tried:
- We extracted the odt file and manually added an attribute to the content.xml file. But when you open and edit the odt file the attribute is removed.
- using metadata to keep the id, but the metadata can not be added to the different elements?
- I know there exists a UserDefinedAttributes but couldn't get it to work. Is it possible to use this to set and read the attributes?
- I tried to use the code from http://api.openoffice.org/servlets/Read ... sgNo=13957 but I couldn't get it to add the attributes to the right paragraph. And I did not find a way to read the data from the attributes with the api.
User avatar
Villeroy
Volunteer
Posts: 31269
Joined: Mon Oct 08, 2007 1:35 am
Location: Germany

Re: Adding user defined attributes to odt xml

Post by Villeroy »

Please, edit this topic's initial post and add "[Solved]" to the subject line if your problem has been solved.
Ubuntu 18.04 with LibreOffice 6.0, latest OpenOffice and LibreOffice
Post Reply