• Status: Solved
  • Priority: Medium
  • Security: Public
  • Views: 282
  • Last Modified:

MS Word doc to TextArea


I need to move the contents of a Word document into a textarea field. Is there any way of removing the nonsense char's that Bill Gates has added?

The result in the textarea field doesn't need to be perfect. I ASPUpload the word doc to the server, but need a copy of it it in a field for quick searching and non-editable viewing - opening word will allow people to save or download etc.

Anyone got any experience of how to approach this please?
  • 2
1 Solution
IF you have Word on the Server and IF you feel like it's safe to use from a website :)) (note: I wouldn't), you can go for this approach:
Imports Microsoft.Office.Interop
Use Word.Document to open a word document, here is an example:
Dim missing As Object = System.Reflection.Missing.Value
Dim fileName As String = "MyWordFile.doc"
' open a word document that already exists to work with
Dim aDoc As Word.Document = WordApp.Documents.Open(fileName, missing, True, missing, missing, missing, missing, _
missing, missing, missing, missing, False, missing, missing, missing)

Use *.Range.Text() to get entire doc file as a string, eg:
' Prints entire file to the screen

You might be able to use Range to get a specific segments of the doc file, eg:
Dim tpStr as String = aDoc.Range(0,12).Text()

BUT as I mentioned, I wouldn't do this on a real web server, you never know what Word will do to you :))

Other ideas:
http://www.softinterface.com/WCX/WCX.htm (free? :))
http://www.convertzone.com/net/cz-CZ%20Document%20Converter%20COM-1-1.htm ($260, but does what you want)
http://www.sharewareconnection.com/word-web-stream.htm ($100)

No comment has been added to this question in more than 21 days, so it is now classified as abandoned.  I will make a recommendation to the moderators on its resolution in a week or two.  I appreciate any comments that would help me to make a recommendation.

Unless it is clear to me that the question has been answered I will recommend delete without refund of points.  It is possible that a Grade less than A will be given if no expert makes a case for an A grade.  It is assumed that any participant not responding to this request is no longer interested in its final disposition.

If the asker does not know how to close the question, the options are here:

EE Cleanup Volunteer
No comment has been added to this question in more than 21 days, so it is now classified as abandoned.  I will leave the following recommendation for this question in the Cleanup topic area:
Accept - softplus

Any objections should be posted here in the next 4 days.  After that time, the question will be closed.

EE Cleanup Volunteer

Featured Post

New feature and membership benefit!

New feature! Upgrade and increase expert visibility of your issues with Priority Questions.

  • 2
Tackle projects and never again get stuck behind a technical roadblock.
Join Now