Research
Security News
Malicious npm Packages Inject SSH Backdoors via Typosquatted Libraries
Socket’s threat research team has detected six malicious npm packages typosquatting popular libraries to insert SSH backdoors.
If you are using axlsx for commercial purposes, or just want to show your appreciation for the gem, please don't hesitate to make a donation.
Git:http://github.com/randym/axlsx
Twitter: https://twitter.com/morgan_randy
Google Group: https://groups.google.com/forum/?fromgroups#!forum/axlsx
Author: Randy Morgan
Copyright: 2011 - 2017
License: MIT License
Latest Version: 3.0.0
Ruby Version: 2.2.7, 2.3.4, 2.4.1
JRuby Version: 1.9 modes
Rubinius Version: rubinius 3 * lower versions may run, this gem always tests against head.
Release Date: September 12th 2013
If you are working in rails, or with active record see: acts_as_xlsx
acts_as_xlsx is a simple ActiveRecord mixin that lets you generate a workbook with:
Posts.where(created_at > Time.now-30.days).to_xlsx
** and **
There are guides for using axlsx and acts_as_xlsx here: http://axlsx.blog.randym.net
If you are working with ActiveAdmin see:
It provides a plugin and dsl for generating downloadable reports.
The examples directory contains a number of more specific examples as well.
Axlsx is an Office Open XML Spreadsheet generator for the Ruby programming language. With Axlsx you can create excel worksheets with charts, images (with links), automated and fixed column widths, customized styles, functions, tables, conditional formatting, print options, comments, merged cells, auto filters, file and stream serialization as well as full schema validation. Axlsx excels at helping you generate beautiful Office Open XML Spreadsheet documents without having to understand the entire ECMA specification.
Author xlsx documents: Axlsx is made to let you easily and quickly generate professional xlsx based reports that can be validated before serialization.
Generate 3D Pie, Line, Scatter and Bar Charts: With Axlsx chart generation and management is as easy as a few lines of code. You can build charts based off data in your worksheet or generate charts without any data in your sheet at all. Customize gridlines, label rotation and series colors as well.
Custom Styles: With guaranteed document validity, you can style borders, alignment, fills, fonts, and number formats in a single line of code. Those styles can be applied to an entire row, or a single cell anywhere in your workbook.
Automatic type support: Axlsx will automatically determine the type of data you are generating. In this release Float, Integer, String, Date, Time and Boolean types are automatically identified and serialized to your spreadsheet.
Automatic and fixed column widths: Axlsx will automatically determine the appropriate width for your columns based on the content in the worksheet, or use any value you specify for the really funky stuff.
Support for automatically formatted 1904 and 1900 epochs configurable in the workbook.
Add jpg, gif and png images to worksheets with hyperlinks
Reference cells in your worksheet with "A1" and "A1:D4" style references or from the workbook using "Sheet1!A3:B4" style references
Cell level style overrides for default and customized style objects
Support for formulas, merging, row and column outlining as well as cell level input data validation.
Auto filtering tables with worksheet.auto_filter as well as support for Tables
Export using shared strings or inline strings so we can inter-op with iWork Numbers (sans charts for now).
Output to file or StringIO
Support for page margins and print options
Support for password and non password based sheet protection.
First stage interoperability support for GoogleDocs, LibreOffice, and Numbers
Support for defined names, which gives you repeated header rows for printing.
Data labels for charts as well as series color customization.
Support for sheet headers and footers
Pivot Tables
Page Breaks
To install Axlsx, use the following command:
$ gem install axlsx
The example listing is getting overly large to maintain here. If you are using Yard, you will be able to see the examples in line below.
Here's a teaser that kicks about 2% of what the gem can do.
Axlsx::Package.new do |p|
p.workbook.add_worksheet(:name => "Pie Chart") do |sheet|
sheet.add_row ["Simple Pie Chart"]
%w(first second third).each { |label| sheet.add_row [label, rand(24)+1] }
sheet.add_chart(Axlsx::Pie3DChart, :start_at => [0,5], :end_at => [10, 20], :title => "example 3: Pie Chart") do |chart|
chart.add_series :data => sheet["B2:B4"], :labels => sheet["A2:A4"], :colors => ['FF0000', '00FF00', '0000FF']
end
end
p.serialize('simple.xlsx')
end
Please see the examples for more.
{include:file:examples/example.rb}
There is much, much more you can do with this gem. If you get stuck, grab me on IRC or submit an issue to GitHub. Chances are that it has already been implemented. If it hasn't - let's take a look at adding it in.
This gem is 100% documented with YARD, an exceptional documentation library. To see documentation for this, and all the gems installed on your system use:
gem install yard kramdown
yard server -g
This gem has 100% test coverage using test/unit. To execute tests for this gem, simply run rake in the gem directory.
Please see the {file:CHANGELOG.md} document for past release information.
As axslx implements the Office Open XML (ECMA-376 spec) much of the functionality is interoperable with other spreadsheet software. Below is a listing of some known issues.
Libre Office
Google Docs
Numbers
p = Axlsx::Package.new
p.workbook.add_worksheet(:name => "Basic Worksheet") do |sheet|
sheet.add_row ["First Column", "Second", "Third"]
sheet.add_row [1, 2, 3]
end
p.use_shared_strings = true
p.serialize('simple.xlsx')
#Thanks!
Open source software is a community effort. None of this could have been done without the help of these awesome folks.
Axlsx © 2011-2013 by Randy Morgan.
Axlsx is licensed under the MIT license. Please see the LICENSE document for more information.
FAQs
Unknown package
We found that axlsx demonstrated a not healthy version release cadence and project activity because the last version was released a year ago. It has 2 open source maintainers collaborating on the project.
Did you know?
Socket for GitHub automatically highlights issues in each pull request and monitors the health of all your open source dependencies. Discover the contents of your packages and block harmful activity before you install or update your dependencies.
Research
Security News
Socket’s threat research team has detected six malicious npm packages typosquatting popular libraries to insert SSH backdoors.
Security News
MITRE's 2024 CWE Top 25 highlights critical software vulnerabilities like XSS, SQL Injection, and CSRF, reflecting shifts due to a refined ranking methodology.
Security News
In this segment of the Risky Business podcast, Feross Aboukhadijeh and Patrick Gray discuss the challenges of tracking malware discovered in open source softare.