だからしばらくの間、私はこれと闘ってきました。私は良い答えで似たような質問がたくさんあることを知っています。私はこれらの答えを試しましたが、私が書いたコードは基本的に答えを反映しています。VALIGN in reportlab明らかに効果のないテーブルスタイル
私はワークシートのためのマッチング練習を自動的に生成するコードを書いています。これらの情報はすべてテーブルに入れてください。また、テキストはすべてセルの上部に揃える必要があります。ここで
は、私が今持っているものです:私は
from reportlab.lib.pagesizes import A4
from reportlab.platypus import SimpleDocTemplate, Paragraph, Table, TableStyle
from reportlab.lib.styles import getSampleStyleSheet
from reportlab.lib.units import cm
document = []
doc = SimpleDocTemplate('example.pdf', pagesize=A4, rightMargin=72, leftMargin=72, topMargin=72)
styles = getSampleStyleSheet()
definitions = []
i, a = 1, 65
table = []
for x in range(1, 10):
line = []
line.append(Paragraph(str(i), styles['BodyText']))
line.append(Paragraph('Vocabulary', styles['BodyText']))
line.append(Paragraph(chr(a), styles['BodyText']))
line.append(Paragraph('Often a multi-line definition of the vocabulary. But then, sometimes something short and sweet.', styles['BodyText']))
table.append(line)
i += 1
a += 1
t = Table(table, colWidths=(1*cm, 4*cm, 1*cm, None))
t.setStyle(TableStyle([
('VALIGN', (1, 1), (-1, -1), 'TOP')
]))
document.append(t)
doc.build(document)
何を望むのですか?
あなたのプロフィールの物語が大好きで、私は高校で私の先生が戻って同じ態度を持っていて欲しい! – B8vrede
ありがとう!私は戻ってそれをもう一度読まなければならなかったが、それでもなお真実だ。私は嘘をつくつもりはない:今日は私に数本の灰色の髪が与えられた。 –