Silly, fun and useful things to do with Resolver One
  • HOME
  • About
  • Articles
  • Fun
  • Snippets
  • Disclaimer
  • Useful Links

Site by Voidspace

Email Michael

Download Resolver One

RSS Feed RSS Feed

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.

Site Built with rest2web

Creative Commons License

IronPython Wiki

IronPython in Action IronPython in Action

Speaking Spreadsheets

A talking spreadsheet!

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.

  • Download the Speaking Spreadsheet

The important code is:

import clr
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:

def Speak():
    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!


Hosted by Webfaction

Return to Top

Last edited Mon Dec 10 17:18:51 2007.

Copyright ©2007 Michael Foord. All rights reserved. Design by Elemental Works. Logo by FuchsiaShock. Valid XHTML & CSS.

This work is licensed under a Creative Commons License.