Permalink
Commits on Oct 6, 2012
  1. updated Manifest.txt

    zdavatz committed Oct 6, 2012
  2. Fixes issue #9

    mdgreenfield committed Oct 6, 2012
    Adds Spreadsheet::Excel::Row#to_a method to properly decode Date and
    DateTime data.
Commits on Jul 2, 2012
Commits on Jun 30, 2012
Commits on Jun 26, 2012
  1. Merge branch 'master' of https://github.com/uraki66/spreadsheet

    zdavatz committed Jun 26, 2012
    These commits correct the Format borders implementation and correct the issue with Excel choking on a .xls written by Spreadsheet when borders are specified.
    
    You can now write an .xls with borders and/or border_colors and the resulting file works in both Excel and Open/LibreOffice.
    
    Borders were previously implemented as booleans which is incorrect...the are line-sytles (bit values).
    
    The full list of border styles are now available:
    
        :none, :thin, :medium, :dashed, :dotted, :thick,
        :double, :hair, :medium_dashed, :thin_dash_dotted,
        :medium_dash_dotted, :thin_dash_dot_dotted,
        :medium_dash_dot_dotted, :slanted_medium_dash_dotted
    
    So something like:
    
    x = Spreadsheet::Format.new
    x.border = :thick
    x.border_color = :green
    
    Sets the cell border to a thick, green border
    
    The issue with Excel crashing if you set a border wasn't related to the border style, but rather the border color....I'm not sure of the exact issue, but if the border_color was one of the :builtin_<color>, then Excel had issues with the resulting .xls. Changing the default color to :black fixed this....I suspect it's a result of builtin formats/indexes vs "user" formats when the binary .xls is written (the 'xf' records), but it's beyond my feeble skills to figure out what is happening. I did save and dump a few Excel workbooks in .xml format (to get an idea of what was being saved in the real .xls) and I really think the default/builtin formats aren't being written correctly and/or indexed for formats that have :builtin_<color> colors in them.
    
    The reader was also fixed to properly pull in the border styles & border colors...however, if the reader pulls in a border color of :builtin_<color>, it will end up saving it with that color and most likely create an .xls that will crash Excel and not allow right-click "Format Cells".
    
    Further work of dumping & tracing the layout of Excel sheets needs to be done to ultimately correct the issue/mystery of :builtin_black, red, green, etc and how the system xf records relate to them.
    
    I added some basic tests for the Format.border & Format.border_colors.
Commits on Jun 25, 2012
Commits on Jun 14, 2012
Commits on Jun 13, 2012
  1. Fix error in test suite under ruby 1.9

    Mina Naguib
    Mina Naguib committed Jun 13, 2012
Commits on Jun 11, 2012
  1. New and updated test cases

    Mina Naguib
    Mina Naguib committed Jun 11, 2012
    This provides coverage for my previous few commits which centered around
    optimizing writing sheets.
  2. Speed up writing: More efficient #format_dates!

    Mina Naguib
    Mina Naguib committed Jun 11, 2012
    This method was very liberal with the number of new formats it created.
    Roughly, it created a new format for each Date/Time cell it detected.
    
    In a large sheet with many date/time cells, the high number of
    generated formats meant much slower writing, specifically when it the
    writers enter the #write_xfs and #write_rows methods.
    
    This commit makes format_dates! less liberal with generating new
    formats.  Essentially, when it needs to generate a new format to assign
    to a date/time cell, it will re-use an existing format that matches the
    needed characteristics.
  3. Speed up writing: Faster Font#key

    Mina Naguib
    Mina Naguib committed Jun 11, 2012
    This method is consumed at write time for each distinct format (not each
    distinct font - typically much less)
    
    This commit introduces a mini internal cache to avoid expensive key
    computation
  4. Speed up writing: Faster Writer::Workbook#write_fonts

    Mina Naguib
    Mina Naguib committed Jun 11, 2012
    Previously this method called #key (expensive) on each format->font in
    the sheet.  This is inefficient as quite often, many formats share the
    same font.
    
    This commit makes it invoke it once per distinct ruby instance of Format
Commits on Jun 10, 2012
  1. Fix failing test suite

    Mina Naguib
    Mina Naguib committed Jun 10, 2012
  2. Minor optimization

    Mina Naguib
    Mina Naguib committed Jun 10, 2012
  3. Bugfix: Proper SST partial vs. complete writing

    Mina Naguib
    Mina Naguib committed Jun 10, 2012
    This was broken by 175523d - the bug
    caused "partial" to always be chosen.
    
    The net effect was slightly larger SST tables, nothing more...
Commits on Jun 7, 2012
  1. Speed up writing: Faster Writer::Workbook#xf_index

    Mina Naguib
    Mina Naguib committed Jun 7, 2012
    The above method is invoked for every single cell written, and
    previously exhibited terrible performance when there were lots of
    formats in the workbook (whether added manually or automatically).
    
    This commit makes its performance O(1)
  2. Speed up writing: Faster Workbook#add_format

    Mina Naguib
    Mina Naguib committed Jun 7, 2012
    The above method is (indirectly) used heavily by format_dates!, and
    prior to this patch exhibited O(n) behavior.
    
    This patches keeps @formats as an array, but introduces a secondary
    @formats_set Hash to represent the same list as a Hash for quick member
    lookup to avoid @formats.include?(x)
Commits on Jun 6, 2012
  1. Speed up writing: Improve Format#is_(date/time/datetime/date_time)

    Mina Naguib
    Mina Naguib committed Jun 6, 2012
    This commit caches the regexes used for these methods inside the Format
    instance.  This provides a roughly 25% speed increase at write time, as
    they're consumed heavily by format_dates!
    
    Test program:
    
      book = Spreadsheet::Workbook.new
      sheet = book.create_worksheet(:name => "Foo")
      (1..15000).each do |i|
        row = sheet.row(i)
        row.concat(%w(hello hello hello hello hello hello hello hello hello hello hello hello))
      end
      x= Benchmark.measure do
        book.write("book.xls")
      end
      puts "#{Time.now} writing done in #{x.real} seconds"
    
    Before change:
      writing done in 10.20752740377256 seconds
    
    After change:
      writing done in 7.55835294723511 seconds
  2. Speed up writing: Improve #strings performance

    Mina Naguib
    Mina Naguib committed Jun 6, 2012
     #strings now returns a Hash representing the string frequency:
      "bob" => 1,
      "mary" => 50
    
     This is significantly more efficient than arrays, especially for
     cases where content repeats in multiple cells.  Further operations such
     as counting uniques, and set subtraction, are also more efficient.
    
     Given a simple test program on my laptop:
    
      book = Spreadsheet::Workbook.new
      sheet = book.create_worksheet(:name => "Foo")
      (1..15000).each do |i|
        row = sheet.row(i)
        row.concat(%w(hello hello hello hello hello hello hello hello hello hello hello hello))
      end
      book.write("book.xls")
    
    Runtime before change:
      real  0m37.723s
    
    Runtime after change:
      real  0m11.922s
Commits on May 8, 2012
Commits on May 7, 2012
  1. remove require and rake altogether

    timon committed May 7, 2012
    gem build and rake gem both work fine without those requires,
    and requiring 'rake' broke bundler
  2. add rake as development dependency

    timon committed May 7, 2012
    Somehow it broken rake on my other project
  3. update Manifest.txt

    timon committed May 7, 2012
  4. Updated README.txt

    zdavatz committed May 7, 2012
Commits on May 6, 2012
  1. Fix syntax for ruby-1.9

    timon committed May 6, 2012