ODT and OpenOffice.org: Apply formatting to text under a text:span using text:class-names attribute?

StackOverflow https://stackoverflow.com/questions/11787816

Вопрос

I'm trying to apply some simple formatting to text, but it isn't working. The example is below and passes a RNG validator. I'm using Apache OpenOffice3.4 and ODT1.2 flat document.

The ODT spec says that a <text:span> element can have an text:class-names attribute; and the attribute specifies a white space separated list of text style names.

It looks right to me... What's the correct way to do this?

<?xml version="1.0" encoding="UTF-8"?>
<office:document xmlns:style="urn:oasis:names:tc:opendocument:xmlns:style:1.0" xmlns:office="urn:oasis:names:tc:opendocument:xmlns:office:1.0" xmlns:text="urn:oasis:names:tc:opendocument:xmlns:text:1.0" office:version="1.2" office:mimetype="application/vnd.oasis.opendocument.text">
    <office:styles>
        <style:style style:family="text" style:name="BOLD">
            <style:text-properties fo:font-weight="bold"/>
        </style:style>
    </office:styles>
    <office:body>
        <office:text>
            <text:p>Plain text here; <text:span text:class-names="BOLD">this is supposed to be bold text;</text:span></text:p>
        </office:text>
    </office:body>
</office:document>
Это было полезно?

Решение

It's an OOo/Libre bug and here's a link relating to the problem. Not in bugzilla?

Initially I tried to use nested <text:span> elements but, referring to the above link, I had my styles defined in <office:styles> and not <office:automatic-styles>.

Лицензировано под: CC-BY-SA с атрибуция
Не связан с StackOverflow
scroll top