openxml的style语法定义,备份

openxml中的风格定义对应的xml语法定义:



3071
3072
3073
3074
3075
3076
3077
3078
3079
3080
3081
3082
3083
3084
3085
3086
3087
3088
3089
3090
3091
3092
3093
3094

3095
3096
3097
3098
3099


style的层级覆盖优先关系:

This process can be described as follows:
 First, the document defaults are applied to all runs and paragraphs in the document.

run:是字符一级,paragraph:是段落
对run和paragraph,最优先的是default
而table和listitem根本没有default


 Next, the table style properties are applied to each table in the document, following the conditional
formatting inclusions and exclusions specified per table.

然后,table属性会应用到table,run和paragraph,但是不对listitem生效


 Next, numbered item and paragraph properties are applied to each paragraph formatted with a
numbering style.

然后是编号项目和段落,也许编号项目本身的style不会定义段落格式,所以会使用两个style来描述编号项目


 Next, paragraph and run properties are applied to each paragraph as defined by the paragraph style.
 Next, run properties are applied to each run with a specific character style applied.

对于段落和run,显示paragraph然后是character被用到文字上


 Finally, we apply direct formatting (paragraph or run properties not from styles). If this direct formatting
includes numbering, that numbering + the associated paragraph properties are applied.

最后是直接写在段落和run上属性


If the value of the rFonts element (§17.3.2.26) references a font which is not available, applications determine a
suitable alternative font via a process called font substitution, which is defined in §17.8.2.

最后一段,还有个font substitution


看了一遍,style的有用属性/子元素,只有下面这几个需要关注
type:
貌似也没有分析的必要。word判断一段文字是否能应用这个style的时候,应该会看这个style的type,读取分析过程,应该不用管

styleid

以styleid为主要识别id

name
可能只要在显示错误信息的时候,要用这个值,作为友好信息

basedon:
指定父Style。继承关系的意思。
继承可以多层。
只有相同类型的style之间才能继承。
如:paragraph继承paragraph,如果类型不匹配则ignore


linked:
将两个style链接在一起,作为一个整体应用到段落和文字

 If the parent style is a table style, then this element shall be ignored.
 If the parent style is a paragraph style, then this element’s val attribute must refer to a character style,
or this element shall be ignored.
 If the parent style is a character style, then this element’s val attribute must refer to a paragraph style,
or this element shall be ignored.
 If the parent style is a numbering style, then this element shall be ignored.

paragraph只能link character
character只能link paragraph
table和numbering都要ignore掉link属性


next:
说明应用了这个style的paragraph之后的paragraph,默认使用什么style
如果这个元素在paragraph类的style之外的style中出现,则被ignore
如果这个元素没有出现,则下一paragraph的style使用和上一段相同的style



你可能感兴趣的:(office)