Eduardo Blumenfeld
2010-Jul-16 00:10 UTC
[Ironruby-core] adding "each" support for a range brought from excel
Hi, I''m trying to do the following: ---------------- load_assembly "Microsoft.Office.Interop.Excel" include Microsoft::Office::Interop app = Excel::ApplicationClass.new worksheet app.workbooks.open("samename.xlsx".to_clr_string).worksheets[1] range = worksheet.range("A1:Z1".to_clr_string) # at this point I can: puts range[1].value # works but I can''t do range.each {|r| ...} is there any way of defining, extending the class to accept each (and size for the matter) as methods? Thank you very much Eduardo Blumenfeld -- Posted via http://www.ruby-forum.com/.
Will Green
2010-Jul-16 15:04 UTC
[Ironruby-core] adding "each" support for a range brought from excel
You can re-open the class that defines a Worksheet Range and include Ruby''s Enumerable as a mixin -- Will Green http://hotgazpacho.org/ On Thu, Jul 15, 2010 at 8:10 PM, Eduardo Blumenfeld <lists at ruby-forum.com>wrote:> Hi, > > I''m trying to do the following: > > ---------------- > load_assembly "Microsoft.Office.Interop.Excel" > include Microsoft::Office::Interop > > app = Excel::ApplicationClass.new > worksheet > app.workbooks.open("samename.xlsx".to_clr_string).worksheets[1] > > range = worksheet.range("A1:Z1".to_clr_string) > # at this point I can: > puts range[1].value # works > > but I can''t do > range.each {|r| ...} > > is there any way of defining, extending the class to accept each (and > size for the matter) as methods? > > Thank you very much > > Eduardo Blumenfeld > -- > Posted via http://www.ruby-forum.com/. > _______________________________________________ > Ironruby-core mailing list > Ironruby-core at rubyforge.org > http://rubyforge.org/mailman/listinfo/ironruby-core >-------------- next part -------------- An HTML attachment was scrubbed... URL: <http://rubyforge.org/pipermail/ironruby-core/attachments/20100716/eb0d70e0/attachment.html>
Jim Deville
2010-Jul-16 21:32 UTC
[Ironruby-core] adding "each" support for a range brought from excel
This also seems like something that should ''just work''... Tomas, any idea why it doesn''t ________________________________ From: Will Green <will at hotgazpacho.org> Sent: Friday, July 16, 2010 8:27 AM To: ironruby-core at rubyforge.org <ironruby-core at rubyforge.org> Subject: Re: [Ironruby-core] adding "each" support for a range brought from excel You can re-open the class that defines a Worksheet Range and include Ruby''s Enumerable as a mixin -- Will Green http://hotgazpacho.org/ On Thu, Jul 15, 2010 at 8:10 PM, Eduardo Blumenfeld <lists at ruby-forum.com<mailto:lists at ruby-forum.com>> wrote: Hi, I''m trying to do the following: ---------------- load_assembly "Microsoft.Office.Interop.Excel" include Microsoft::Office::Interop app = Excel::ApplicationClass.new worksheet app.workbooks.open("samename.xlsx".to_clr_string).worksheets[1] range = worksheet.range("A1:Z1".to_clr_string) # at this point I can: puts range[1].value # works but I can''t do range.each {|r| ...} is there any way of defining, extending the class to accept each (and size for the matter) as methods? Thank you very much Eduardo Blumenfeld -- Posted via http://www.ruby-forum.com/. _______________________________________________ Ironruby-core mailing list Ironruby-core at rubyforge.org<mailto:Ironruby-core at rubyforge.org> http://rubyforge.org/mailman/listinfo/ironruby-core -------------- next part -------------- An HTML attachment was scrubbed... URL: <http://rubyforge.org/pipermail/ironruby-core/attachments/20100716/d9c75625/attachment.html>
Tomas Matousek
2010-Jul-17 00:28 UTC
[Ironruby-core] adding "each" support for a range brought from excel
We don''t support COM enumerators yet. Tomas From: ironruby-core-bounces at rubyforge.org [mailto:ironruby-core-bounces at rubyforge.org] On Behalf Of Jim Deville Sent: Friday, July 16, 2010 2:33 PM To: ironruby-core at rubyforge.org Subject: Re: [Ironruby-core] adding "each" support for a range brought from excel This also seems like something that should ''just work''... Tomas, any idea why it doesn''t ________________________________ From: Will Green <will at hotgazpacho.org> Sent: Friday, July 16, 2010 8:27 AM To: ironruby-core at rubyforge.org <ironruby-core at rubyforge.org> Subject: Re: [Ironruby-core] adding "each" support for a range brought from excel You can re-open the class that defines a Worksheet Range and include Ruby''s Enumerable as a mixin -- Will Green http://hotgazpacho.org/ On Thu, Jul 15, 2010 at 8:10 PM, Eduardo Blumenfeld <lists at ruby-forum.com<mailto:lists at ruby-forum.com>> wrote: Hi, I''m trying to do the following: ---------------- load_assembly "Microsoft.Office.Interop.Excel" include Microsoft::Office::Interop app = Excel::ApplicationClass.new worksheet app.workbooks.open("samename.xlsx".to_clr_string).worksheets[1] range = worksheet.range("A1:Z1".to_clr_string) # at this point I can: puts range[1].value # works but I can''t do range.each {|r| ...} is there any way of defining, extending the class to accept each (and size for the matter) as methods? Thank you very much Eduardo Blumenfeld -- Posted via http://www.ruby-forum.com/. _______________________________________________ Ironruby-core mailing list Ironruby-core at rubyforge.org<mailto:Ironruby-core at rubyforge.org> http://rubyforge.org/mailman/listinfo/ironruby-core -------------- next part -------------- An HTML attachment was scrubbed... URL: <http://rubyforge.org/pipermail/ironruby-core/attachments/20100717/f81d0a75/attachment.html>