Created
October 11, 2013 01:26
-
-
Save randym/6928264 to your computer and use it in GitHub Desktop.
axlsx hacking comment position
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
# Hacking comment position! | |
# Use at your own risk :) | |
# add_comment is the preferred way to add comments to your worksheet. However, if you really need to position a | |
# a specific comment, here is one way to do it. | |
require 'axlsx' | |
p = Axlsx::Package.new | |
wb = p.workbook | |
wb.add_worksheet(:name => 'comments') do |sheet| | |
sheet.add_row ['Can we build it?', 'Yes we can!'] | |
sheet.add_comment(:ref => 'A1', :author => 'Bob', :text => 'Yes We Can!').tap do |comment| | |
comment.vml_shape.top_row = 1 | |
comment.vml_shape.left_column = 1 | |
comment.vml_shape.bottom_row = 20 | |
comment.vml_shape.right_column = 5 | |
end | |
end | |
p.serialize 'comments.xlsx' |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment