简体   繁体   中英

Long table using kable - knit Word and “Repeat Header Rows” function

I have very long tables and I would like to knit a word document using kable.

By default, "Repeat Header Rows" function is disabled and I hope to enable it, rather than clicking the button several times.

Any idea would be much appreciated. Thanks.

长桌

I found a solution using the ReporteRs package.

By default, when I use addFlexTable and vanilla.table function of ReporteRs, I can get what I wanted (Repeat Header Rows).

addFlexTable(myDoc , vanilla.table(iris))

Actually you can do it with VBA in Word.

Press Alt + F11 and paste this script and run.

Sub RepeatTableHeadings()

  Dim tbl As Table

  For Each tbl In ActiveDocument.Tables
    tbl.Rows(1).HeadingFormat = True
  Next tbl

End Sub

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM