All Projects → axlsx-styler-gem → Axlsx_styler

axlsx-styler-gem / Axlsx_styler

Licence: mit
Build clean and maintainable styles for your axlsx spreadsheets. Build your spreadsheeet with data and then apply styles later.

Programming Languages

ruby
36898 projects - #4 most used programming language

Projects that are alternatives of or similar to Axlsx styler

Unity Quicksheet
Unity-QuickSheet enables you to use spreadsheet file data within Unity editor.
Stars: ✭ 742 (+1059.38%)
Mutual labels:  spreadsheet
Thing Store
an app for storing and calculating with arbitrary structures of values.
Stars: ✭ 11 (-82.81%)
Mutual labels:  spreadsheet
Cuba
🇨🇺 Google Sheets + SQL = JSON
Stars: ✭ 45 (-29.69%)
Mutual labels:  spreadsheet
Gridview
Reusable GridView with excellent performance and customization that can be time table, spreadsheet, paging and more.
Stars: ✭ 771 (+1104.69%)
Mutual labels:  spreadsheet
Mintable
🍃 Automate your personal finances – for free, with no ads, and no data collection.
Stars: ✭ 849 (+1226.56%)
Mutual labels:  spreadsheet
Luckysheet
Luckysheet is an online spreadsheet like excel that is powerful, simple to configure, and completely open source.
Stars: ✭ 9,772 (+15168.75%)
Mutual labels:  spreadsheet
Epplus
EPPlus 5-Excel spreadsheets for .NET
Stars: ✭ 693 (+982.81%)
Mutual labels:  spreadsheet
Documentbuilder
ONLYOFFICE Document Builder is powerful text, spreadsheet, presentation and PDF generating tool
Stars: ✭ 61 (-4.69%)
Mutual labels:  spreadsheet
Puregrid
Lightweight JavaScript Grid/SpreadSheet component written in pure JavaScript
Stars: ✭ 10 (-84.37%)
Mutual labels:  spreadsheet
Desktopeditors
An office suite that combines text, spreadsheet and presentation editors allowing to create, view and edit local documents
Stars: ✭ 1,008 (+1475%)
Mutual labels:  spreadsheet
Googlesheets
Google Spreadsheets R API
Stars: ✭ 771 (+1104.69%)
Mutual labels:  spreadsheet
Libxlsxwriter
A C library for creating Excel XLSX files.
Stars: ✭ 790 (+1134.38%)
Mutual labels:  spreadsheet
React Spreadsheet Grid
An Excel-like grid component for React with custom cell editors, performant scroll & resizable columns
Stars: ✭ 996 (+1456.25%)
Mutual labels:  spreadsheet
Vue Handsontable Official
Vue Data Grid with Spreadsheet Look & Feel. Official Vue wrapper for Handsontable.
Stars: ✭ 751 (+1073.44%)
Mutual labels:  spreadsheet
Django Rest Pandas
📊📈 Serves up Pandas dataframes via the Django REST Framework for use in client-side (i.e. d3.js) visualizations and offline analysis (e.g. Excel)
Stars: ✭ 1,030 (+1509.38%)
Mutual labels:  spreadsheet
Sheetjs
📗 SheetJS Community Edition -- Spreadsheet Data Toolkit
Stars: ✭ 28,479 (+44398.44%)
Mutual labels:  spreadsheet
Xlnt
📊 Cross-platform user-friendly xlsx library for C++11+
Stars: ✭ 876 (+1268.75%)
Mutual labels:  spreadsheet
Pygsheets
Google Sheets Python API v4
Stars: ✭ 1,116 (+1643.75%)
Mutual labels:  spreadsheet
Spreadsheet
The Ruby Spreadsheet by ywesee GmbH
Stars: ✭ 1,033 (+1514.06%)
Mutual labels:  spreadsheet
Spreadsheet
Spreadsheet for Vaadin Framework
Stars: ✭ 40 (-37.5%)
Mutual labels:  spreadsheet

axlsx_styler

Gem Version Build Status RubyGems Downloads

axlsx_styler is a gem that allows you to build clean and maintainable styles for your axlsx spreadsheets. Build your spreadsheeet with data and then apply styles later.

While axlsx is an excellent tool to build Excel spreadsheets in Ruby, the sheets styles are only applied immediately as the row is created. This makes it very difficult to style easily and effectively.

To solve this issue, axlsx_styler was born to allow the separation of styles from content within your axlsx code. It gives you the ability to fill out a spreadsheet with data and apply styles later.

Works well in any Rails app or outside of any specific Ruby framework.

Usage

This gem provides a DSL that allows you to apply styles or borders to ranges of cells.

Styles

sheet.add_style 'A1:D10', b: true, sz: 14

The styles can be overlayed, so that later on you can add another style to cells that already have styles.

sheet.add_style 'A1:D1', bg_color: 'FF0000'

Applying multiple styles as a sequence of Ruby hashes is also possible.

bold     = { b: true }
centered = { alignment: { horizontal: :center } }
sheet.add_style 'A2:D2', bold, centered

Applying a style to multiple ranges at once.

sheet.add_style ['A2:G2', "A8:G8", "A12:G12"], b: true, sz: 14

Borders

The border style is to draw a thin black border on all four edges of the selected cell range.

sheet.add_border 'B2:D5'

You can easily customize the border styles.

sheet.add_border 'B2:D5', [:bottom, :right]
sheet.add_border 'B2:D5', { edges: [:bottom, :right], style: :thick, color: 'FF0000' }

Applying border to multiple ranges at once.

sheet.add_border ['A2:G2', "A8:G8", "A12:G12"]

Example

Suppose we want create the following spreadsheet:

alt text

You can apply styles after all data is entered, similar to how you'd create an Excel document by hand.

require 'axlsx_styler'

axlsx = Axlsx::Package.new
workbook = axlsx.workbook
workbook.add_worksheet do |sheet|
  sheet.add_row
  sheet.add_row ['', 'Product', 'Category',  'Price']
  sheet.add_row ['', 'Butter', 'Dairy',      4.99]
  sheet.add_row ['', 'Bread', 'Baked Goods', 3.45]
  sheet.add_row ['', 'Broccoli', 'Produce',  2.99]
  sheet.column_widths 5, 20, 20, 20

  # using AxlsxStyler DSL
  sheet.add_style 'B2:D2', b: true
  sheet.add_style 'B2:B5', b: true
  sheet.add_style 'B2:D2', bg_color: '95AFBA'
  sheet.add_style 'B3:D5', bg_color: 'E2F89C'
  sheet.add_style 'D3:D5', alignment: { horizontal: :left }
  sheet.add_border 'B2:D5'
  sheet.add_border 'B3:D3', [:top]
end
axlsx.serialize 'grocery.xlsx'

If you try creating this same spreadsheet using only axlsx, you will find this is much more difficult. See this See this example

For more examples, please see the examples folder

Contributing

We use the appraisal gem for testing multiple versions of axlsx. Please use the following steps to test using appraisal.

  1. bundle exec appraisal install
  2. bundle exec appraisal rake test

Credits

Created by Anton Sakovich - @sakovias

Maintained by Weston Ganger - @westonganger - Uses axlsx_styler within the gem, spreadsheet_architect

Note that the project description data, including the texts, logos, images, and/or trademarks, for each open source project belongs to its rightful owner. If you wish to add or remove any projects, please contact us at [email protected].