I am pretty new to ruby and trying to format all columns generated to text for the excel file.
I have got a function as below
def writeXlsx(columnNames, templateName)
@xlsx = Axlsx::Package.new # create xlsx doc
@xlsx.use_autowidth = true
@xlsxSheet = @xlsx.workbook.add_worksheet(:name => templateName)
@unlocked = @xlsx.workbook.styles.add_style(:locked => false)
@xlsxSheet.col_style(0,@unlocked)
@xlsxSheet.add_row columnNames, :types => string
@xlsx.serialize(File.join(@outputFolder, "#{templateName}.xlsx"))
end
this errors out saying col_style undefined method. Can you please tell me what I am doing wrong?
-ela
Copyright Notice:Content Author:「ela」,Reproduced under the CC 4.0 BY-SA copyright license with a link to the original source and this disclaimer.
Link to original article:https://stackoverflow.com/questions/30769487/how-to-format-whole-column-for-an-excel-using-axlsx-ruby