Fixed table sizes so they don't exceed page width

svn: r148
This commit is contained in:
Don Allingham 2001-06-16 19:02:56 +00:00
parent 6b0705761d
commit 1b72252c8f

View File

@ -81,6 +81,8 @@ class PdfDoc(TextDoc):
self.doc = GrampsDocTemplate(self.filename, self.doc = GrampsDocTemplate(self.filename,
pagesize=self.pagesize, pagesize=self.pagesize,
allowSplitting=1,
_pageBreakQuick=0,
leftMargin=self.lmargin*cm, leftMargin=self.lmargin*cm,
rightMargin=self.rmargin*cm, rightMargin=self.rmargin*cm,
topMargin=self.tmargin*cm, topMargin=self.tmargin*cm,
@ -189,10 +191,11 @@ class PdfDoc(TextDoc):
self.tblstyle = [] self.tblstyle = []
self.cur_table_cols = [] self.cur_table_cols = []
width = (float(self.cur_table.get_width())/100.0) * self.get_usable_width() * cm width = float(self.cur_table.get_width()/100.0) * self.get_usable_width()
for val in range(self.cur_table.get_columns()): for val in range(self.cur_table.get_columns()):
percent = float(self.cur_table.get_column_width(val))/100.0 percent = float(self.cur_table.get_column_width(val))/100.0
self.cur_table_cols.append(width * percent) self.cur_table_cols.append(width * percent * cm)
def end_table(self): def end_table(self):
ts = reportlab.platypus.tables.TableStyle(self.tblstyle) ts = reportlab.platypus.tables.TableStyle(self.tblstyle)
@ -200,7 +203,6 @@ class PdfDoc(TextDoc):
colWidths=self.cur_table_cols, colWidths=self.cur_table_cols,
style=ts) style=ts)
self.story.append(tbl) self.story.append(tbl)
# self.story.append(Spacer(1,0.5*cm))
self.in_table = 0 self.in_table = 0
def start_row(self): def start_row(self):