Table Style in Writerfilter
<?xml version="1.0" encoding="gb2312"?> <!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Strict//EN"
"http://www.w3.org/TR/xhtml1/DTD/xhtml1-strict.dtd">
<html xmlns="http://www.w3.org/1999/xhtml" lang="en" xml:lang="en"> <head> <title>Table style refers to table's border styles, text's font properties, background color. It is mainly decided by styles.xml from Office Open XML.</title> <meta http-equiv="Content-Type" content="text/html;charset=gb2312"/> <meta name="title" content="Table style refers to table's border styles, text's font properties, background color. It is mainly decided by styles.xml from Office Open XML."/> <meta name="generator" content="Org-mode"/> <meta name="generated" content="2012-08-14 19:44:50 "/> <meta name="author" content=""/> <meta name="description" content=""/> <meta name="keywords" content=""/> <style type="text/css">
<![CDATA[/*>
</style> <script type="text/javascript"> <![CDATA[/*> </script>
</head> <body>
Contents
- 1 Table style refers to table's border styles, text's font properties, background color. It is mainly decided by styles.xml from Office Open XML.
- 1.1 Background Color
- 1.2 Table of Contents
- 1.3 1 firstRow #first row
- 1.4 2 lastRow #last row
- 1.5 3 firstCol #first column
- 1.6 4 lastCol #last column
- 1.7 5 band1Vert #odd column
- 1.8 6 band2Vert #even column
- 1.9 7 band1Horz #odd row
- 1.10 8 band2Horz #even row
- 1.11 9 neCell #last cell in first row
- 1.12 10 nwCell #first cell in first row
- 1.13 11 seCell #last cell in last row
- 1.14 12 swCell #first cell in last row
- 1.15 13 firstRow
- 1.16 14 lastRow
- 1.17 15 firstCol
- 1.18 16 lastCol
- 1.19 17 band1Vert
- 1.20 18 band2Vert
- 1.21 19 band1Horz
- 1.22 20 band2Horz
- 1.23 Font Properties
- 1.24 Border Styles
Table style refers to table's border styles, text's font properties, background color. It is mainly decided by styles.xml from Office Open XML.
Assume there is styles.xml from docx as below: <w:style w:type="table" w:styleId="DarkList-Accent2"> <w:tcPr> <w:shd w:val="clear" w:color="auto" w:fill="C0504D" w:themeFill="accent2"/> </w:tcPr> # … <w:tblStylePr w:type="firstRow"> <w:pPr> <w:spacing w:before="0" w:after="0" w:line="240" w:lineRule="auto"/> </w:pPr> <w:rPr> <w:b/> <w:bCs/> <w:color w:val="FFFFFF" w:themeColor="background1"/> </w:rPr> <w:tblPr/> <w:tcPr> <w:tcBorders> <w:top w:val="single" w:sz="18" w:space="0" w:color="auto"/> <w:left w:val="nil"/> <w:bottom w:val="single" w:sz="18" w:space="0" w:color="auto"/> <w:right w:val="nil"/> <w:insideH w:val="nil"/> <w:insideV w:val="nil"/> </w:tcBorders> <w:shd w:val="clear" w:color="auto" w:fill="4BACC6" w:themeFill="accent5"/> </w:tcPr> </w:tblStylePr> </w:style>
Background Color
Include cell/row/table's background color.
wholeTable
The w:tcPr under w:style is applied for whole table. So, the background color of whole table should be applied with fill color "C0504D" and its theme should be "accent2".
<w:style w:type="table" w:styleId="DarkList-Accent2"> <w:tcPr> <w:shd w:val="clear" w:color="auto" w:fill="C0504D" w:themeFill="accent2"/> </w:tcPr> </w:style>
firstRow and others
For first row of table, below firstRow tblStylePr will be applied with fill color "4BACC6" and its theme should be "accent5". It will overwrite related color and theme from whole table mentioned above.
<w:tblStylePr w:type="firstRow"> # … <w:tcPr> # … <w:shd w:val="clear" w:color="auto" w:fill="4BACC6" w:themeFill="accent5"/> </w:tcPr> </w:tblStylePr>
There can be also up to 12 types of tblStyle here. They are:
Table of Contents
- <a href="#sec-1">1 firstRow #first row</a>
- <a href="#sec-2">2 lastRow #last row</a>
- <a href="#sec-3">3 firstCol #first column</a>
- <a href="#sec-4">4 lastCol #last column</a>
- <a href="#sec-5">5 band1Vert #odd column</a>
- <a href="#sec-6">6 band2Vert #even column</a>
- <a href="#sec-7">7 band1Horz #odd row</a>
- <a href="#sec-8">8 band2Horz #even row</a>
- <a href="#sec-9">9 neCell #last cell in first row</a>
- <a href="#sec-10">10 nwCell #first cell in first row</a>
- <a href="#sec-11">11 seCell #last cell in last row</a>
- <a href="#sec-12">12 swCell #first cell in last row</a>
- <a href="#sec-13">13 firstRow</a>
- <a href="#sec-14">14 lastRow</a>
- <a href="#sec-15">15 firstCol</a>
- <a href="#sec-16">16 lastCol</a>
- <a href="#sec-17">17 band1Vert</a>
- <a href="#sec-18">18 band2Vert</a>
- <a href="#sec-19">19 band1Horz</a>
- <a href="#sec-20">20 band2Horz</a>
1 firstRow #first row
2 lastRow #last row
3 firstCol #first column
4 lastCol #last column
5 band1Vert #odd column
6 band2Vert #even column
7 band1Horz #odd row
8 band2Horz #even row
9 neCell #last cell in first row
10 nwCell #first cell in first row
11 seCell #last cell in last row
12 swCell #first cell in last row
tblLook and cnfStyle
With above basic knowledge, we now can get further. For example, for the first cell in first row, which tblStyle should take effect, firstRow, firstCol, nwCell? Which one has highest priority? The answer is it depends on the tblLook of whole table, cnfStyle of the row and the cell.
Take below cell in a table from document.xml for example:
<w:tbl> <w:tblPr> # … <w:tblLook w:val="04A0" w:firstRow="1" w:lastRow="0" w:firstColumn="1" w:lastColumn="0" w:noHBand="0" w:noVBand="1"/> </w:tblPr> <w:tr w:rsidR="001662F7" w:rsidTr="00C76FCB"> <w:trPr> <w:cnfStyle w:val="100000000000" w:firstRow="1" w:lastRow="0" w:firstColumn="0" w:lastColumn="0" w:oddVBand="0" w:evenVBand="0" w:oddHBand="0" w:evenHBand="0" w:firstRowFirstColumn="0" w:firstRowLastColumn="0" w:lastRowFirstColumn="0" w:lastRowLastColumn="0"/> </w:trPr> <w:tc> <w:tcPr> <w:cnfStyle w:val="001000000100" w:firstRow="0" w:lastRow="0" w:firstColumn="1" w:lastColumn="0" w:oddVBand="0" w:evenVBand="0" w:oddHBand="0" w:evenHBand="0" w:firstRowFirstColumn="1" w:firstRowLastColumn="0" w:lastRowFirstColumn="0" w:lastRowLastColumn="0"/> <w:tcW w:w="4261" w:type="dxa"/> </w:tcPr> # … </w:tc> </w:tr> </w:tbl>
Based on description from <a href="#Office-Open-XML">Office Open XML</a>, tblLook decides whether following tblStyle can be applied on table or not:
13 firstRow
14 lastRow
15 firstCol
16 lastCol
17 band1Vert
18 band2Vert
19 band1Horz
20 band2Horz
That means, even there is firstRow tblStyle exisiting in styles.xml, if tblLook forbids using firstRow, you should not expect to apply it on the row.
Font Properties
Including font size, bold, italic, color, strike-through, underline, and so on.
Border Styles
Including border's style, color, and so on.
<a href="#Category-Office-Open-XML">Category:Office Open XML</a> <a href="#Category-Filter">Category:Filter</a>
Date: 2012-08-14 19:44:50
Org version 7.8.11 with Emacs version 24
<a href="http://validator.w3.org/check?uri=referer">Validate XHTML 1.0</a>
</body> </html>