.net - 使用 open xml sdk 代码,如何调整表格(在 ms word 文档中)以适应页边距?

标签 .net ms-word openxml wordprocessingml

我正在使用 微软开放 XML SDK 生成word文档。我用过 Open XML SDK 2.0 生产力工具 用于将 word 文档转换为 C# 代码,因此我通过封装表创建代码创建了一个包装器类。我已经成功生成了word文档。

But the issue is, some tables are expanding in their width beyondpage margins. I searched in google, and found that GrowAutoFit class allows Tables to AutoFit into page margins, but I couldn't find the exact usage of this class to implement the functionality.



在在这里提问之前,我搜索了很多天,因为我已经阅读了在这个论坛上提问的条款。 我厌倦了搜索,我在这里提出这个查询。所以请给我建议解决方案。

最佳答案

我找到了自己问题的答案。

The reason for the tables extending out of page was that i had set page margins as zero in the code. So, after i set the page margins as 1 inch on all sides, the tables are not extending out of margins.

Thanks to the Office Open XML SDK Productivity tool, which shows the native XML code, and also the C# code when a word document is opened in it. And becuase of this tool, i was able to figure out the issue.



感谢您的建议马克西米利安 :)

关于.net - 使用 open xml sdk 代码,如何调整表格(在 ms word 文档中)以适应页边距?,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/8150048/

相关文章:

html - 如何将 Microsoft word para/range 转换为 html?

c# - 在 Word 文档的开头插入文本 - openXML

java - 如何在 Java Web 应用程序中将 WordML 转换为 Office Open XML?

.net - .NET 5.0 发布后是否需要 .NET Standard

c# - 查找数字数组中丢失的元素

c# - 如何将 System.Drawing.Color 转换为 Microsoft Interop WdColorIndex

vba - 如何拆分邮件合并并以合并字段作为名称保存文件

openxml-sdk - <a :theme> mean in OpenXML? 是什么

c# - 在解决方案之间共享项目时的 NuGet

.net - ".NETFramework"目录中缺少 "Program Files"目录