【问题标题】:C# OpenXML (Word) Table AutoFit to WindowC# OpenXML (Word) 表格自动适应窗口
【发布时间】:2013-08-03 04:59:38
【问题描述】:

打开一个包含表格的 Word (2007/2010) 文档,选择表格并右键单击,选择 AutoFit-->AutoFit to Window

如何使用 OpenXML SDK 2.5 在 C# 中实现此操作?

【问题讨论】:

  • 我已经尝试过使用生产力工具,但没有成功。

标签: c# ms-word openxml openxml-sdk


【解决方案1】:

您可以将表格的宽度设置为页面的 100%,或 5000 个百分比。

Table table = ...

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

【讨论】:

    猜你喜欢
    • 2014-09-06
    • 1970-01-01
    • 1970-01-01
    • 1970-01-01
    • 1970-01-01
    • 2010-09-22
    • 2023-03-23
    • 2017-04-29
    • 2021-05-04
    相关资源
    最近更新 更多