KTamas' Blog

Remember kids, if Internet Explorer is brave enough to ask to be your default browser, you're brave enough to ask that girl out.

Miért fogunk a jövőben excelt is Rubyban programozni?

· 72 words · 1 min read

Ruby:

require ‘win32ole’

excel = Win32ole.new(“Excel.Application”)

excel.visible = true

wb = excel.workbooks.add

ws = wb.activesheet

ws.range(‘A1:B5’).each do |cell|

cell.value = “Hello, World”

end

versus

using Microsoft.Office.Interop.Excel;

[…]

var excel = new ApplicationClass();

excel.Visible = true;

object missing = System.Reflection.Missing.Value;

var workbook = excel.Workbooks.Add(missing);

var range = excel.get_Range((object)”A1″, (object)”B5″);

foreach (Range r in range.Cells) {

r.Activate();

excel.ActiveCell.Value2 = “Alma”;

}

Na, melik a kevésbé gány megoldás?

(A szerkesztőségbe várjuk a jobb C#-os megoldásokat.)

comments powered by Disqus