[prev in list] [next in list] [prev in thread] [next in thread] 

List:       poi-dev
Subject:    Re: New Ruby Gem for POI
From:       Lance Gleason <polyglotprogramming () gmail ! com>
Date:       2011-04-16 16:15:23
Message-ID: C9CF2FA3.1DB18%polyglotprogramming () gmail ! com
[Download RAW message or body]

Sorry about the delay with getting back to you guys,  these messages
somehow ended up in my spam filter.

But to answer your questions

On 3/30/11 11:13 AM, "Nick Burch" <nick.burch@alfresco.com> wrote:

>On Wed, 30 Mar 2011, Lance Gleason wrote:
>> I am a polyglotter who  programs in both Java and Ruby.  I have an itch
>>that
>> I needed to scratch where I need to have the advanced features such as
>> picture handing in Excel documents that POI offers in a native rails
>>app.
>> There is nothing out there in Ruby-land and your your compilation option
>> doesn't work at all for me (plus from the documentation on the site the
>> graphics extensions have other dependency issues).
>
>The POI ruby extensions are alas largely unsupported - none of the
>current 
>committers make us of it. We haven't had any user supported patches for
>quite a while on it :(
That is what I noticed and didn't really feel like continuing down the
path of building native code out of Java....
>
>> As of this writing I have the project up on github here
>> https://github.com/lgleasain/poi_pond.  Once I get the functionality
>> that I need to scratch my own itch I plan on publishing that as a first
>> gem and then reving as I add functionality or fix bugs etc.. Others are
>> welcome to fork the project, add code etc..
>>
>> What would be the best way for me to compliment your efforts with my
>>gem?
>
>I guess the first thing would be if you could ensure that your code
>supports everything that the old ruby code did, so we can remove it in
>favour of your (supported!) code.

I could look into expanding that it have that support.

Right now it looks like the old one has support for the following functions
typedef ::org::apache::poi::hssf::usermodel::HSSFWorkbook *jhworkbook;
typedef ::org::apache::poi::hssf::usermodel::HSSFSheet *jhsheet;
typedef ::org::apache::poi::hssf::usermodel::HSSFRow *jhrow;
typedef ::org::apache::poi::hssf::usermodel::HSSFCell *jhcell;
typedef ::org::apache::poi::hssf::usermodel::HSSFCellStyle *jhcellstyle;
typedef ::org::apache::poi::hssf::usermodel::HSSFFont *jhfont;
typedef ::org::apache::poi::hssf::usermodel::HSSFFooter *jhfooter;
typedef ::org::apache::poi::hssf::usermodel::HSSFHeader *jhheader;
typedef ::org::apache::poi::hssf::usermodel::HSSFDataFormat *jhdataformat;

This gem indirectly has support for all of these out of the box because of
the fact that via RJB (which is included in the gem) someone could include
any of the classes via a RJB initializer statement such as
hSSFDateFormt = Rjb::import('org.apache.poi.hssf.usermodel.HSSFDataFormat')

And then doing a 
my_date = hSSFDateFormat.new
From there any methods of the object are available via a standard method
call.

Part of the mission was to make poi easier to use and a bit more
Ruby-like.  Here is an example of what I have done with this.

The following code creates a new spreadsheet with a title style,  one row
and a photo on another tab.

    initialize_poi
    my_awesome_style =  {'title' =>
                                    {:font_height => 24, :font_color =>
'DARK_BLUE', :font_name => 'Tahoma',
                                      :horizontal_alignment =>
'ALIGN_LEFT', :vertical_alignment => 'VERTICAL_TOP'}}
                  
    my_awesome_spreadsheet_array =  [:sheet =>
                                            {:name => 'sheet1', :row =>
                   
[{:row_index => 1, :cell => [{:cell_index => 1,
                   
:style => 'title', :value => "Proposed Mouse Killer"}]}]}]


    file = File.new(File.join(File.dirname(File.dirname(__FILE__)),
'allie2.JPG')).bytes.to_a
    my_awesome_spreadsheet_array[0][:sheet][:photos] =  [{:row => 10,
:column => 1, :photo => file}]
    my_awesome_spreadsheet = create_spreadsheet
my_awesome_spreadsheet_array, my_awesome_style
    my_awesome_spreadsheet.write
poi_output_file('mouse_killer_with_photo.xls')


Behind the scenes it is doing RJB imports and calling the poi functions to
turn these hash's and arrays into spreadsheets.

So what I'm trying to say is that it currently lays down the framework so
that you can access any of the POI functionality being offered out of the
box,  but the real value is making POI easier to use,  but that
functionality is not as extensive.

I haven't documented the capabilities as of yet of this dsl,  what it
supports etc. yet. 

With that being said someone could get a pretty good idea about what it
does and doesn't do via my unit tests which document what the code does.

>
>Secondly, would you be interested in contributing your code to POI?

I would be more than happy to contribute this.  I currently have the code
up on Github.  It is also available via a rubygem.  Since you guys are on
SVN ideally I would like to be able to keep the main project on Github,
but to have drops or something like that just the make the workflow easier
for Ruby devs.  When you look at the way that most Ruby developers work
they install a gem which is what this project ultimately supports.  I have
a very open License on the code right now,  but if there are any issues
with that I would be happy to make sure that is compatible with the rest
of the project.

Lance

>
>Nick
>
>---------------------------------------------------------------------
>To unsubscribe, e-mail: dev-unsubscribe@poi.apache.org
>For additional commands, e-mail: dev-help@poi.apache.org
>



---------------------------------------------------------------------
To unsubscribe, e-mail: dev-unsubscribe@poi.apache.org
For additional commands, e-mail: dev-help@poi.apache.org

[prev in list] [next in list] [prev in thread] [next in thread] 

Configure | About | News | Add a list | Sponsored by KoreLogic