WordprocessingML Content Overview内容概述
A WordprocessingML document is a package containing a number of different parts, mostly XML files. However, most of the actual content is found within the main document part. WordprocessingML文档是一个包含许多不同部分的包,大部分是XML文件。然而,大多数实际内容都在主文档部分中找到。And that content is mostly composed of paragraphs and tables. 这些内容主要由段落和表格组成。
Paragraphs段落
A paragraph (<w:p>) is the basic unit of block-level content. 段落(<w:p>)是块级内容的基本单位。That is, it's a division of content that begins on a new line. It typically has two pieces. 也就是说,这是一个从新行开始的内容划分。它通常有两块。The formatting (or properties) for the paragraph is declared first, followed by the content.首先声明段落的格式(或属性),然后声明内容。
The formatting can be declared directly ("this paragraph shall be centered") or it can be declared indirectly by referencing a style ("this paragraph shall use the X style, which centers paragraphs"). 格式可以直接声明(“此段落应居中”),也可以通过引用样式间接声明(“该段落应使用X样式,将段落居中”。)。Or it can do a combination of both. 或者它可以兼具两者。Paragraph formatting is within a <w:pPr>.段落格式在<w:pPr>内。
The content of the paragraph is contained in one or more runs (<w:r>). 段落内容包含在一次或多次运行(<w:r>)中。Runs are non-block content; they define regions of text that do not necessarily begin on a new line. 运行是非块内容;它们定义了不一定从新行开始的文本区域。Like paragraphs, they are comprised of formatting/property definitions, followed by content. 与段落一样,它们由格式/属性定义组成,后跟内容。The formatting is specified within a <w:rPr> and can be direct formatting, indirect formatting through a style reference, or both. 格式是在<w:rPr>中指定的,可以是直接格式,也可以是通过样式引用的间接格式,或者两者兼而有之。
A run can be divided into smaller runs or runs can be combined if they have the same properties. 管路可以分为较小的管路,如果管路具有相同的特性,则可以将管路合并。So, for example, if a sentence contains one word that is bold, then the sentence must be broken up into multiple runs to account for the bold and non-bold components of the sentence. 因此,例如,如果一个句子包含一个加粗的单词,那么这个句子必须被分成多行,以说明句子中的加粗和非加粗成分。
The content of a run is comprised mostly of text elements (<w:t>), which themselves contain the actual character data that comprises read content. 运行的内容主要由文本元素(<w:t>)组成,这些元素本身包含包含读取内容的实际字符数据。A run might also contain breaks, tabs, symbols, images, and fields. 运行还可能包含打断、制表符、符号、图像和字段。Below is a sample of a very simple paragaph.下面是一个非常简单的段落示例。
Omitted from the above example, and from nearly all sample XML you'll see on this site, is the optional information that can be added to track editing sessions. 在上面的示例中,以及您将在本站点上看到的几乎所有示例XML中,省略了可以添加到跟踪编辑会话中的可选信息。Such information, typically in the form of attributes, clutter the XML you'll see as you look at the XML underlying Word documents. 这些信息通常以属性的形式出现,当您查看XML底层Word文档时,这些信息会使您看到的XML变得杂乱无章。It is omitted here for the sake of clarity. 为了清楚起见,这里省略了它。An example is shown below.示例如下所示。
Tables表格
Tables are another type of block-level content. 表是块级内容的另一种类型。A table consists of rows and columns. The specification for a table (<w:tbl>) can be broken up into three parts. 表由行和列组成。表格(<w:tbl>)的规范可以分为三部分。Like paragraphs and runs, there are first the properties, and for tables they are defined within a <w:tblPr>.与段落和运行一样,首先是属性,对于表,它们在<w:tblPr>中定义。
Unlike paragraphs and runs, however, a table divides the content into rows, and no two rows need to have the same number of columns. 然而,与段落和运行不同,表将内容划分为行,并且没有两行需要具有相同的列数。This adds a level of complexity to the definition of a table. 这增加了表定义的复杂性。WordprocessingML addresses this challenge by defining a "grid" for the table within a <w:tblGrid>. WordprocessingML通过在<w:tblGrid>中为表定义“网格”来解决这一挑战。This table grid definition is the second part of the table definition.此表格网格定义是表格定义的第二部分。