Changed the names of the styles of tables and fixed a col width error (which weren't used, but will be in the webapp)

svn: r13580
This commit is contained in:
Doug Blank 2009-11-14 22:50:19 +00:00
parent 02d095ca8c
commit b5ca175f2b
2 changed files with 11 additions and 9 deletions

View File

@ -137,10 +137,10 @@ def make_basic_stylesheet():
sheet.add_cell_style("TableHead",cell)
cell = TableCellStyle()
sheet.add_cell_style("TableNormalCell",cell)
sheet.add_cell_style("TableHeaderCell",cell)
cell = TableCellStyle()
cell.set_longlist(1)
sheet.add_cell_style("TableListCell",cell)
sheet.add_cell_style("TableDataCell",cell)
return sheet

View File

@ -284,15 +284,17 @@ class SimpleTable(object):
else:
self.__rows.sort(lambda a, b: cmp(a[idx],b[idx]))
def write(self, document):
def write(self, document, link=False):
self.simpledoc = document # simpledoc; simpledoc.doc = docgen object
if self.simpledoc.doc.type == "standard":
doc = self.simpledoc.doc
doc.start_table('simple','Table')
columns = len(self.__columns)
doc.start_table('simple', 'Table')
doc._tbl.set_column_widths([100/columns] * columns)
doc._tbl.set_columns(columns)
if self.title:
doc.start_row()
doc.start_cell('TableHead',columns)
doc.start_cell('TableHead', span=columns)
doc.start_paragraph('TableTitle')
doc.write_text(_(self.title))
doc.end_paragraph()
@ -302,15 +304,15 @@ class SimpleTable(object):
self.__sort()
doc.start_row()
for col in self.__columns:
doc.start_cell('TableNormalCell',1)
doc.write_text(col,'TableTitle')
doc.start_cell('TableHeaderCell', span=1)
doc.write_text(col, 'TableTitle')
doc.end_cell()
doc.end_row()
for row in self.__rows:
doc.start_row()
for col in row:
doc.start_cell('TableNormalCell',1)
doc.write_text(col,'Normal')
doc.start_cell('TableDataCell', span=1)
doc.write_text(col, 'Normal')
doc.end_cell()
doc.end_row()
doc.end_table()