首页
学习
活动
专区
圈层
工具
发布
社区首页 >问答首页 >XML中的ODT表格样式不起作用

XML中的ODT表格样式不起作用
EN

Stack Overflow用户
提问于 2016-12-07 01:55:05
回答 1查看 865关注 0票数 1

我正在开发一个能生成相当大的ODT文件的应用程序。应用程序将XML写入content.xml、styles.xml等。我正尝试在一个表上设置一些简单的表样式,在生成文件后,我可以验证它在XML端是否如我所期望的那样通过,但当我在字处理器中打开文件时,没有任何样式实际显示出来。我已经将其分解为只尝试使一个简单的表显示一些样式,但这根本不起作用。

在“automatic- style”标签中,我有这个样式片段。

代码语言:javascript
复制
    <style:style style:name="mytable" style:family="table">
        <style:properties 
            fo:background-color="#666666" 
            style:width="445.5pt" 
            fo:margin-left="4.5pt" 
            fo:margin-top="0pt" 
            fo:margin-bottom="0pt" 
            table:align="left" 
        />
    </style:style>
    <style:style style:name="mytable.A" style:family="table-column">
        <style:properties fo:background-color="#000000" style:column-width="117pt"/>
    </style:style>
    <style:style style:name="mytable.B" style:family="table-column">
        <style:properties style:column-width="103.5pt"/>
    </style:style>
    <style:style style:name="mytable.C" style:family="table-column">
        <style:properties style:column-width="193.5pt"/>
    </style:style>
    <style:style style:name="mytable.D" style:family="table-column">
        <style:properties style:column-width="31.5pt"/>
    </style:style>  

编辑:这是我的实时文档的截图。这是来自这个文档的content.xml部分,上面发布的样式是相同的。

代码语言:javascript
复制
    <table:table table:name="mytable" table:style-name="mytable">
        <table:table-columns>
            <table:table-column table:style-name="mytable.A"/>
            <table:table-column table:style-name="mytable.B"/>
            <table:table-column table:style-name="mytable.C"/>
            <table:table-column table:style-name="mytable.D"/>
        </table:table-columns>
        <table:table-header-rows>
            <table:table-row>
                <table:table-cell table:style-name="mytable.A1" office:value-type="string">
                    <text:p text:style-name="P39">citation</text:p>
                </table:table-cell>
                <table:table-cell table:style-name="mytable.B1" office:value-type="string">
                    <text:p text:style-name="P39">title</text:p>
                </table:table-cell>
                <table:table-cell table:style-name="mytable.C1" office:value-type="string">
                    <text:p text:style-name="P39">description</text:p>
                </table:table-cell>
                <table:table-cell table:style-name="mytable.D1" office:value-type="string">
                    <text:p p text:style-name="P38"/>
                </table:table-cell>
            </table:table-row>
        </table:table-header-rows>
        <table:table-row>
            <table:table-cell table:style-name="mytable.A2" office:value-type="string">
                <text:p p text:style-name="P39">Administrative Safe-guards</text:p>
            </table:table-cell>
            <table:table-cell table:style-name="mytable.B2" office:value-type="string">
                <text:p p text:style-name="P39"/>
            </table:table-cell>
            <table:table-cell table:style-name="mytable.C2" office:value-type="string">
                <text:p p text:style-name="P39"/>
            </table:table-cell>
            <table:table-cell table:style-name="mytable.D2" office:value-type="string">
                <text:p p text:style-name="P38"/>
            </table:table-cell>
        </table:table-row>
    </table:table>

EN

回答 1

Stack Overflow用户

发布于 2016-12-07 04:20:45

子节点应该是style:table-properties,而不是style:properties。这一点在http://books.evc-cit.info/odbook/ch04.html#text-table-style-section上有解释。

代码语言:javascript
复制
<office:automatic-styles>
<style:style style:name="mytable" style:family="table">
    <style:table-properties 
        fo:background-color="#666666" 
        style:width="445.5pt" 
        fo:margin-left="4.5pt" 
        fo:margin-top="0pt" 
        fo:margin-bottom="0pt" 
        table:align="left" 
    />
</style:style>

票数 0
EN
页面原文内容由Stack Overflow提供。腾讯云小微IT领域专用引擎提供翻译支持
原文链接:

https://stackoverflow.com/questions/41001807

复制
相关文章

相似问题

领券
问题归档专栏文章快讯文章归档关键词归档开发者手册归档开发者手册 Section 归档