This repository has been archived by the owner on Oct 17, 2023. It is now read-only.
-
Notifications
You must be signed in to change notification settings - Fork 17
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Merge pull request #16 from sakovias/release-0.1.6
Release 0.1.6
- Loading branch information
Showing
3 changed files
with
26 additions
and
1 deletion.
There are no files selected for viewing
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
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
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
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,22 @@ | ||
# As of v0.1.6 it is possible to add styles using vanilla axlsx approach | ||
# as well as using add_style and add_border. This is something users have | ||
# been asking for. | ||
# | ||
# The example below is superfluous and the same results are more easily achieved | ||
# without workbook.styles.add_style. You've been warned! | ||
require 'axlsx_styler' | ||
|
||
axlsx = Axlsx::Package.new | ||
workbook = axlsx.workbook | ||
red = workbook.styles.add_style fg_color: 'FF0000' | ||
workbook.add_worksheet do |sheet| | ||
sheet.add_row | ||
sheet.add_row ['', 'B2', 'C2', 'D2'], style: [nil, red, nil, nil] | ||
sheet.add_row ['', 'B3', 'C3', 'D3'], style: [nil, red, nil, nil] | ||
sheet.add_row ['', 'B4', 'C4', 'D4'], style: [nil, red, nil, nil] | ||
|
||
sheet.add_style 'B2:D2', b: true | ||
sheet.add_border 'B2:D4' | ||
end | ||
workbook.apply_styles | ||
axlsx.serialize File.expand_path('../../tmp/mixing_styles.xlsx', __FILE__) |