C# OpenXML (Word) Table AutoFit to Window

我怕爱的太早我们不能终老 提交于 2019-12-05 22:32:18

问题


Open a Word (2007/2010) document that has a table in it, select the table and right click, select AutoFit-->AutoFit to Window

How can I implement this action in C# using the OpenXML SDK 2.5?


回答1:


You can set the width of the table to 100% of the page, or 5000 fiftieths-of-a-percent.

Table table = ...

TableWidth width = table.GetDescendents<TableWidth>().First();
width.Width = "5000";
width.Type = TableWidthUnitValues.Pct;


来源:https://stackoverflow.com/questions/18025424/c-sharp-openxml-word-table-autofit-to-window

易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!