How To Design Spreadsheets Using Axlsx In Rails

Spreadsheet generation made easy.

Pramod B. Shinde's avatarCurious Reflections

As a Rails developer we often need to create custom reports in some format – pdf, ppt, xlsx etc. Here I will explain how to generate spreadsheets in Rails with custom design and style. To generate  spreadsheets we will be using a tool. Tool…? No! In Rails there are no ‘tools’; there are ‘gems’ and the one we shall use is Axlsx.

What is Axlsx? Axlsx is a Ruby gem which generates an open office spreadsheets with custom design and styles, custom and automated width and height of columns and rows, images (with links), merged cells, formulas, data types and formats, validations, hyperlinks and charts (Pie, Bar, line charts 2D and 3D). So lets start generating excel worksheets with Axlsx.

First thing first create rails application and add

to your Gemfile. Then install the bundle

Lets create a Student model to represent data in a worksheet with fields like…

View original post 535 more words

Part 2: Ruby Through Rails — Bundler Details

Learning Ruby Through Rails is fun! Here is Part 2

Sanjiv Kumar Jha's avatarnarutosanjiv

In these tutorial, I am going discuss how Bundler works in a Rails application.

What is bundler?

Bundler is a gem for managing dependencies of Ruby (and Rails) applications. While using RVM, Bundler is always installed in global gemset. For example, on my machine, bundler is installed inside folder /home/sanjiv/.rvm/gems/ruby-2.0.0-p247@global/gems/.  Usually common gems are installed in @global gemset as they may be required into multiple applications. Now, lets see what’s inside the bundler binary.

What is Signal.trap?

Operating systems send various signals to running processes. Some signals can be trapped by code. In the code above, Signal.trap catches the “Interrupt” signal when the user presses Ctrl-c to stop the process. It then exits the bundler with an exit status of 1. Here is the list of signals that can by caught by the trap function.

When we require ‘bundler’, the lib/bundler.rb inside bundler gem get loaded and a lot of modules…

View original post 623 more words