Skip to content

HTTPS clone URL

Subversion checkout URL

You can clone with
or
.
Download ZIP
Browse files

Fix bug in setting column width

  • Loading branch information...
commit 184968a60a5223e6645e64e1a718471a923ad3c6 1 parent 351bb54
Ana Nelson authored
Showing with 8 additions and 8 deletions.
  1. +4 −4 examples/image.rb
  2. +4 −4 lib/surpass/worksheet.rb
View
8 examples/image.rb
@@ -3,8 +3,8 @@
book = Workbook.new
-ws = book.add_sheet('Image')
-ws.insert_bitmap('examples/python.bmp', 2, 2)
-ws.insert_bitmap('examples/python.bmp', 15, 2)
-
+sheet = book.add_sheet('Image')
+sheet.set_column_width(2, 20)
+sheet.insert_bitmap('examples/python.bmp', 2, 2)
+sheet.insert_bitmap('examples/python.bmp', 15, 0)
book.save(__FILE__.gsub(/rb$/, "xls"))
View
8 lib/surpass/worksheet.rb
@@ -276,7 +276,7 @@ def write(r, c, label = "", style = nil)
if label[0].is_a?(Array)
write_arrays(r, c, label, style || true)
else
- write_array_to_row(label, r, c)
+ write_array_to_row(label, r, c, style || true)
end
else
row(r).write(c, label, style)
@@ -553,9 +553,9 @@ def row_height(row)
end
end
- def col_width(col)
- if cols.keys.include?(col)
- col.width_in_pixels
+ def col_width(column_index)
+ if cols.keys.include?(column_index)
+ cols[column_index].width_in_pixels
else
64
end
Please sign in to comment.
Something went wrong with that request. Please try again.