张望位于.fods文件的原始XML上:
<table:table-column table:style-name="co1" table:default-cell-style-name="ce17"/>
<table:table-row table:style-name="ro1">
<table:table-cell table:style-name="ce15" office:value-type="string" calcext:value-type="string">
<text:p>John Smith</text:p>
</table:table-cell>
</table:table-row>
<table:table-row table:style-name="ro2">
<table:table-cell table:style-name="ce16" office:value-type="string" calcext:value-type="string">
<text:p>(123) 456-7890</text:p>
</table:table-cell>
</table:table-row>
<table:table-row table:style-name="ro2">
<table:table-cell office:value-type="string" calcext:value-type="string">
<text:p>123 Main Street</text:p>
</table:table-cell>
</table:table-row>
<table:table-row table:style-name="ro2">
<table:table-cell office:value-type="string" calcext:value-type="string">
<text:p>Anywhere, ZZ 12345-6789</text:p>
</table:table-cell>
</table:table-row>
<table:table-row table:style-name="ro1">
<table:table-cell table:style-name="ce15" office:value-type="string" calcext:value-type="string">
<text:p>Jane Doe</text:p>
</table:table-cell>
</table:table-row>
<table:table-row table:style-name="ro2">
<table:table-cell table:style-name="ce16" office:value-type="string" calcext:value-type="string">
<text:p>(234) 567-8901</text:p>在Libre Office中打开时,名称是粗体。在上面的XML中,这会反映在哪里呢?我只看到一个没有粗体、下划线等标记的value-type="string"。
所有内容都在一个列中,因此不太确定default-cell-style-name="ce17"属性指示了什么。
虽然数据起源于.doc文件,但我在文件上使用了Libre Office。
我希望从XML中提取名称,这些名称实际上与电话或地址有很大的区别,因为它们是粗体。我想也没有数字,但我想从电子表格中选择粗体数据。
格式化信息似乎有些模糊:
格式化 样式和格式控件很多,提供了许多信息显示的控件。 页面布局由多种属性控制。这些内容包括页面大小、数字格式、纸盘、打印方向、页边距、边框(及其线宽)、填充、阴影、背景、列、打印页面顺序、第一页编号、比例尺、表对中、最大脚注高度和分隔符以及许多布局网格属性。 页眉和页脚可以定义固定和最小高度、边距、边框宽度、填充、背景、阴影和动态间距。 对于特定的文本、段落、红宝石文本、节、表、列、列表和填充,有许多属性。特定字符可以有它们的字体、大小、通用字体家族名称(罗马-衬线、瑞士-无衬线、现代-单空间、装饰、脚本或系统)和其他属性集。段落可以通过“保持在一起”、“寡妇”和“孤儿”上的属性控制其垂直空间,并具有其他属性,如“下拉帽”,以提供特殊的格式设置。列表非常广泛;详细信息请参阅参考资料(特别是实际标准)。
发布于 2020-05-05 19:58:33
值和格式放置在XML文件的不同部分。
所以通常,您有一个“style”部分,其中所有的格式都定义了一个名称(style: name )。
在表部分中,定义了表、放置在表中的值以及样式(由他的“表:样式-名称”标识)。您可以为每个单元格、整个行、整个列甚至整个表定义样式。
因此,在您的情况下,您可以识别粗体文本的样式名称正在使用。这并不总是那么容易,因为您可以为整个列/行(默认-单元格样式-name=“ce17”)指定默认样式,如果样式没有定义,就会发生这种默认样式。
我在Java中为解析ODS文件开发了一个库,因此如果您需要灵感,可以在Github:https://github.com/miachm/SODS中查看它。
https://stackoverflow.com/questions/60221464
复制相似问题