当前位置:网站首页>Open Office XML 格式里如何描述多段具有不同字体设置的段落
Open Office XML 格式里如何描述多段具有不同字体设置的段落
2022-08-10 12:23:00 【汪子熙】
_rels.rels
这定义了告诉 MS Word 在哪里查找文档内容的参考。 在下列这种情况下,它引用 word/document.xml:
<?xml version="1.0" encoding="UTF-8" standalone="yes"?>
<Relationships xmlns="http://schemas.openxmlformats.org/package/2006/relationships">
<Relationship Id="rId1" Type="http://schemas.openxmlformats.org/officeDocument/2006/relationships/officeDocument" Target="word/document.xml"/>
</Relationships>
_RELS/DOCUMENT.XML.RELS
此文件定义对嵌入在文档内容中的资源(例如图像)的引用。 如果我们的简单文档没有嵌入资源,那么关系标签为空:
<?xml version="1.0" encoding="UTF-8" standalone="yes"?>
<Relationships xmlns="http://schemas.openxmlformats.org/package/2006/relationships">
</Relationships>
[CONTENT_TYPES].XML
[Content_Types].xml 包含有关文档内媒体类型的信息。 因为我们只有文本内容,所以很简单:
<?xml version="1.0" encoding="UTF-8" standalone="yes"?>
<Types xmlns="http://schemas.openxmlformats.org/package/2006/content-types">
<Default Extension="rels" ContentType="application/vnd.openxmlformats-package.relationships+xml"/>
<Default Extension="xml" ContentType="application/xml"/>
<Override PartName="/word/document.xml" ContentType="application/vnd.openxmlformats-officedocument.wordprocessingml.document.main+xml"/>
</Types>
DOCUMENT.XML
这是包含文档文本内容的主要 XML。 在该文件中,开发人员会发现文档中的一些命名空间引用未使用,但请注意,我们不应删除它们,因为 MS Word 需要它们。
这是我们的简化示例:
<w:document>
<w:body>
<w:p w:rsidR="005F670F" w:rsidRDefault="005F79F5">
<w:r><w:t>Test</w:t></w:r>
</w:p>
<w:sectPr w:rsidR="005F670F">
<w:pgSz w:w="12240" w:h="15840"/>
<w:pgMar w:top="1440" w:right="1440" w:bottom="1440" w:left="1440" w:header="720" w:footer="720" w:gutter="0"/>
<w:cols w:space="720"/>
<w:docGrid w:linePitch="360"/>
</w:sectPr>
</w:body>
</w:document>
主节点<w:document>
代表文档本身,<w:body>
包含段落,嵌套在<w:body>
中的是由<w:sectPr>
定义的页面尺寸。
<w:rsidR>
是一个可以忽略的属性; 它被 MS Word 内部使用。
让我们看一个包含三个段落的更复杂的文档。 我在 Microsoft Word 的屏幕截图中用相同颜色突出显示了 XML,因此我们可以看到相关性:
Word 文档里的文本,被成对的标签 w:t
包裹。字体通过 w:rFont
标签指定。
颜色通过 w:color
指定。
新的段落,通过 w:p
指定。w:p
里,仍然是 w:t
.
Paragraph Structure
一个简单的文档由段落组成,一个段落由连串(一系列具有相同字体、颜色等的文本
)组成,连串由字符(例如 <w:t>
)组成。<w:t>
标记里面可能有几个字符,在同一个 run 结构中可能有几个字符。
TEXT PROPERTIES
基本文本属性是字体、大小、颜色、样式等。 大约有 40 个标签用于指定文本外观。 正如在我们的三段示例中所见,每行在 <w:rPr>
中都有自己的属性,指定 <w:color>
、<w:rFonts>
和粗体 <w:b>
。
需要注意的重要一点是,属性区分了两组字符,普通脚本和复杂脚本(例如阿拉伯语),并且属性具有不同的标记,具体取决于它所影响的字符类型。
大多数普通脚本属性标签都有一个匹配的复杂脚本标签,并添加了一个 C
,指定该属性用于复杂脚本
。 例如:<w:i>
(斜体)变为 <w:iCs>
,普通脚本的粗体标签 <w:b>
变为复杂脚本的 <w:bCs>
。
边栏推荐
- 神经网络学习-正则化
- Inventory of Loudi Agricultural Products Inspection Laboratory Construction Guidelines
- 2022 Recruitment Notice for Academician Zhao Guoping Group of Shenzhen Institute of Advanced Technology, Chinese Academy of Sciences
- Requirements for the construction of Loudi stem cell preparation laboratory
- 线代 | 秒杀方法与技巧
- camshift实现目标跟踪
- 48 the mysql database
- 海外邮件发送指南(二)
- Codeforces Round #276 (Div. 1) D. Kindergarten
- Polygon zkEVM工具——PIL和CIRCOM
猜你喜欢
iTextSharp操作PDF
LeetCode medium topic search of two-dimensional matrix
Comparison version number of middle questions in LeetCode
shell:正则表达式及三剑客grep命令
What are the five common data types of Redis?What is the corresponding data storage space?Take you to learn from scratch
「网络架构」网络代理第一部分: 代理概述
Jenkins修改端口号, jenkins容器修改默认端口号
Guidelines for Sending Overseas Mail (2)
Wirshark common operations and tcp three-way handshake process example analysis
Proprietary cloud ABC Stack, the real strength!
随机推荐
iTextSharp 使用详解
一文详解 implementation api embed
神了!阿里数据库专家纯手写了这份604页的Oracle+MySQL攻坚指南
Solution for "Certificate not valid for requested usage" after Digicert EV certificate signing
Keithley DMM7510精准测量超低功耗设备各种运作模式功耗
Mysql—— 内连接、左连接、右连接以及全连接查询
2022 Recruitment Notice for Academician Zhao Guoping Group of Shenzhen Institute of Advanced Technology, Chinese Academy of Sciences
shell:常用小工具(sort、uniq、tr、cut)
Redis 定长队列的探索和实践
Merge similar items in LeetCode simple questions
【百度统计】用户行为分析
iTextSharp操作PDF
camshift实现目标跟踪
Highways「建议收藏」
国外媒体宣发怎样做才可以把握重点
交换机的基础知识
BEVDet4D: Exploit Temporal Cues in Multi-camera 3D Object Detection 论文笔记
Requirements for the construction of Loudi stem cell preparation laboratory
瑞幸「翻身」?恐言之尚早
机器学习实战(2)——端到端的机器学习项目