Resolver Hacks contains information and code for doing fun and useful things with Resolver One. This site is created and maintained by Michael Foord, not by Resolver Systems. Please read the disclaimer before using any of the code on this site.
Speaking Spreadsheets

This example requires you to have the .NET 3.0 Framework Redistributable installed. It uses the SpeechSynthesiser class to speak the contents of a cell range to you.
The important code is:
clr.AddReference('System.Speech')
from System.Speech.Synthesis import SpeechSynthesizer
def convertValue(value):
if isinstance(value, float) and int(value) == value:
value = int(value)
return str(value)
def SpeakRange(cellRange):
spk = SpeechSynthesizer()
headerRow = cellRange.HeaderRow
for row in cellRange.Rows:
if headerRow and row.top == headerRow.top:
continue
for pos, value in enumerate(row):
text = ''
if headerRow:
text = str(headerRow[pos + 1]) + ', '
text += convertValue(value)
spk.Speak(text)
A button is put in cell E2, which calls the SpeakRange function which takes a cell range:
SpeakRange(cellRange)
button = Button(Text="Speak")
button.Click += Speak
sheet.E2 = button
SpeakRange understands Resolver cell ranges. If there is a header row, then the header title will be spoken before each value (and the header row itself won't be spoken).
Again, not a very practical example but still fun!
Last edited Mon Dec 10 17:18:51 2007.

IronPython in Action