none
how to format text from the web browser and then save it memory so narrator software can read it

    Question

  • hi, i have a couple of questions on how i might go about formatting text from the web browser function in vb.net. basically i want to be able to format the text from the webpage into something readable for a text to speech program. this means taking out unnecessary spaces so its just one fluid lot of text. ive had some succes but im unble to take out unnecessary spaces and so once my narrator gets to more than one space it stops for some reason. im also currently saving what is in the browser to a text file on the hard drive and i would like to know if you can just save it to the memory instead so that the user doesnt have to save the file before it can read the current page.

     

    currently i have this, that converts the wb browser content and saves it:

     

    Private Sub ToolStripButton10_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles ToolStripButton10.Click

    WebBrowser1.ShowSaveAsDialog()

    Dim ConvertCom As Object

    Dim sResult As String

    ConvertCom = CreateObject("czdoc2txt.ConvertApplication")

    sResult = ConvertCom.ConvertFolder("c:\test.htm", "c:\", "3", False, "")

    If sResult = "" Then

    'MsgBox("Convert OK!")

    Else

    MsgBox("Convert Failure, error reason is" & sResult)

    End If

    ConvertCom = Nothing

    End Sub

     

    anyone help with any ideas?

    Wednesday, April 11, 2007 4:24 PM

Answers

  • You should post your question on the Regular Expression forum:

    http://forums.microsoft.com/MSDN/ShowForum.aspx?ForumID=1212&SiteID=1

     

    Using regular expression you can make simple text transformatio. Example (C#):

     new Regex(@" +").Replace(inputString, " "); // Changes multiple spaces by one space.

     new Regex(@"\s+").Replace(inputString, " "); // Changes multiple white spaces(include tab, new lines..) by one space.

     

    Regards,

     

    Thursday, April 12, 2007 9:39 AM