admin 管理员组文章数量: 887021
基本上,您将在一个页面中保留单独的行,在它们之间Word可以自由地拆分表。Here是VBA中对解决方案的描述,让我复制答案,以防链接在某个时候失效。(对于具有垂直合并单元格的表,可以通过链接找到更复杂的解决方案。)If you need to keep the whole table on a single page, format all the paragraphs except the last on each row with the 'keep with next' attribute. to do that, you might use code like:Dim Tbl As Table, lRow As Long, Rng As Range
With Tbl
lRow = .Rows.Count
Set Rng = ActiveDocument.Range(.Rows(1).Range.Start, .Rows(lRow - 1).Range.End)
.Rows.AllowBreakAcrossPages = False
.Rows.First.HeadingFormat = True
With .Range.ParagraphFormat
.SpaceBeforeAuto = False
.SpaceAfterAuto = False
.WidowControl = True
.KeepWithNext = False
.KeepTogether = False
.PageBreakBefore = False
.WordWrap = True
End With
With Rng.ParagraphFormat
.KeepWithNext = True
.KeepTogether = True
End With
End With
Set Rng = Nothing: Set Tbl = NothingThe line ' .Rows.First.HeadingFormat = True' ensures that, if the table is too long to fit on a whole page, the heading row will appear on the subsequent pages also.
版权声明:本文标题:python docx run断开_如何在python docx中限制行拆分为下一页 内容由网友自发贡献,该文观点仅代表作者本人, 转载请联系作者并注明出处:http://www.freenas.com.cn/jishu/1726310900h934396.html, 本站仅提供信息存储空间服务,不拥有所有权,不承担相关法律责任。如发现本站有涉嫌抄袭侵权/违法违规的内容,一经查实,本站将立刻删除。
发表评论