मैं एक टेबल का उपयोग करता हूं लेकिन, मैं प्रवाहों की स्थिति को नियंत्रित करने के लिए कैनवास में खींचता हूं, क्योंकि मेरे पास एक पीडीएफ में एक टेम्पलेट है, मैं एक पीईपीडीएफ के साथ विलय करता हूं।एक टेबल रिपोर्टलैब में टेक्स्ट लपेटें?
रैप एक टेबल में किया जाता है लेकिन टेक्स्ट ऊपर जाता है, जो मुझे उम्मीद है उतना नीचे नहीं।
ग कैनवास
कोड
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 * cm, 2.7 * cm, 9.6 * cm,
2.65 * cm, 2.7 * cm])
c = canvas.Canvas(PDF, pagesize=A4)
table.wrapOn(c, width, height)
table.drawOn(c, *coord(1.8, 9.6, cm))
c.save()
http://img600.imageshack.us/img600/3203/reportld.jpg
धन्यवाद, यह एक अच्छा समाधान है, मेरे जवाब की तरह हैक नहीं। – Alquimista
टेबल शैली ('वैल्यून', (0,0), (- 1, -1), 'TOP) – Alquimista
सहायता के लिए कुछ स्वीकृति। बहुत बुरा, रिपोर्टलैब लंबी तालिका का समर्थन नहीं करता है, अन्यथा यह एक महान पीडीएफ रिपोर्ट निर्माता होगा। –