答案1
该类LongTable
有generate_tex
方法,因此你可以执行
from pylatex import LongTable, MultiColumn
# Generate data table
data_table = LongTable('lll')
data_table.add_hline()
data_table.add_row(["header 1", "header 2", "header 3"])
data_table.add_hline()
data_table.end_table_header()
data_table.add_hline()
data_table.add_row((MultiColumn(3, align='r',
data='Containued on Next Page'),))
data_table.add_hline()
data_table.end_table_footer()
data_table.add_hline()
data_table.add_row((MultiColumn(3, align='r',
data='Not Containued on Next Page'),))
data_table.add_hline()
data_table.end_table_last_footer()
row = ["Content1", "9", "Longer String"]
for i in range(150):
data_table.add_row(row)
data_table.generate_tex('tablefile')
创建一个tablefile.tex
仅包含longtable
环境的文件。