C#的OpenXML(字)表自动调整到窗口 [英] C# OpenXML (Word) Table AutoFit to Window

查看:363
本文介绍了C#的OpenXML(字)表自动调整到窗口的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

打开Word(2007/2010)的文件,有一个表,请选择该表并点击右键,选择自动调整 - >自动调整到窗口

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

如何我可以实现使用的OpenXML SDK 2.5在C#中这个动作?

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

推荐答案

您可以将表格的宽度设置为100%页面,或50分之5000的一%的。

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;

这篇关于C#的OpenXML(字)表自动调整到窗口的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

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