Hello, I am trying to generate an xlsx file. When I generate it, I can open it with all software like LibreOffice Calc, but when I open it with OneDrive in Microsoft Office Excel, it gives me an error. I am using axlsx 2.0.1 and Ruby 2.7.1. Can someone help me?
The code I use (greatly simplified as a generic example) is this::
require 'axlsx'
Axlsx::Package.new do |p|
p.use_shared_strings = true # Asegúrate de que esta opción esté configurada
p.use_autowidth = true # Esta opción ajusta automáticamente el ancho de las columnas
p.workbook.add_worksheet(name: 'Sheet1') do |sheet|
sheet.add_row ['Name', 'Age', 'Gender']
sheet.add_row ['name1', 'age1', 'gender1']
sheet.add_row ['name2',' age2', 'gender2']
end
p.serialize('example.xlsx')
send_file 'example.xlsx'
end