Search Wiki:
Resource Page Description
A custom task pane for Microsoft Word 2007 with VSTO and Visual Basic 2008, which enables Text-to-Speech onto Word documents. Open your Word 2007 documents and listen your pc reading!


You can read an article about writing the add-in from the Visual Basic Developer Center here: http://msdn.microsoft.com/en-us/library/cc627340.aspx
Last edited Jun 18 2008 at 8:46 PM  by AlessandroDelSole, version 3
Comments
mturner wrote  May 30 2008 at 9:16 PM  
I'm having trouble installing the Add-in. Here's what I tried:

(1) Copied the TextToSpeechWordAddIn.dll, TextToSpeechWordAddIn.dll.manifest, and Microsoft Office Interop Smart Tag.dll files to C:\Program Files\Microsoft Office\Office12\ADDINS.
(2) Opened Word and tried to add TextToSpeechWordAddIn.dll as an COM Add-in

This resulted in an error saying "C:\Program Files\Microsoft Office\Office12\ADDINS\TextToSpeechWordAddIn.dll" is not a valid Office Add-in.

Any help is appreciated!

AlessandroDelSole wrote  May 31 2008 at 1:04 PM  
Hi,
try to open the source code and build the Addin from within Visual Studio 2008, then run Microsoft Word. Or try to deploy the Addin itself via ClickOnce. This should ensure that everything works correctly.

NiteShdw wrote  Jun 1 2008 at 10:16 AM  
I picked this up and made a few tweaks.
1. After filling ComboBox1, I set ComboBox1.SelectedIndex = 0
2. I have the voice start reading from the position of the cursor forward. I changed the 'mySynth.SpeakAsync' line to:

mySynth.SpeakAsync(document.Content.Text.Substring(Globals.ThisAddIn.Application.Selection.Start()))

I'm not sure if that's the best way to get the text from the current cursor position forward, but it seems to work (though I think it doesn't quite get the right position).

GrahamI wrote  Jun 29 2008 at 4:25 AM  
I've had some difficulty with this in the Culture area and I'd appreciate any advice that you can give. I'm in Australia.
The line :- synth.GetInstalledVoices(Globalization.CultureInfo.CurrentCulture) returns 0 (Zero).
However, if I replace the above line with :- synth.GetInstalledVoices() it will return 1 (One) and that is "Microsoft Anna".

Then my next problem is a LoaderLock exception. This is the Error Displayed in a Message Box.

Managed Debugging Assistant 'LoaderLock' has detected a problem in 'C:\Program Files\Microsoft Office\Office12\WINWORD.EXE'.
Additional Information: Attempting managed execution inside OS Loader lock. Do not attempt to run managed code inside a DllMain or image initialization function since doing so can cause the application to hang.

Can anybody give advice on these 2 (Two) issues please. I should add that Ive seen posts elsewhere that iTunes is an Issue with the LoaderLock error. I dn't have iTunes on my System.

wwDarryl wrote  Feb 3 2011 at 2:02 PM  
This is a follow up the post about getting it to start at the current point.
The problem with the previous post was when it gets converted to text not everything is converted causing an offset.
I used the following that will either go from the current point or if something is highlighted just read that.

Dim currentRange As Word.Range = Globals.ThisAddIn.Application.Selection.Range
Dim istart As Integer = Globals.ThisAddIn.Application.Selection.Start
Dim iend As Integer = Globals.ThisAddIn.Application.Selection.End
If istart = iend Then
'starting point
currentRange.Start = istart
currentRange.End = Globals.ThisAddIn.Application.ActiveDocument.Content.Text.Length
Else
'range
currentRange.Start = istart
currentRange.End = iend
End If
mySynth.SpeakAsync(currentRange.Text)

I know the end point is not calculated correctly but it is close.

Updating...
Page view tracker