First of all, thanks to everyone in Python Ireland for their
hospitality. :-)
I was asked last night for a specific example of something I had
changed to be more Rubyish. Probably the best example of this would be
the changes I made to the StyleFormat class.
In Surpass, you can set up a new StyleFormat by passing a hash of
format parameters to StyleFormat.new:
date_format = StyleFormat.new(:number_format_string => 'D-MMM-YY')
header_format = StyleFormat.new(:font_bold => true, :font_height
=> 230)
Then to use these style formats you would write to your worksheet like
this:
book = Workbook.new("style_formats.xls")
sheet = book.add_sheet
sheet.write(0, 0, "This is a date:", header_format)
sheet.write(1, 0, Date.new(2009, 1, 1), date_format)
book.save
The original way to accomplish this would be to set each attribute
individually, like so (in Python):
font0 = Font()
font0.height = 230
font0.bold = True
style0 = XFStyle()
style0.font = font0
Note that you can set individual attributes like this in Surpass
(Ruby) as well, but using a hash for initialization is a nice
shortcut.
I'll get my slides up ASAP.
--~--~---------~--~----~------------~-------~--~----~
You received this message because you are subscribed to the Google Groups
"Python Ireland" group.
To post to this group, send email to [email protected]
To unsubscribe from this group, send email to
[email protected]
For more options, visit this group at
http://groups.google.ie/group/pythonireland?hl=en
-~----------~----~----~----~------~----~------~--~---