我正在尝试在使用 ReportLab 生成的 PDF 文件中构建一个日程规划器。根据一天中的不同时间,时间表将具有不同的行:从上午 8:00 开始、上午 8:15、上午 8:30 等。
\n我做了一个循环,其中将自动计算时间并填写时间表。但是,由于我的表格太长,它不能完全适合页面。(虽然行程应该在晚上7:30结束,但在下午2:00就被剪掉了)
\n期望的结果是当表中有大约 20 个活动时有一个分页符。在下一页上,标题应该与第一页和下面的表格完全相同。每次有必要时都应重复该过程,直到表结束。
\n\nPython代码如下:
\nfrom reportlab.pdfgen.canvas import Canvas\nfrom datetime import datetime, timedelta\nfrom reportlab.platypus import Table, TableStyle\nfrom reportlab.lib import colors\nfrom reportlab.lib.pagesizes import letter, landscape\n\n\nclass Vendedor:\n """\n Informaci\xc3\xb3n del Vendedor: Nombre, sucursal, meta de venta\n """\n def __init__(self, nombre_vendedor, sucursal, dia_reporte):\n self.nombre_vendedor = nombre_vendedor\n self.sucursal = sucursal\n self.dia_reporte = dia_reporte\n\n\nclass Actividades:\n """\n Informaci\xc3\xb3n de las Actividades realizadas: Hora de actividad y duraci\xc3\xb3n, cliente atendido,\n tipo de …Run Code Online (Sandbox Code Playgroud)