Spreadsheet::Excel Description =========== A module for generating Excel compatable files on any platform. Version 0.2.3, based on version .26 of Spreadsheet::WriteExcel. Synopsis ======== require "spreadsheet" include Spreadsheet workbook = Excel.new("test.xls") # Three ways to add formats format1 = workbook.add_format(:color=>"blue", :bold=>1, :underline=>1) format2 = Format.new( :color => "green", :bold => true, :underline => true ) workbook.add_format(format2) format3 = Format.new{ |f| f.color = "red" f.bold = true f.underline = true } workbook.add_format(format3) worksheet1 = workbook.add_worksheet worksheet2 = workbook.add_worksheet("Numbers") worksheet3 = workbook.add_worksheet("Text") worksheet1.write(0,0,"Hello",format1) worksheet1.write(1,1,["Matz","Larry","Guido"]) worksheet2.write(1,3,8876,format2) worksheet2.write_column(4,4,[5,6,7]) worksheet3.write(2,2,"World",format3) workbook.close Excel =================== new() Returns a workbook object. You may only have one workbook per file. A '.xls' extension for your filename is recommended but not enforced. Workbook =========================== add_worksheet([sheetname]) Adds and returns a Worksheet object. You may optionally pass a sheet name. Otherwise, it will default to 'Sheet1', 'Sheet2', etc. add_format([attributes]) Adds a format object to the workbook, which is then applied to cells in the 'write' method close Close the workbook (and the file). Worksheet ============================ write(row,col,data,) Writes data at the given row and column (cell). If a format is provided, the cells are formatted appropriately. Also accept data as an Array , in which case write_row is called internally. write_row(row,col,Array,) Writes a row of data starting at and in a left to right manner, with one array element per cell. Any formatting will be applied to each cell. write_column(row,column,Array,) Writes a column of data starting at and in a top to bottom manner, with one array element per cell. Any formattnig will be applied to each cell. Format ============================ new({attributes}) Creates a new format object. See the format.html file for a list of all possible attributes and their description. Notes ===== This is a port of John McNamara's Spreadsheet::WriteExcel module, version .26 There is no support for formulas yet. Design Changes ============== The only somewhat major change was to make OLEWriter a subclass of File, rather than store a filehandle as an attribute within the class. This seems to have worked out fine. Other changes consisted mostly of minor code optimizations. Occasionally I was more terse than John was (for better or for worse) Questions ========= Questions about MS Excel should be directed to Microsoft. Questions about the MS Excel format should be directed to Microsoft. Questions about why I use the hex values that I use should be directed to John McNamara (jmcnamara at cpan dot org) Future Plans ============ Add formulas. Improve Performance. Make some methods private that should be private Improve the installation/configuration Add comments - for now you can find all appropriate comments in John's module. ;) Thanks ====== Many thanks go to John McNamara for his tireless dedication to a very useful (and probably very popular) module. I also thank him for taking the time to answer some of the questions I had for him while porting his code. Author ====== Daniel J. Berger djberg96 at yahoo dot com