Date: prev next · Thread: first prev next last


Hi Vivien,

On Wed, 1 Nov 2023 at 15:34, vivien guillet <vgu@gmx.fr> wrote:

Hi

(I hope this is the right place to post this.)

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
In this case this ODT is loaded:
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

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
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.