Skip to content

Commit

Permalink
show tables with percentage widths
Browse files Browse the repository at this point in the history
  • Loading branch information
dj2 committed Feb 27, 2011
1 parent 056725b commit f7bbfc0
Show file tree
Hide file tree
Showing 2 changed files with 3 additions and 3 deletions.
4 changes: 2 additions & 2 deletions bin/rtf_parse
Original file line number Diff line number Diff line change
Expand Up @@ -86,11 +86,11 @@ doc.sections.each do |section|
mods = section[:modifiers]

if mods[:table]
str << "<table>\n"
str << "<table width=\"100%\">\n"
mods[:table].rows.each do |row|
str << "<tr>\n"
row.cells.each do |cell|
str << "<td width=\"#{cell.width}\">\n"
str << "<td width=\"#{cell.width}%\">\n"
cell.sections.each do |sect|
format(str, sect)
end
Expand Down
2 changes: 1 addition & 1 deletion lib/ruby-rtf/table.rb
Original file line number Diff line number Diff line change
Expand Up @@ -64,7 +64,7 @@ def width
end_pos = row.end_positions[idx]
prev_pos = idx == 0 ? 0 : row.end_positions[idx - 1]

end_pos - prev_pos - (2 * gap) - left_margin
((end_pos - prev_pos - (2 * gap) - left_margin) / row.end_positions[-1]) * 100
end
end
end
Expand Down

0 comments on commit f7bbfc0

Please sign in to comment.