Export Webform Results to Word Document

In the past I've created ASP.Net Web forms where the submitted info is sent to a SQL table and email notifications, with the same info, are sent to the requestor, and the people that need to complete the requests.

I need take that same info and save it to a specified location as a word doc. Below is the code to send out email. The existing text would be implemented on the word doc so they would have a uniform appearance.

Thanks.
Public Sub Send_Email()
        Dim Mail As New MailMessage()
        Dim mailBody As String

        Mail.From = New MailAddress("sender@domain.com")
        Mail.To.Add(strUser & "@domain.com")
        Mail.Subject = "Important Request"
        mailBody = "The following information has been submitted for an Important Request:" & "<br/>" & "<br/>"
        mailBody &= "<b>Server Name:  </b>" & TextBox1.Text & "<br/>"
        mailBody &= "<b>Server OS:  </b>" & DropDownList2.Text & "<br/>"
        mailBody &= "<b>Windows License? :  </b>" & DropDownList1.Text & "<br/>"
        mailBody &= "<b>Patch Window:  </b>" & TextBox3.Text & "<br/>"
        mailBody &= "<b>Administrator:  </b>" & TextBox4.Text & "<br/>"
        mailBody &= "<b>IIS Needed:  </b>" & DropDownList5.Text & "<br/>"
        mailBody &= "<b>Amount of Disk Space:  </b>" & TextBox6.Text & "<br/>"
        mailBody &= "<b>Disk Layout:  </b>" & TextBox7.Text & "<br/>"
        mailBody &= "<b>Memory (RAM):  </b>" & TextBox8.Text & "<br/>"
        mailBody &= "<b>Primary Application:  </b>" & TextBox9.Text & "<br/>"
        mailBody &= "<b>Database Connected:  </b>" & DropDownList10.Text & "<br/>"
        mailBody &= "<b>Requesting Department: </b>" & TextBox14.Text & "<br/>"
        mailBody &= "<b>Contact Person: </b>" & TextBox11.Text & "<br/>"
        mailBody &= "<b>Contact Phone:  </b>" & TextBox12.Text & "<br/>"
        mailBody &= "<b>SAN Space Purchased:  </b>" & DropDownList13.Text & "<br/>"
        mailBody &= "<b>Date Submitted:  </b>" & strDate & "<br/>"
        mailBody &= "<b>Requestor:  </b>" & strUser & "<br/>"

        Mail.Body = mailBody
        Mail.Priority = MailPriority.High ' Normal, Low or High
        Mail.IsBodyHtml = True

        Dim smtp As New SmtpClient("mail.domain")
        Try
            smtp.Send(Mail)
        Catch ex As Exception
            MsgBox(Err.Description & vbCrLf & ex.ToString)
            Exit Sub
        End Try
    End Sub

Open in new window

LVL 1
JB4375Asked:
Who is Participating?
I wear a lot of hats...

"The solutions and answers provided on Experts Exchange have been extremely helpful to me over the last few years. I wear a lot of hats - Developer, Database Administrator, Help Desk, etc., so I know a lot of things but not a lot about one thing. Experts Exchange gives me answers from people who do know a lot about one thing, in a easy to use platform." -Todd S.

crisco96Commented:
This might help you: http://www.codeproject.com/KB/aspnet/wordapplication.aspx

One thing to note, in order for this to work office must be installed on the server the site is running on.
0

Experts Exchange Solution brought to you by

Your issues matter to us.

Facing a tech roadblock? Get the help and guidance you need from experienced professionals who care. Ask your question anytime, anywhere, with no hassle.

Start your 7-day free trial
CodeCruiserCommented:
It is not recommended to have Office installed on the server. Use a 3rd party tool such as this which does not require office

http://www.aspose.com/categories/product-family-packs/aspose.words-product-family/default.aspx
0
It's more than this solution.Get answers and train to solve all your tech problems - anytime, anywhere.Try it for free Edge Out The Competitionfor your dream job with proven skills and certifications.Get started today Stand Outas the employee with proven skills.Start learning today for free Move Your Career Forwardwith certification training in the latest technologies.Start your trial today
ASP.NET

From novice to tech pro — start learning today.