-
-
Save znz/a6de602c03fbd6e50c172437a855f4dd to your computer and use it in GitHub Desktop.
Excel and LibreOffice behave differently.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
# -*- coding: utf-8 -*- | |
# frozen_string_literal: true | |
require 'axlsx' | |
package = Axlsx::Package.new | |
package.use_shared_strings = true # for Numbers | |
wb = package.workbook | |
gridstyle_border = wb.styles.add_style border: { style: :thin, color: 'FFCDCDCD' } | |
wb.add_worksheet do |sheet| | |
sheet.sheet_view.show_grid_lines = false | |
sheet.add_row [] | |
sheet.add_row [nil, 'foo', 'bar', 'baz'], style: [nil, gridstyle_border, gridstyle_border, gridstyle_border] | |
sheet.merge_cells 'B2:D2' | |
sheet.add_row [] | |
sheet.add_row [nil, 'foo', 'bar', 'baz'], style: [nil, gridstyle_border, nil, gridstyle_border] | |
sheet.merge_cells 'B4:D4' | |
end | |
package.serialize(File.basename(__FILE__).sub(/\.rb\z/, '.xlsx')) |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment