Date: prev next · Thread: first prev next last


Hello Malte,

Welcome to the ODF Toolkit!

Tell us more about your use case of ODT creation.

The samples I am constantly using - to remind me how something is being
easily done - are the tests of ODFDOM:
https://github.com/tdf/odftoolkit/tree/master/odfdom/src/test/java/org/odftoolkit/odfdom
Sometimes, I do a string search over all java files ;-)

Note, that for instance if a new empty ODT is being created from the ODFDOM
API, an empty.odt zipped within the JAR is being loaded as default empty
ODT.
You might do the same way and start with a template that is closest to your
desired output.

There are two different ways to alter the content in ODFDOM:

   1. Traverse the DOM tree to alter things, the DOC API is already
   providing some higher level user API.
   2. An alternative to traversing the tree model is to inject XML by
   operations and certain positions based on user entities such as table,
   paragraph image.
   We added some change API based on these high-level operations for
   dealing with a web browser and its user changes.
   This change API is documented here:
   https://tdf.github.io/odftoolkit/odfdom/operations/operations.html
   Similar there are specific tests here:

   https://github.com/tdf/odftoolkit/tree/master/odfdom/src/test/java/org/odftoolkit/odfdom/changes


In a nutshell, the above represents the two views on a document and two
ways to represent the same document state:

   1. document state as a single document, representing the serialized
   (frozen) run-time model (latest document state) of an office application.
   Here serialized as zipped XML file(s) (standardized as OpenDocument
   format using for text the .odt suffix) ->
   https://tdf.github.io/odftoolkit/docs/presentations/character-styles.odt
   2. document state as a timely ordered sequence of user changes,
   representing the state changes made by the user in the office application.
   Here serialized as JSON, where in the following file every line is a
   user change (the real content is after styles, fonts, etc. - which might be
   separated in the future) ->
   https://tdf.github.io/odftoolkit/docs/presentations/character-styles.json

Both documents represent the same document state, contain the same
information set, and are thereby equivalent.

So pick your flavor in regard to your use case!

All the best,
Svante


Am Do., 26. Aug. 2021 um 10:01 Uhr schrieb Malte Stien <malte@stien.de>:

Hi there,

I am new here, so please be nice to me. I am trying to get my feet wet
with the programmatic creation of ODT text documents (after having used
Open/LibreOffice in the past). So, first of all, which version should I be
using? I am intending to use the for production level code. There seems to
be:

 - 0.8.8 (this one still has the Simple API it seems...
 - 0.9.0-RC1 (...which has the aforementioned deprecated)
 - 1.0.0-beta

I guess, I should avoid using the Simple API, right? I should be using the
ODFDOM API directly? So, is 0.9.0-RC1 stable enough?

I started using the publicly hosted java docs here:
https://odftoolkit.org/api/odfdom/index.html. What version are they for?
They are telling me the OdfTextDocument has been deprecated in favour of
"org.odftoolkit.simple.TextDocument in Simple API", but then again that has
been deprecated, right?

Assuming 0.9.0 is the way to go, are there any good tutorials out there
for creation of TextDocuments with the ODFDOM API.

Sorry for my newbie questions. I hope to be productive and more useful
soon.

Thank you,
Malte.


--
To unsubscribe e-mail to: dev+unsubscribe@odftoolkit.org
Problems?
https://www.libreoffice.org/get-help/mailing-lists/how-to-unsubscribe/
Posting guidelines + more: https://wiki.documentfoundation.org/Netiquette
List archive: https://listarchives.odftoolkit.org/dev/
Privacy Policy: https://www.documentfoundation.org/privacy



-- 
To unsubscribe e-mail to: dev+unsubscribe@odftoolkit.org
Problems? https://www.libreoffice.org/get-help/mailing-lists/how-to-unsubscribe/
Posting guidelines + more: https://wiki.documentfoundation.org/Netiquette
List archive: https://listarchives.odftoolkit.org/dev/
Privacy Policy: https://www.documentfoundation.org/privacy

Context


Privacy Policy | Impressum (Legal Info) | Copyright information: Unless otherwise specified, all text and images on this website are licensed under the Creative Commons Attribution-Share Alike 3.0 License. This does not include the source code of LibreOffice, which is licensed under the Mozilla Public License (MPLv2). "LibreOffice" and "The Document Foundation" are registered trademarks of their corresponding registered owners or are in actual use as trademarks in one or more countries. Their respective logos and icons are also subject to international copyright laws. Use thereof is explained in our trademark policy.