This commit is contained in:
Kovid Goyal 2007-07-30 05:34:46 +00:00
parent 5e2ed7fb4d
commit a79376875c
2 changed files with 14 additions and 9 deletions

View File

@ -1235,15 +1235,15 @@ class HTMLConverter(object):
def process_table(self, tag, tag_css):
self.end_current_block()
colpad = 10
table = Table(self, tag, tag_css, rowpad=10, colpad=10)
rowpad = 10
table = Table(self, tag, tag_css, rowpad=rowpad, colpad=10)
canvases = []
for block, xpos, ypos, delta in table.blocks(int(self.current_page.pageStyle.attrs['textwidth'])):
if not block:
canvases.append(Canvas(int(self.current_page.pageStyle.attrs['textwidth']), ypos+colpad,
canvases.append(Canvas(int(self.current_page.pageStyle.attrs['textwidth']), ypos+rowpad,
blockrule='block-fixed'))
else:
canvases[-1].put_object(block, xpos + int(delta/2.), 0)
canvases[-1].put_object(block, xpos + int(delta/2.), ypos)
for canvas in canvases:
self.current_page.append(canvas)

View File

@ -184,7 +184,11 @@ class Cell(object):
self.pts_to_pixels(attrs.get('linespace', ts['linespace']))
ws = self.pts_to_pixels(attrs.get('wordspace', ts['wordspace']))
if isinstance(token, int): # Handle para and line breaks
top = bottom
if top != bottom: #Previous element not a line break
top = bottom
else:
top += ls
bottom += ls
left = parindent if int == 1 else 0
continue
if isinstance(token, Plot):
@ -310,7 +314,7 @@ class Table(object):
def get_widths(self, maxwidth):
'''
Return widths of columns + sefl.colpad
Return widths of columns + self.colpad
'''
rows, cols = self.number_or_rows(), self.number_of_columns()
widths = range(cols)
@ -376,16 +380,17 @@ class Table(object):
cell = cellmatrix[r][c]
if not cell:
continue
width = sum(widths[c:c+cell.colspan])
width = sum(widths[c:c+cell.colspan])-self.colpad*cell.colspan
sypos = 0
for tb in cell.text_blocks:
tb.blockStyle = self.conv.book.create_block_style(
blockwidth=width,
blockheight=cell.text_block_size(tb, width)[1])
blockheight=cell.text_block_size(tb, width)[1],
blockrule='horz-fixed')
yield tb, xpos[c], sypos, delta
sypos += tb.blockStyle.attrs['blockheight']