Date: prev next · Thread: first prev next last


Thank you for your delayed but appreciated reply.

> When OdfTextDocument.newTextDocument(); is called in fact the ODTD
> document within the JAR is being loaded.

Ok, so "default" styles are the one defined in the
odfdom/src/main/resources/OdfTextDocument.odt of the distribution. I
understand that names and defined styles are not guaranteed not to
change, so it would be better for me to provide my own model if I want
to ensure style names/definition stability. Am I correct ?

> There are in general three ways:
> 1. Creating the DOM XML manually from the dom package
> 2. Using some higher level functionality from the doc package

I overlooked these higher level functionalities.

I guess you are referring to classes like for instance
"org.odftoolkit.odfdom.dom.element.text.TextListLevelStyleElementBase" ?

Do these higher level classes rely on the default styles of the
odfdom/src/main/resources/OdfTextDocument.odt of the distribution beeing
used ?

> A good start is to look / grep over the tests.

Fine, I'll have a look at the tests.

Thanks!

V.







On 19/01/2024 22:48, Svante Schubert wrote:
this is the right place, but I have somehow overseen your email - I will
improve my mail filtering to highlight this list some more.




    Using odfdom, I created a numbered list this way (brackets added for
    readability) :

    OdfTextDocument odt = OdfTextDocument.newTextDocument();
    // ...
    {
             TextListElement ol0 =
    odt.getContentRoot().newTextListElement();
             ol0.setTextStyleNameAttribute("Numbering_20_1");
             {
                     TextListItemElement li = ol0.newTextListItemElement();
                     TextPElement p = li.newTextPElement();
                     p.setTextContent("item num 1")
             }
    }

    It works fine but leaves me with two questions :

    - Can I reliably rely on the existence of the "Numbering_20_1" (as well
    as other styles defined in the generated styles.xml) when a document is
    created from scratch using odfdom ?

When OdfTextDocument.newTextDocument(); is called in fact the ODTD
document within the JAR is being loaded.
See
https://github.com/tdf/odftoolkit/tree/master/odfdom/src/main/resources
<https://github.com/tdf/odftoolkit/tree/master/odfdom/src/main/resources>
In this case this ODT is loaded:
https://github.com/tdf/odftoolkit/blob/master/odfdom/src/main/resources/OdfTextDocument.odt 
<https://github.com/tdf/odftoolkit/blob/master/odfdom/src/main/resources/OdfTextDocument.odt>
Just looked it up, the answer is: yes! It is in the styles.xml :-)
You might create any ODF yourself and add it instead into the JAR or
load it by URL as the default (initial starting point).

    - When the "text:style-name" attribute of a "text:list" element is left
    unset, lowriter defaults to displaying a bullet list. Is this behavior
    standard, or should I set the "text:style-name" to a defined bullet list
    style like "List_20_1".

When no explicit style is set, there is still the default style for the
style family and a general default style before the application defaults
are kicking in.
But I also thought for a while it might be nice to have a style bundle
in the spec for ODF to refer only to that and/or create deltas from it.


    Or am I missing an easier way to create bullet/ordered lists altogether?

There are in general three ways:
1. Creating the DOM XML manually from the dom package
2. Using some higher level functionality from the doc package
3. Creating the document not by XML but by JSON Changes, see
https://tdf.github.io/odftoolkit/odfdom/operations/operations.html
<https://tdf.github.io/odftoolkit/odfdom/operations/operations.html>

A good start is to look / grep over the tests.


    Thanks!

    V.

Hope it was not too late to be of assistance, again sorry for the
belated reply!
Svante


    --
    To unsubscribe e-mail to: dev+unsubscribe@odftoolkit.org
    <mailto:dev%2Bunsubscribe@odftoolkit.org>
    Problems?
    https://www.libreoffice.org/get-help/mailing-lists/how-to-unsubscribe/ 
<https://www.libreoffice.org/get-help/mailing-lists/how-to-unsubscribe/>
    Posting guidelines + more:
    https://wiki.documentfoundation.org/Netiquette
    <https://wiki.documentfoundation.org/Netiquette>
    List archive: https://listarchives.odftoolkit.org/dev/
    <https://listarchives.odftoolkit.org/dev/>
    Privacy Policy: https://www.documentfoundation.org/privacy
    <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.