Skip to content

Instantly share code, notes, and snippets.

@randym
Created October 11, 2013 01:26
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save randym/6928264 to your computer and use it in GitHub Desktop.
Save randym/6928264 to your computer and use it in GitHub Desktop.
axlsx hacking comment position
# 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