Bonjour à tous,

Existe-t-il une macro (même expérimentale) qui permettrait de nettoyer le
code XML d'un fichier odt ?

Dans un document odt, ayant un souci avec la numérotation des titres (il
refusait de commencer à 7), j'ai ouvert le capot et j'ai trouvé cela :

<début du code>

<text:list text:style-name="Outline">
                <text:list-item>
                    <text:h text:style-name="Heading_20_1"
text:outline-level="1">Types, codage de l&apos;information</text:h>
                </text:list-item>
            </text:list>
            <text:p text:style-name="Text_20_body">blabbla du
paragraphe</text:p>
            <text:list text:style-name="Outline">
                <text:list-item text:start-value="1">
                    <text:list>
                        <text:list-item text:start-value="1">
                            <text:list>
                                <text:list-item text:start-value="1">
                                    <text:h text:style-name="Heading_20_2"
text:outline-level="3" text:restart-numbering="true"
text:start-value="1">Nombres entiers non signés</text:h>
                                </text:list-item>
                            </text:list>
                        </text:list-item>
                    </text:list>
                </text:list-item>
            </text:list>

<fin du code>

que j'ai changé (modif manuelle et réparation automatique) en

<code>

<text:list text:style-name="Outline">
                <text:list-item text:start-value="7">
                    <text:h text:style-name="Heading_20_1"
text:outline-level="1" text:restart-numbering="true"
text:start-value="7">Types, codage de l&apos;information</text:h>
                </text:list-item>
            </text:list>
            <text:p text:style-name="Text_20_body">blabbla du
paragraphe</text:p>
            <text:list text:style-name="Outline">
                <text:list-item text:start-value="1">
                    <text:list>
                        <text:list-item text:start-value="1">
                            <text:list>
                                <text:list-item text:start-value="1">
                                    <text:h text:style-name="Heading_20_2"
text:outline-level="3" text:restart-numbering="true"
text:start-value="1">Nombres entiers non signés</text:h>
                                </text:list-item>
                            </text:list>
                        </text:list-item>
                    </text:list>
                </text:list-item>
            </text:list>

<fin du code>

Je ne comprenais pas pourquoi le code n'est pas simplement

<code>

            <text:h text:style-name="Heading_20_1"
text:outline-level="1">Types, codage de l&apos;information</text:h>
            <text:p text:style-name="Text_20_body">blabbla du
paragraphe</text:p>
            <text:h text:style-name="Heading_20_3"
text:outline-level="3">Nombres entiers non signés</text:h>

<fin du code>

Je suis allé consulter le fichier "styles.xml"
et là j'ai trouvé cela

<code>

<text:list-style style:name="Outline">
            <text:list-level-style-number text:level="1"
style:num-suffix="." style:num-format="I" text:start-value="7">
                <style:list-level-properties text:min-label-width="1.251cm
"/>
            </text:list-level-style-number>
            <text:list-level-style-number text:level="2"
style:num-prefix="Exercice" style:num-format="1" text:start-value="0"
text:display-levels="2">
                <style:list-level-properties text:space-before="1.25cm"
text:min-label-width="1.251cm"/>
            </text:list-level-style-number>
            <text:list-level-style-number text:level="3"
style:num-suffix="." style:num-format="1">
                <style:list-level-properties text:min-label-width="1.251cm
"/>
            </text:list-level-style-number>

<... code coupé ...>

        </text:list-style>

<fin du code>

je m'attendais à trouver un code commençant par

<code>

<text:outline-style>
            <text:outline-level-style text:level="1" style:num-format="1"
text:start-value="7">
                <style:list-level-properties text:min-label-distance="
0.381cm"/>
            </text:outline-level-style>

<fin du code>

-- 
Pierre POISSON

Répondre à