word 设置表格自适应
描述 : 我们经常从 外部 如 excel,html 等其他文件 中复制的表格到word 文档 出现在 word 中显示不全的问题
解决方案 使用 word 宏工具
在当前word文档中 按 alt + F11 快捷键
然后
附 图中代码如下:(尽情的复制吧)
Private Sub Document_Open()
Application.Browser.Target = wdBrowseTable
For i = 1 To ActiveDocument.Tables.Count
ActiveDocument.Tables(i).AutoFitBehavior (wdAutoFitContent) \'根据内容自动调整表格
ActiveDocument.Tables(i).AutoFitBehavior (wdAutoFitWindow) \'根据窗口自动调整表格
ActiveDocument.Tables(i).Range.ParagraphFormat.Alignment = wdAlignParagraphCenter \'水平居中
ActiveDocument.Tables(i).Range.ParagraphFormat.Alignment = wdCellAlignVerticalCenter \'垂直居中
Next i
End Sub
附代码如下
注意一定不要忘记 点击 保存按钮
方法缘于 博客园大神 传送门:https://www.cnblogs.com/jiangxin/p/5579885.html