I am using axlsx gem to create excel sheets. I am trying to generate a report in which there is a heading. I would like to add comments to each cell that contains heading text. I can do it normally in Libre office calc by right clicking on the cell and selecting Insert Comment. I would like to do the same while trying to generate an excel sheet using a ruby program.
My code looks as shown below:
wb = xlsx_package.workbook
style_shout = wb.styles.add_style sz: 12, b: true, alignment: { horizontal: :center }
choices = ["Title", "First Name","Last Name", "Company","ID Number", "Email ID"]
# Build the Excel
wb.add_worksheet(name: "users_list") do |sheet|
sheet.add_row choices.flatten, :style => style_shout
end
The documentation of axlsx shows a add_comment method, that is used to add a comment to a sheet. I would like to add comment to a particular cell. Can someone help me out with this?