我正在使用 微软开放 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/