Class: WriteXLSX
- Inherits:
-
Writexlsx::Workbook
- Object
- Writexlsx::Workbook
- WriteXLSX
- Defined in:
- lib/write_xlsx.rb
Overview
write_xlsx is gem to create a new file in the Excel 2007+ XLSX format, and you can use the same interface as writeexcel gem. write_xlsx is converted from Perl’s module github.com/jmcnamara/excel-writer-xlsx .
Description
The WriteXLSX supports the following features:
Multiple worksheets
Strings and numbers
Unicode text
Rich string formats
Formulas (including array formats)
cell formatting
Embedded images
Charts
Autofilters
Data validation
Hyperlinks
Defined names
Grouping/Outlines
Cell comments
Panes
Page set-up and printing
WriteXLSX uses the same interface as WriteExcel gem.
Synopsis
To write a string, a formatted string, a number and a formula to the first worksheet in an Excel XMLX spreadsheet called ruby.xlsx:
require 'rubygems'
require 'write_xlsx'
# Create a new Excel workbook
workbook = WriteXLSX.new('ruby.xlsx')
# Add a worksheet
worksheet = workbook.add_worksheet
# Add and define a format
format = workbook.add_format # Add a format
format.set_bold
format.set_color('red')
format.set_align('center')
# Write a formatted and unformatted string, row and column notation.
col = row = 0
worksheet.write(row, col, "Hi Excel!", format)
worksheet.write(1, col, "Hi Excel!")
# Write a number and a formula using A1 notation
worksheet.write('A3', 1.2345)
worksheet.write('A4', '=SIN(PI()/4)')
workbook.close
Other Methods
see Writexlsx::Workbook, Writexlsx::Worksheet, Writexlsx::Chart etc.
Constant Summary
Constants included from Writexlsx::Utility
Writexlsx::Utility::COL_MAX, Writexlsx::Utility::ROW_MAX, Writexlsx::Utility::SHEETNAME_MAX, Writexlsx::Utility::STR_MAX
Instance Attribute Summary
Attributes inherited from Writexlsx::Workbook
#border_count, #charts, #custom_colors, #doc_properties, #drawings, #fill_count, #font_count, #image_types, #images, #named_ranges, #num_comment_files, #num_format_count, #palette, #shared_strings, #sheetnames, #worksheets
Method Summary
Methods inherited from Writexlsx::Workbook
#activesheet=, #add_chart, #add_format, #add_worksheet, #assemble_xml_file, #close, #date_1904?, #define_name, #dxf_formats, #get_1904, #initialize, #set_1904, #set_custom_color, #set_properties, #set_xml_writer, #shared_string_index, #shared_strings_empty?, #sheets, #str_unique, #writer, #xf_formats, #xml_str
Methods included from Writexlsx::Utility
#absolute_char, delete_files, #put_deprecate_message, #substitute_cellref, #underline_attributes, #xl_cell_to_rowcol, #xl_col_to_name, #xl_range, #xl_range_formula, #xl_rowcol_to_cell, #xml_str
Constructor Details
This class inherits a constructor from Writexlsx::Workbook