Prior art of manipulating OpenXML with IronRuby?

Hi,
I’m going to need manipulation of Excel/Word documents for a production
app

  • I’ll use IronRuby there.

Did anyone develop some kind of tool or dsl to handle these
manipulations
already ?

I’d like to avoid reinventing the wheel if it’s the case,

cheers,

Thibaut

can you provide some more detail? with very much earlier version of
ironruby, i’ve fiddled with the idea of converting VB code that does
that to
ruby but gave up thinking it was too early to try.

On Wed, Oct 14, 2009 at 5:03 PM, Thibaut Barrère

On Wed, Oct 14, 2009 at 10:03 AM, Thibaut Barrère
<[email protected]

wrote:

Hi,
I’m going to need manipulation of Excel/Word documents for a production app

  • I’ll use IronRuby there.

Did anyone develop some kind of tool or dsl to handle these manipulations
already ?

I’d like to avoid reinventing the wheel if it’s the case,

You could reference the Open XML
SDKhttp://www.microsoft.com/downloads/details.aspx?FamilyID=c6e744e5-36e9-45f5-8d8c-331df206e0d0&DisplayLang=enand
use that from within IronRuby. See Eric
White’s excellent examples in
C#http://blogs.msdn.com/ericwhite/archive/2008/10/20/eric-white-s-blog-s-table-of-contents.aspxfor
usage.

Ryan R.

Email: [email protected]
LinkedIn: http://www.linkedin.com/in/ryanriley
Blog: http://wizardsofsmart.net/
Website: http://panesofglass.org/

whoops. i thought you meant Excel/Word automation, my bad.

whoops. i thought you meant Excel/Word automation, my bad.

Well, it could have been the case, but I’m avoiding that on purpose :slight_smile:

My goal is more or less to rely on word/excel editable templates where I
inject data (fields, rows…) a bit like in Documatic (excellent project
although not active anymore afaik:
http://stonecode.svnrepository.com/documatic/trac.cgi/wiki)

@Ryan: pretty much what I had in mind, except I didn’t know about Eric
White’s examples. Thanks a lot!

I’ll see if there is some benefit to wrap this up in an IronRuby gem
(and
will share it if it does).

best,

Thibaut

On Wed, Oct 14, 2009 at 10:45 AM, Thibaut Barrère
<[email protected]

wrote:

@Ryan: pretty much what I had in mind, except I didn’t know about Eric
White’s examples. Thanks a lot!

I’ll see if there is some benefit to wrap this up in an IronRuby gem (and
will share it if it does).

Let me know if you want some help. I’ve done some work with this in C#
on a
recent project and never considered using IR for that, but it makes a
lot of
sense. :slight_smile:

Ryan R.

Email: [email protected]
LinkedIn: http://www.linkedin.com/in/ryanriley
Blog: http://wizardsofsmart.net/
Website: http://panesofglass.org/

Let me know if you want some help. I’ve done some work with this in C# on
a recent project and never considered using IR for that, but it makes a
lot
of sense. :slight_smile:

will do, thanks!

– Thibaut

Sorry, I also should have noted that this code also relies on
win32ole.rb.
The one from Merlin\Main\Languages\Ruby\Libs for the interop
Best Regards,
Kevin

On Wed, Oct 14, 2009 at 10:12 AM, Kevin R.

I’m attaching a couple of files because I had to do something very
similar just recently.
This isn’t super clean, as I’m still testing this functionality, but
it might serve as a starting point anyway.

I am calling c# code to require WorkBook.rb first. (Mostly just a
shortcut I grabbed from the excel interop tests)

I am then passing a fairly simple domain object into the
‘BuildRequestVolumeWorkBooks.rb’ through “CallerInput”
Then I set “CallerOutput” So I can grab the filenames generated after
applying my data to the template.

Sounds very much in line with what you’re trying to accomplish, but
again, maybe just as a starting point.

Best Regards,
Kevin R.

On Wed, Oct 14, 2009 at 9:45 AM, Thibaut Barrère

Hey Kevin,

looks like your first message didn’t make it (maybe because of
attachments
?)

Any code will be useful though (who knows where this is going to lead me
:slight_smile:

– Thibaut

Ignore my last answer - the first message arrived after the last one.

thanks for sharing!

– Thibaut

Ah, I see. I’ve posted it here: 210204’s gists · GitHub
Let me know what you find as you go, as I’ll likely have to to more
like this in the future as well.
Best Regards,
Kevin

On Wed, Oct 14, 2009 at 10:29 AM, Thibaut Barrère