Where to save private formatting data

I have some Writer documents which need to contain some XML-formatted information. The documents will be created by a document generator. The document generator needs to save this data somewhere inside the document which it is generating, so it can be re-generated if required. Exact format of the XML isn’t important - just how and where to save it.

In an MS Word implmentation, the XML is stored in a CustomProperties field.

What is the recommended place to save this kind if information in Writer documents?

The data isn’t secret, it’s just not something I need the reader to see, and I certainly don’t want them to accidentally modify or delete it.

Edit your question to give more details. Always mention OS and LO version.

What is this XML data? Something you put there to modify Writer formatting?

What is your workflow? You say there is a document generator. How is it related to Writer? Is the Writer document content an input to some other application? Explain how you transfer data into this application and how it filters “text already formatted” from its own input directives (presumably the XML).

Please do not use Add Answer but edit your original question to enhance the details of your question (answers are reserved for solutions to a problem on this Q&A site).

The document generator needs to save this data … so it can be re-generated

There are many ways to store “invisible” data. But it isn’t useful if it can’t be extracted. How is this data supposed to be read? Do you save your document as .doc(x) or .odt? Does the document generator understand ODF (.odt)?

Any way the “technical data” is saved in a Writer document, if the application does not know how to retrieve it, it is no use. Describe the input of the doc generator: text file, formatted document like .docx or .odt, …? Should this data be at head, tail or middle (=don’t care) of the document?

Maybe I didn’t make it clear that the additional data is to be written AND READ by the generator. What would be the point of invisible, write-only data? Of course it’s useful - that’s why I want to save it. It’s just not useful to the reader of the document, just to my generator.

By “invisible”, I meant hidden to the human user reading the document.

Then how does the generator write the data (and the content too)? Does it output ODF XML as an .fodt file? In which case if user is not allowed to make changes (and Writer will not rewrite the file), you can put your data inside an XML comment.

But if users can modify the text (proof-reading and editing), you can do the same as in M$ Word, put this data in a File>Properties, Custom Properties.

Ah - there are custom properties - perfect solution. I will investigate.

The RDFRepository of te document should be what you need.
Unfortunately I cannot point you to a related tutorial or the like. If I needed the feature, I would have to study all what I could get from LibreOffice: Repository Service Reference an the links found there.
The structure of RDF entries,however, should be as spcified by W3C.

If your “private data” are concerning specific objects, you may look if the object type has UserdefinedAttributs. many have.

1 Like

Thanks a lot - I’ll investigate that! I’ll update here once I know more.