How to format all the columns of the generated xlsx file to text.

64 views
Skip to first unread message

ela

unread,
Jun 9, 2015, 4:35:45 AM6/9/15
to ax...@googlegroups.com
Hi,

I have got some ruby code generating the xlsx files
The xlsx file just has the header set. (only the first row with columnnames)

And I need to set all the columns to text format.

def writeXlsx(columnNames, templateName)
@xlsx = Axlsx::Package.new # create xlsx doc
@xlsx.use_autowidth = true
@xlsxSheet = @xlsx.workbook.add_worksheet(:name => templateName)
@xlsxSheet.add_row columnNames, :style => :string

@xlsx.serialize(File.join(@outputFolder, "#{templateName}.xlsx"))
end


The above code does not work. The format of the column is always general. I could not figure out what should be done for this. Can anyone tell me what should be done please?


Ela

Reply all
Reply to author
Forward
0 new messages