相关疑难解决方法(0)

在表reportlab中换行文本?

我使用一个表但是,我在画布中绘制来控制flowables的位置,这是因为我在pdf中有一个模板,我与pyPDF合并.

换行是在一张桌子上完成的,但是文字上升了,而不是我希望的那样.

c是画布

from reportlab.pdfgen import canvas
from reportlab.lib.pagesizes import A4
from reportlab.lib.styles import getSampleStyleSheet
from reportlab.platypus import Paragraph, Table
from reportlab.lib.units cm

width, height = A4
styles = getSampleStyleSheet()

def coord(x, y, unit=1):
    x, y = x * unit, height -  y * unit
    return x, y

descrpcion = Paragraph('long paragraph', styles["Normal"])
partida = Paragraph('1', styles["Center"])
candidad = Paragraph('120', styles["Center"])
precio_unitario = Paragraph('$52.00', styles["right"])
precio_total = Paragraph('$6240.00', styles["right"])

data= [[partida, candidad, descrpcion, precio_unitario, precio_total]]
table = Table(data, colWidths=[2.05 …
Run Code Online (Sandbox Code Playgroud)

python reportlab

18
推荐指数
2
解决办法
3万
查看次数

标签 统计

python ×1

reportlab ×1