OASIS Open Document Format for Office Applications (OpenDocument) TC

  • 1.  How to number a heading?

    Posted 05-09-2017 15:03
    Hi all, you can number a heading by setting text:ouline-level in the <text:h> element and no list style in its paragraph style. Then the number is taken from 16.34 <text:outline-style>. Its description is, "An outline style is a list style that is applied to all headings within a text document where the heading's paragraph style does not define a list style to use itself." But if you need a different numbering parallel, e.g. for an appendix, you can not use a second <text:outline-style> element, because more than one is not allowed. So how to get a number in such case? I define a numbering style <text:list-style style:name="MyChapter"> with its <text:list-level-style-number> childs for the different text:level, e.g. <text:list-level-style-number text:level="2" text:style-name="Numbering_20_Symbols" style:num-prefix="(" style:num-suffix=")" style:num-format="a"> <style:list-level-properties ... </text:list-level-style-number> Then I define a paragraph style, which uses this numbering style, e.g. <style:style style:name="myH2" style:family="paragraph" style:parent-style-name="Standard" style:default-outline-level="2" style:list-style-name="MyChapter"> And the heading itself is given by <text:h text:style-name="myH2" text:outline-level="2">Heading on level two</text:h> Should that generate a number for the heading? I would say yes, but LibreOffice generates no number here. I try to examine, whether this is a bug or not. Looking at the description of 19.496 style:list-style-name, I see, "The list style specified by this attribute is applied to headings and paragraphs that are contained in a list, where the list does not specify a list style itself, and the list has no list style specification for any of its parents." My heading is not contained in a list. Does it get a number nevertheless? If yes, does the level of numbering corresponds to the outline level? LibreOffice puts the heading into a list automatically. But that produces the questions: Which level of numbering has to be used? The list level or the outline level? Or must list level and outline level always be equal? LibreOffice uses the list level here and does not keep outline level in sync with list level, which produces a lot of problems for users. Is there a different way I do not see, to get a chapter numbering to a heading, which does not use the <text:outline-style> element? Kind regards Regina


  • 2.  Re: [office] How to number a heading?

    Posted 05-22-2017 13:32
    Hello Regina, Can you add an example of what you want to achieve visually and reason back from that? When reading your description, it's not always clear to me when you talk about a number and when about a number *style*. No showing a number is also a style. text:outline-level gives the number. The way that that number is displayed is determined by the active style. style:default-outline-level="2" is only relevant when you do not want to set text:outline-level explicitly. I've attached a file that I experimented with. It does not show heading numbers in LibreOffice. Cheers, Jos On 09-05-17 17:02, Regina Henschel wrote: > Hi all, > > you can number a heading by setting text:ouline-level in the <text:h> > element and no list style in its paragraph style. Then the number is > taken from 16.34 <text:outline-style>. Its description is, > "An outline style is a list style that is applied to all headings within > a text document where the heading's paragraph style does not define a > list style to use itself." > > But if you need a different numbering parallel, e.g. for an appendix, > you can not use a second <text:outline-style> element, because more than > one is not allowed. So how to get a number in such case? > > > I define a numbering style > <text:list-style style:name="MyChapter"> > with its <text:list-level-style-number> childs for the different > text:level, e.g. > <text:list-level-style-number text:level="2" > text:style-name="Numbering_20_Symbols" style:num-prefix="(" > style:num-suffix=")" style:num-format="a"> > <style:list-level-properties ... > </text:list-level-style-number> > > Then I define a paragraph style, which uses this numbering style, e.g. > <style:style style:name="myH2" style:family="paragraph" > style:parent-style-name="Standard" style:default-outline-level="2" > style:list-style-name="MyChapter"> > > And the heading itself is given by > <text:h text:style-name="myH2" text:outline-level="2">Heading on level > two</text:h> > > Should that generate a number for the heading? I would say yes, but > LibreOffice generates no number here. I try to examine, whether this is > a bug or not. > > Looking at the description of 19.496 style:list-style-name, I see, > "The list style specified by this attribute is applied to headings and > paragraphs that are contained in a list, where the list does not specify > a list style itself, and the list has no list style specification for > any of its parents." > > My heading is not contained in a list. Does it get a number > nevertheless? If yes, does the level of numbering corresponds to the > outline level? > > > LibreOffice puts the heading into a list automatically. But that > produces the questions: > Which level of numbering has to be used? The list level or the outline > level? Or must list level and outline level always be equal? > LibreOffice uses the list level here and does not keep outline level in > sync with list level, which produces a lot of problems for users. > > > Is there a different way I do not see, to get a chapter numbering to a > heading, which does not use the <text:outline-style> element? > > Kind regards > Regina > > --------------------------------------------------------------------- > To unsubscribe from this mail list, you must leave the OASIS TC that > generates this mail. Follow this link to all your TCs in OASIS at: > https://www.oasis-open.org/apps/org/workgroup/portal/my_workgroups.php > -- Senior Adviseur Linked Data KOOP ........................................................................ Kennis- en Exploitatiecentrum Officiële Overheidspublicaties (KOOP) Uitvoeringsorganisatie Bedrijfsvoering Rijk Ministerie van Binnenlandse Zaken en Koninkrijksrelaties Wilhelmina van Pruisenweg 52 2595 AN Den Haag Kamer Oranje, 1e etage 038 Postbus 20011 2500 EA Den Haag Secretariaat secretariaat@koop.overheid.nl 070 700 05 25 ........................................................................ M 06 54 71 54 04 jos.oever@koop.overheid.nl http://koop.overheid.nl <?xml version="1.0" encoding="UTF-8"?> <office:document xmlns:office="urn:oasis:names:tc:opendocument:xmlns:office:1.0" xmlns:style="urn:oasis:names:tc:opendocument:xmlns:style:1.0" xmlns:text="urn:oasis:names:tc:opendocument:xmlns:text:1.0" xmlns:table="urn:oasis:names:tc:opendocument:xmlns:table:1.0" xmlns:draw="urn:oasis:names:tc:opendocument:xmlns:drawing:1.0" xmlns:fo="urn:oasis:names:tc:opendocument:xmlns:xsl-fo-compatible:1.0" xmlns:xlink=" http://www.w3.org/1999/xlink" ; xmlns:dc=" http://purl.org/dc/elements/1.1/" ; xmlns:meta="urn:oasis:names:tc:opendocument:xmlns:meta:1.0" xmlns:number="urn:oasis:names:tc:opendocument:xmlns:datastyle:1.0" xmlns:svg="urn:oasis:names:tc:opendocument:xmlns:svg-compatible:1.0" xmlns:chart="urn:oasis:names:tc:opendocument:xmlns:chart:1.0" xmlns:dr3d="urn:oasis:names:tc:opendocument:xmlns:dr3d:1.0" xmlns:math=" http://www.w3.org/1998/Math/MathML" ; xmlns:form="urn:oasis:names:tc:opendocument:xmlns:form:1.0" xmlns:script="urn:oasis:names:tc:opendocument:xmlns:script:1.0" xmlns:config="urn:oasis:names:tc:opendocument:xmlns:config:1.0" xmlns:ooo=" http://openoffice.org/2004/office" ; xmlns:ooow=" http://openoffice.org/2004/writer" ; xmlns:oooc=" http://openoffice.org/2004/calc" ; xmlns:dom=" http://www.w3.org/2001/xml-events" ; xmlns:xforms=" http://www.w3.org/2002/xforms" ; xmlns:xsd=" http://www.w3.org/2001/XMLSchema" ; xmlns:xsi=" http://www.w3.org/2001/XMLSchema-instance" ; xmlns:rpt=" http://openoffice.org/2005/report" ; xmlns:of="urn:oasis:names:tc:opendocument:xmlns:of:1.2" xmlns:xhtml=" http://www.w3.org/1999/xhtml" ; xmlns:grddl=" http://www.w3.org/2003/g/data-view#" ; xmlns:field="urn:openoffice:names:experimental:ooo-ms-interop:xmlns:field:1.0" xmlns:formx="urn:openoffice:names:experimental:ooxml-odf-interop:xmlns:form:1.0" xmlns:css3t=" http://www.w3.org/TR/css3-text/" ; office:version="1.2" office:mimetype="application/vnd.oasis.opendocument.text"> <office:styles> <style:style style:family="paragraph" style:display-name="List Style" style:name="liststyle" style:list-style-name="mylist"> <style:text-properties fo:color="#ff0000"/> </style:style> <style:style style:family="paragraph" style:display-name="List Style" style:name="outlinestyle" style:list-style-name="myoutline"> <style:text-properties fo:color="#00f000"/> </style:style> <text:list-style style:display-name="My List" style:name="mylist"> <text:list-level-style-number text:level="1" style:num-format="1"> <style:text-properties fo:font-size="12pt" fo:color="#ff00ff"/> </text:list-level-style-number> </text:list-style> <text:outline-style style:name="myoutline"> <text:outline-level-style style:display-name="My Outline" style:num-prefix="(" style:num-suffix=")" text:display-levels="1"> <text:list-level-style-number text:level="1" style:num-format="1"> <style:text-properties fo:font-size="12pt" fo:color="#00ffff"/> </text:list-level-style-number> </text:outline-level-style> </text:outline-style> </office:styles> <office:automatic-styles> <style:page-layout style:name="pm1"> <style:page-layout-properties fo:page-width="10cm" fo:page-height="10in" style:num-format="1" style:print-orientation="portrait" fo:margin-top="10mm" fo:margin-bottom="4.99mm" fo:margin-left="20mm" fo:margin-right="30mm" style:writing-mode="lr-tb" style:footnote-max-height="0mm"> </style:page-layout-properties> </style:page-layout> </office:automatic-styles> <office:master-styles> <style:master-page style:name="Standard" style:page-layout-name="pm1"/> </office:master-styles> <office:body> <office:text> <text:h text:style-name="liststyle" text:outline-level="1">Heading 1 with list style</text:h> <text:h text:style-name="outlinestyle" text:outline-level="1">Heading 1 with outline style</text:h> <text:p>paragraph</text:p> </office:text> </office:body> </office:document>


  • 3.  Re: Re: [office] How to number a heading?

    Posted 05-22-2017 14:04
    Here is an example file created with Calligra Words. style.xml <office:styles> <style:style style:name="Head_201" style:default-outline-level="1" style:display-name="Head 1" style:family="paragraph" style:next-style-name="Standard"> <style:text-properties fo:font-size="20pt" fo:font-weight="bold"/> </style:style> </office:styles> <text:outline-style style:name="O"> <text:outline-level-style text:start-value="1" text:display-levels="1" style:num-format="1" text:level="1" style:num-prefix="" style:num-suffix="."> <style:list-level-properties text:list-level-position-and-space-mode="label-width-and-position" fo:text-align="start"/> </text:outline-level-style> <text:outline-level-style text:start-value="1" text:display-levels="2" style:num-format="1" text:level="2" style:num-prefix="" style:num-suffix="."> <style:list-level-properties text:list-level-position-and-space-mode="label-width-and-position" fo:text-align="start"/> </text:outline-level-style> <text:outline-level-style text:start-value="1" text:display-levels="3" style:num-format="1" text:level="3" style:num-prefix="" style:num-suffix="."> <style:list-level-properties text:list-level-position-and-space-mode="label-width-and-position" fo:text-align="start"/> </text:outline-level-style> </text:outline-style> content.xml <office:text> <text:h text:outline-level="1" text:style-name="P1">Heading 1</text:h> </office:text> This examples uses outline-style to style the headings. LibreOffice displays this correctly. Cheers, Jos On 22-05-17 15:31, Jos van den Oever wrote: > Hello Regina, > > Can you add an example of what you want to achieve visually and reason > back from that? > > When reading your description, it's not always clear to me when you talk > about a number and when about a number *style*. No showing a number is > also a style. > > text:outline-level gives the number. The way that that number is > displayed is determined by the active style. > > style:default-outline-level="2" is only relevant when you do not want to > set text:outline-level explicitly. > > I've attached a file that I experimented with. It does not show heading > numbers in LibreOffice. > > Cheers, > Jos > > > On 09-05-17 17:02, Regina Henschel wrote: >> Hi all, >> >> you can number a heading by setting text:ouline-level in the <text:h> >> element and no list style in its paragraph style. Then the number is >> taken from 16.34 <text:outline-style>. Its description is, >> "An outline style is a list style that is applied to all headings within >> a text document where the heading's paragraph style does not define a >> list style to use itself." >> >> But if you need a different numbering parallel, e.g. for an appendix, >> you can not use a second <text:outline-style> element, because more than >> one is not allowed. So how to get a number in such case? >> >> >> I define a numbering style >> <text:list-style style:name="MyChapter"> >> with its <text:list-level-style-number> childs for the different >> text:level, e.g. >> <text:list-level-style-number text:level="2" >> text:style-name="Numbering_20_Symbols" style:num-prefix="(" >> style:num-suffix=")" style:num-format="a"> >> <style:list-level-properties ... >> </text:list-level-style-number> >> >> Then I define a paragraph style, which uses this numbering style, e.g. >> <style:style style:name="myH2" style:family="paragraph" >> style:parent-style-name="Standard" style:default-outline-level="2" >> style:list-style-name="MyChapter"> >> >> And the heading itself is given by >> <text:h text:style-name="myH2" text:outline-level="2">Heading on level >> two</text:h> >> >> Should that generate a number for the heading? I would say yes, but >> LibreOffice generates no number here. I try to examine, whether this is >> a bug or not. >> >> Looking at the description of 19.496 style:list-style-name, I see, >> "The list style specified by this attribute is applied to headings and >> paragraphs that are contained in a list, where the list does not specify >> a list style itself, and the list has no list style specification for >> any of its parents." >> >> My heading is not contained in a list. Does it get a number >> nevertheless? If yes, does the level of numbering corresponds to the >> outline level? >> >> >> LibreOffice puts the heading into a list automatically. But that >> produces the questions: >> Which level of numbering has to be used? The list level or the outline >> level? Or must list level and outline level always be equal? >> LibreOffice uses the list level here and does not keep outline level in >> sync with list level, which produces a lot of problems for users. >> >> >> Is there a different way I do not see, to get a chapter numbering to a >> heading, which does not use the <text:outline-style> element? >> >> Kind regards >> Regina >> >> --------------------------------------------------------------------- >> To unsubscribe from this mail list, you must leave the OASIS TC that >> generates this mail. Follow this link to all your TCs in OASIS at: >> https://www.oasis-open.org/apps/org/workgroup/portal/my_workgroups.php >> > > > > > > --------------------------------------------------------------------- > To unsubscribe from this mail list, you must leave the OASIS TC that > generates this mail. Follow this link to all your TCs in OASIS at: > https://www.oasis-open.org/apps/org/workgroup/portal/my_workgroups.php > -- Senior Adviseur Linked Data KOOP ........................................................................ Kennis- en Exploitatiecentrum Officiële Overheidspublicaties (KOOP) Uitvoeringsorganisatie Bedrijfsvoering Rijk Ministerie van Binnenlandse Zaken en Koninkrijksrelaties Wilhelmina van Pruisenweg 52 2595 AN Den Haag Kamer Oranje, 1e etage 038 Postbus 20011 2500 EA Den Haag Secretariaat secretariaat@koop.overheid.nl 070 700 05 25 ........................................................................ M 06 54 71 54 04 jos.oever@koop.overheid.nl http://koop.overheid.nl Attachment: calligra.odt Description: calligra.odt


  • 4.  Re: [office] How to number a heading?

    Posted 05-23-2017 20:29
    Hi all, here are some test files: LO54default ----------- It contains a chapter numbering made with Tools > Chapter Numbering (old LibreOffice versions "Outline Numbering") of LibreOffice version 5.4. That results in the use of <text:outline-style style:name="Outline"> LO54own_headingstyle -------------------- It contains headings, which have got a newly created paragraph style. These styles got an "Outline Level" set in tab Outline&Numbering in the properties dialog of the style in LibreOffice. This results in the attribute style:default-outline-level in the style. And when the style is applied, the <text:h> element gets an attribute text:outline-level. Because LibreOffice adds a style:list-style-name="" automatically, I have removed these from the file source. Having this attribute set, LibreOffice will not display numbers. The TOC needs to be updated. But I'm not sure at what point LibreOffice adds the style:list-style-name="" and what the TOC will actually use. On saving LibreOffice replaces the imported structure with its own way. The file does not validate, because "mimetype" is not the first file in the package. But I do not know, how to get the correct order, when using 7Zip. All other things are OK. LO54own_headingstyle_own_numberingstyle --------------------------------------- In that version I set not only the outline level, but I have set a numbering style too in tab Outline&Numbering in the properties dialog of the style. The file contains the original output of LibreOffice. Here you will see that LibreOffice generates lists and that the list level given by the nesting of the lists do not correspond to the outline level. Manually_own_headingstyle_own_numberingstyle_explicit Manually_own_headingstyle_own_numberingstyle_inherit ----------------------------------------------------- In these versions I add the attribute style:list-style-name to my heading styles; in case "inherit" only to the parent, in "explicit" to all child styles too. This is similar to LO54default, only that now the style has got an attribute style:list-style-name="myNumbering", so that the default <text:outline-style style:name="Outline"> is not used. I expect, that now the numbering definition <text:list-style style:name="myNumbering"> is used for numbering. The problem is, that I cannot determine from the specification, whether I am right. Here too the "mimetype" is not the first file in the package. So if someone can repair the order, that would be nice. LibreOffice does not look at the order on opening files, but other applications might be less tolerant. I have added the fodt variants, because you can examine them more easily. But the validator does not work on fodt and not all application are able to read flat format. Kind regards Regina Attachment: LO54default.fodt Description: application/vnd.oasis.opendocument.text Attachment: LO54default.odt Description: application/vnd.oasis.opendocument.text Attachment: LO54own_headingstyle.fodt Description: application/vnd.oasis.opendocument.text Attachment: LO54own_headingstyle.odt Description: application/vnd.oasis.opendocument.text Attachment: LO54own_headingstyle_own_numberingstyle.fodt Description: application/vnd.oasis.opendocument.text Attachment: LO54own_headingstyle_own_numberingstyle.odt Description: application/vnd.oasis.opendocument.text Attachment: Manually_own_headingstyle_own_numberingstyle_explicit.fodt Description: application/vnd.oasis.opendocument.text Attachment: Manually_own_headingstyle_own_numberingstyle_explicit.odt Description: application/vnd.oasis.opendocument.text Attachment: Manually_own_headingstyle_own_numberingstyle_inherit.fodt Description: application/vnd.oasis.opendocument.text Attachment: Manually_own_headingstyle_own_numberingstyle_inherit.odt Description: application/vnd.oasis.opendocument.text


  • 5.  Re: [office] How to number a heading?

    Posted 06-12-2017 13:56
    On 23-05-17 22:28, Regina Henschel wrote: > > Here too the "mimetype" is not the first file in the package. So if > someone can repair the order, that would be nice. LibreOffice does not > look at the order on opening files, but other applications might be less > tolerant. I have attached bash scripts to pack and unpack odf files. This script puts 'mimetype' first and does not compress it. The scripts are developed for linux and require that 'zip' is installed. Save the files in your path and make them executable: chmod a+x pack unpack Now you can use them like this: unpack test.odt pack test_odt Cheers, Jos #!/usr/bin/env bash set -o errexit set -o nounset set -o pipefail DIR=${1%/} OUTPUT=${2:-} if [ ! -d "$DIR" ]; then echo "Provide a directory to pack." exit 1 fi if [ -z "$OUTPUT" ]; then BASE=${DIR%_*} EXT=${DIR##*_} if [ "${BASE}_$EXT" != "$DIR" ]; then echo "Provide output name or use directory like 'name_ext'." exit 1 fi OUTPUT="$BASE.$EXT" fi if [ "${OUTPUT:0:1}" != "/" ]; then OUTPUT="$PWD/$OUTPUT" fi if [ ! -f "$DIR/mimetype" ]; then echo "No mimetype file present." exit 1 fi if [ ! -f "$DIR/content.xml" ]; then echo "No content.xml file present." exit 1 fi if [ ! -f "$DIR/styles.xml" ]; then echo "No styles.xml file present." exit 1 fi if [ -f "$OUTPUT" ]; then echo deleting "$OUTPUT" rm "$OUTPUT" fi cd "$DIR" (echo "Failed to enter $DIR."; exit 1) zip -D -X -0 "$OUTPUT" mimetype zip -D -X -9 -r "$OUTPUT" . -x mimetype */.* .* *.png *.jpg *.jpeg zip -D -X -0 -r "$OUTPUT" . -i *.png *.jpg *.jpeg test 1 echo Created "$OUTPUT" #!/usr/bin/env bash # construct an output name DIR=$1 DIR=${DIR/%.odp/_odp} DIR=${DIR/%.odt/_odt} DIR=${DIR/%.ods/_ods} DIR=${DIR/%.odg/_odg} DIR=${DIR/%.otp/_otp} DIR=${DIR/%.ott/_ott} DIR=${DIR/%.ots/_ots} DIR=${DIR/%.otg/_otg} if [ ! -f "$1" ]; then echo "The file '$1' does not exist." exit 1 fi if [ "$1" == "$DIR" ]; then echo "The file '$1' cannot be unpacked." exit 1 fi if [ -e "$DIR" ]; then echo "Directory $DIR already exists." exit 1 fi unzip "$1" -d "$DIR" xmlstarlet fo "$DIR/content.xml" > "$DIR/c" mv "$DIR/c" "$DIR/content.xml" xmlstarlet fo "$DIR/styles.xml" > "$DIR/c" mv "$DIR/c" "$DIR/styles.xml" if [ -e "$DIR/meta.xml" ]; then xmlstarlet fo "$DIR/meta.xml" > "$DIR/c" mv "$DIR/c" "$DIR/meta.xml" fi


  • 6.  Re: [office] How to number a heading?

    Posted 07-11-2017 19:04
    Hi Jos, I have used the scripts in Cygwin several times now. They work fine. Thank you for providing them. Kind regards Regina Jos van den Oever schrieb: On 23-05-17 22:28, Regina Henschel wrote: Here too the "mimetype" is not the first file in the package. So if someone can repair the order, that would be nice. LibreOffice does not look at the order on opening files, but other applications might be less tolerant. I have attached bash scripts to pack and unpack odf files. This script puts 'mimetype' first and does not compress it. The scripts are developed for linux and require that 'zip' is installed. Save the files in your path and make them executable: chmod a+x pack unpack Now you can use them like this: unpack test.odt pack test_odt Cheers, Jos --------------------------------------------------------------------- To unsubscribe from this mail list, you must leave the OASIS TC that generates this mail. Follow this link to all your TCs in OASIS at: https://www.oasis-open.org/apps/org/workgroup/portal/my_workgroups.php


  • 7.  Re: [office] How to number a heading?

    Posted 06-12-2017 14:02
    On 23-05-17 22:28, Regina Henschel wrote: > Here too the "mimetype" is not the first file in the package. So if > someone can repair the order, that would be nice. Here are the versions of the odt files with 'mimetype' as first uncompressed file. Cheers, Jos Attachment: LO54default.odt Description: LO54default.odt Attachment: LO54own_headingstyle.odt Description: LO54own_headingstyle.odt Attachment: Manually_own_headingstyle_own_numberingstyle_explicit.odt Description: Manually_own_headingstyle_own_numberingstyle_explicit.odt Attachment: Manually_own_headingstyle_own_numberingstyle_inherit.odt Description: Manually_own_headingstyle_own_numberingstyle_inherit.odt Attachment: LO54own_headingstyle_own_numberingstyle.odt Description: LO54own_headingstyle_own_numberingstyle.odt


  • 8.  Re: [office] How to number a heading?

    Posted 06-14-2017 16:08
    On 09.05.2017 17:02, Regina Henschel wrote: > Hi all, > > you can number a heading by setting text:ouline-level in the <text:h> > element and no list style in its paragraph style. Then the number is > taken from 16.34 <text:outline-style>. Its description is, > "An outline style is a list style that is applied to all headings within > a text document where the heading's paragraph style does not define a > list style to use itself." oops, during the call i completely missed that you wrote this :) sorry, i was obviously badly prepared... ... i've moved the rest of my reply to a reply to your proposal. -- Michael Stahl Software Engineer Platform Engineering - Desktop Team Red Hat Better technology. Faster innovation. Powered by community collaboration. See how it works at redhat.com Red Hat GmbH, http://www.de.redhat.com/ , Sitz: Grasbrunn, Handelsregister: Amtsgericht München, HRB 153243, Geschäftsführer: Charles Cachera, Michael Cunningham, Michael O'Neill, Eric Shander