从Word OpenXml获取Table RowHeight和Table Cell Width [英] get Table RowHeight and Table Cell Width from Word OpenXml

查看:682
本文介绍了从Word OpenXml获取Table RowHeight和Table Cell Width的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我想知道如何从单词openxml获取表格的行高和单元格宽度。

I would like to know how I can get the row height and cell width of a table from word openxml.

推荐答案

Hi JayashriYadav,
<谢谢你的问题。

为了获得行高,你可以参考财产"Val"。 of TableRow \TableRowProperty \ TableRowHeight;要获得单元格宽度,可以参考属性"宽度"。 TableCell \TableCellProperty \TableCellWidth。

以下是2 * 2表格的示例xml:


< w:tbl xmlns:w =" http://schemas.openxmlformats.org/wordprocessingml/2006/main">

Hi JayashriYadav,

Thanks for your question.

To get the row height, you could refer to property "Val" of TableRow\TableRowProperty\TableRowHeight; to get the cell width, you could refer to property "Width" of TableCell\TableCellProperty\TableCellWidth.

Below is the example xml for a 2*2 table:

<w:tbl xmlns:w="http://schemas.openxmlformats.org/wordprocessingml/2006/main">

< w:tblPr>

<w:tblPr>

< w:tblStyle w:val =" TableGrid" />

<w:tblStyle w:val="TableGrid" />

< w:tblW w:w =" 0"瓦特:类型= QUOT;汽车" />

<w:tblW w:w="0" w:type="auto" />

< w:tblLook w:val =" 04A0"瓦特:FIRSTROW = QUOT 1 QUOT;瓦特:LASTROW = QUOT; 0"瓦特:firstColumn = QUOT 1 QUOT;瓦特:lastColumn = QUOT; 0"瓦特:noHBand = QUOT; 0"瓦特:noVBand = QUOT 1 QUOT; />

<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:tblPr>

< w:tblGrid>

<w:tblGrid>

< ; w:gridCol w:w =" 3438" />

<w:gridCol w:w="3438" />

< w:gridCol w:w =" 6138" />

<w:gridCol w:w="6138" />

< / w:tblGrid>

</w:tblGrid>

< w:tr w:rsidR =" 00D97275" w:rsidTr =" 00D97275">

<w:tr w:rsidR="00D97275" w:rsidTr="00D97275">

< w:tc>

<w:tc>

< w:tcPr>

<w:tcPr>

< w:tcW w:w =" 3438"瓦特:类型= QUOT; DXA" />

<w:tcW w:w="3438" w:type="dxa" />

< / w:tcPr>

</w:tcPr>

< w:p w:rsidR =" 00D97275" w:rsidRDefault =" 00D97275">

<w:p w:rsidR="00D97275" w:rsidRDefault="00D97275">

< w:bookmarkStart w:name =" _GoBack"瓦特:ID = QUOT; 0" />

<w:bookmarkStart w:name="_GoBack" w:id="0" />

< w:bookmarkEnd w:id =" 0" />

<w:bookmarkEnd w:id="0" />

< / w:p>

</w:p>

< / w:tc>

</w:tc>

< w:tc>

<w:tc>

< w:tcPr>

<w:tcPr>

< w:tcW w:w =" 6138"瓦特:类型= QUOT; DXA" />

<w:tcW w:w="6138" w:type="dxa" />

< / w:tcPr>

</w:tcPr>

< w:p w:rsidR =" 00D97275"瓦特:rsidRDefault = QUOT; 00D97275" />

<w:p w:rsidR="00D97275" w:rsidRDefault="00D97275" />

< / w:tc>

</w:tc>

< / w:tr>

</w:tr>

< w:tr w:rsidR =" 00D97275" w:rsidTr =" 00D97275">

<w:tr w:rsidR="00D97275" w:rsidTr="00D97275">

< w:trPr>

<w:trPr>

< w:trHeight w:val = " 521" />

< / w:trPr>

</w:trPr>

< w:tc>

<w:tc>

< w:tcPr>

<w:tcPr>

< w:tcW w:w =" 3438"瓦特:类型= QUOT; DXA" />

< / w:tcPr>

</w:tcPr>

< w:p w:rsidR =" 00D97275"瓦特:rsidRDefault = QUOT; 00D97275" />

<w:p w:rsidR="00D97275" w:rsidRDefault="00D97275" />

< / w:tc>

</w:tc>

< w:tc>

<w:tc>

< ; w:tcPr>

<w:tcPr>

< w:tcW w:w =" 6138"瓦特:类型= QUOT; DXA" />

<w:tcW w:w="6138" w:type="dxa" />

< / w:tcPr>

</w:tcPr>

< w:p w:rsidR =" 00D97275"瓦特:rsidRDefault = QUOT; 00D97275" />

<w:p w:rsidR="00D97275" w:rsidRDefault="00D97275" />

< / w:tc>

</w:tc>

< / w:tr>

</w:tr>

< / w:tbl>

</w:tbl>


这篇关于从Word OpenXml获取Table RowHeight和Table Cell Width的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

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