Google Answers Logo
View Question
 
Q: Convert static text and textbox text form a webpage to a MS word doc in VB.Net ( No Answer,   3 Comments )
Question  
Subject: Convert static text and textbox text form a webpage to a MS word doc in VB.Net
Category: Computers > Programming
Asked by: bdwgarth-ga
List Price: $10.00
Posted: 14 Jun 2004 17:56 PDT
Expires: 14 Jul 2004 17:56 PDT
Question ID: 361165
I am developing a web application with Visual Studio.Net in VB.Net
language.  I am looking for a user of the application to fill out a
form online and submit it.  The form would consist of static text and
asp text boxes.  Once the user has filled out the form: I would like
to have the static text and the text in the text boxes be converted into
a MS Word document.  Then would have this document attached to an
email message.  Looking for code that would convert static text and
textbox text into a word document in VB.net.
Answer  
There is no answer at this time.

Comments  
Subject: Re: Convert static text and textbox text form a webpage to a MS word doc in VB.N
From: crythias-ga on 14 Jun 2004 21:29 PDT
 
Hello, bdwgarth-ga,

Might I inquire as to the desired result? If merely to open into Word,
then making a text file end in .doc is most likely enough. If to have
some sort of formatting and append all the proprietariness that must
increase the document size to make it a Word document (and which
version of Word?), it's possible to do that with a VB startup macro
inside of Word (which can include mailing itself).

If the result is to have the document pretty formatted, perhaps using
.rtf (simply add content between defined tags, similar to HTML) would
assist in making the document cross platform and still openable in all
versions of Word.

I'm certain someone else has a method for you according to any
additional information you might provide.

IANAGAR
Subject: Re: Convert static text and textbox text form a webpage to a MS word doc in VB.Net
From: jebeddo-ga on 15 Jun 2004 04:03 PDT
 
Use Standard File operations and write to a file your datas in text
mode (Not in Binary mode) then name this file with ending extension
.txt or .doc so you can attach it to any email...
I think this is the best way you can use...
Subject: Re: Convert static text and textbox text form a webpage to a MS word doc in VB.Net
From: packiya-ga on 15 Jun 2004 04:44 PDT
 
Hello, bdwgarth-ga,

The following code will do the job !

    Private Sub Button1_Click(ByVal sender As System.Object, ByVal e As  
                  System.EventArgs) Handles Button1.Click
        Dim s As String = "Test"
        Dim b As Boolean = SaveTextToFile(s, "c:\me.doc")
    End Sub

    Public Function SaveTextToFile(ByVal strData As String, _
                             ByVal FullPath As String, _
                             Optional ByVal ErrInfo As String = "") As Boolean

        Dim Contents As String
        Dim bAns As Boolean = False
        Dim objReader As StreamWriter
        Try
            objReader = New StreamWriter(FullPath)
            objReader.Write(strData)
            objReader.Close()
            bAns = True
        Catch Ex As Exception
            ErrInfo = Ex.Message
        End Try
        Return bAns
    End Function
Hope it was useful. Awaiting your Rating. If it was useful.
REgards
Packiyanath.

Important Disclaimer: Answers and comments provided on Google Answers are general information, and are not intended to substitute for informed professional medical, psychiatric, psychological, tax, legal, investment, accounting, or other professional advice. Google does not endorse, and expressly disclaims liability for any product, manufacturer, distributor, service or service provider mentioned or any opinion expressed in answers or comments. Please read carefully the Google Answers Terms of Service.

If you feel that you have found inappropriate content, please let us know by emailing us at answers-support@google.com with the question ID listed above. Thank you.
Search Google Answers for
Google Answers  


Google Home - Answers FAQ - Terms of Service - Privacy Policy