如何在Libre Office Flat XML(fods)文件中将字符串标记为粗体? [英] How is a String marked as bold in a Libre Office flat XML (fods) file?

查看:135
本文介绍了如何在Libre Office Flat XML(fods)文件中将字符串标记为粗体?的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

从一个.fods文件中的原始XML中查找:

Looking at the raw XML from a .fods file:

  <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",没有用于粗体,下划线等的标记.

When opened in Libre Office the names are in bold. Where would that be reflected in the above XML? I'm only seeing a value-type="string" with no markup for bold, underline, etc.

所有内容都在同一列中,因此不太确定default-cell-style-name="ce17"属性所指示的内容.

Everything is in a single column, so not quite sure what the default-cell-style-name="ce17" attribute indicates.

虽然数据源自.doc文件,但我在文件上使用了Libre Office.

While the data originated as a .doc file, I'm using Libre Office on the file.

我希望从XML中提取名称,这些名称实际上是与电话或地址不同的,因为它们以粗体显示.我想也没有数字,但是我想从电子表格中选择粗体数据.

I'm looking to extract the names from the XML, which are only, really, distinguished from phone or address in that they're in bold. I suppose there's no numeric numbers, either, but I'd like to select the bold data from the spreadsheet.

格式化信息似乎有些含糊:

格式化

样式和格式设置控件很多,提供了许多 控制信息的显示.

The style and formatting controls are numerous, providing a number of controls over the display of information.

页面布局由各种属性控制.这些包括 页面大小,数字格式,纸盒,打印方向,边距, 边框(及其线宽),填充,阴影,背景,列, 打印页面顺序,首页编号,比例,表格居中,最大值 脚注高度和分隔符,以及许多布局网格属性.

Page layout is controlled by a variety of attributes. These include page size, number format, paper tray, print orientation, margins, border (and its line width), padding, shadow, background, columns, print page order, first page number, scale, table centering, maximum footnote height and separator, and many layout grid properties.

页眉和页脚可以定义固定的高度和最小高度, 边距,边界线宽度,填充,背景,阴影和动态 间距.

Headers and footer can have defined fixed and minimum heights, margins, border line width, padding, background, shadow, and dynamic spacing.

特定文本,段落,红宝石文本有很多属性, 部分,表格,列,列表和填充.具体字符可以 有他们的字体,大小,通用字体系列名称(罗马–衬线, 瑞士–无衬线,现代–等宽,装饰性,脚本或系统), 和其他属性设置.段落可以有垂直空间 通过保持在一起,寡妇和孤儿的属性进行控制,以及 还有其他属性(例如首字下沉")可以提供特殊的 格式化.列表非常广泛.请参阅参考资料(在 详细信息.

There are many attributes for specific text, paragraphs, ruby text, sections, tables, columns, lists, and fills. Specific characters can have their fonts, sizes, generic font family names (roman – serif, swiss – sans-serif, modern – monospace, decorative, script or system), and other properties set. Paragraphs can have their vertical space controlled through attributes on keep together, widow, and orphan, and have other attributes such as "drop caps" to provide special formatting. The list is extremely extensive; see the references (in particular the actual standard) for details.

推荐答案

值和格式位于XML文件的不同部分.

Values and formats are placed in different sections of the XML file.

通常,您会在样式"部分中用名称(样式:名称)定义所有格式.

So usually, you have a 'style' section where all the formats are defined with a name (style:name).

在表格部分,您定义了表格,放置在表格中的值以及样式(由他的表格:样式名称"标识).您可以为每个单元格,整个行,整个列甚至整个表格定义样式.

In the table section, you have the table defined, the values placed in it and which style has (identified by his 'table:style-name'). You can define a style for each cell, for an entire row, entire column or even the entire table.

因此,在您的情况下,您可以识别使用样式名称的粗体文本.这并不总是那么容易,因为您可以为整个列/行指定默认样式(default-cell-style-name ="ce17"),以防万一未定义样式.

So in your case, you can identify the bold text looking to the style name is using. That's not always easy, because you can specify a default style for an entire column/row (default-cell-style-name="ce17") which it would takes place in case the style is not defined.

我开发了一个库,用于解析Java中的ODS文件,因此,如果您需要灵感,可以在Github中进行检查: https://github.com/miachm/SODS

I developed a library for parse ODS Files in Java, so in case you need inspiration you can check it out in Github: https://github.com/miachm/SODS

这篇关于如何在Libre Office Flat XML(fods)文件中将字符串标记为粗体?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆