MS Word doc to TextArea

Posted on 2005-05-06
Last Modified: 2009-12-16

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?
Question by:JanWale
    LVL 13

    Accepted 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: (free? :)) ($260, but does what you want) ($100)

    LVL 22

    Expert Comment

    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
    LVL 22

    Expert Comment

    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

    Why You Should Analyze Threat Actor TTPs

    After years of analyzing threat actor behavior, it’s become clear that at any given time there are specific tactics, techniques, and procedures (TTPs) that are particularly prevalent. By analyzing and understanding these TTPs, you can dramatically enhance your security program.

    Join & Write a Comment

    Suggested Solutions

    Title # Comments Views Activity
    Using Currency Layer API within ASP 10 59
    Group by correlation 4 41
    Update function to validate checkbox is checked 4 49
    JSON error 4 27
    I would like to start this tip/trick by saying Thank You, to all who said that this could not be done, as it forced me to make sure that it could be accomplished. :) To start, I want to make sure everyone understands the importance of utilizing p…
    Have you ever needed to get an ASP script to wait for a while? I have, just to let something else happen. Or in my case, to allow other stuff to happen while I was murdering my MySQL database with an update. The Original Issue This was written…
    Sending a Secure fax is easy with eFax Corporate ( First, Just open a new email message.  In the To field, type your recipient's fax number You can even send a secure international fax — just include t…
    In this tutorial you'll learn about bandwidth monitoring with flows and packet sniffing with our network monitoring solution PRTG Network Monitor ( If you're interested in additional methods for monitoring bandwidt…

    729 members asked questions and received personalized solutions in the past 7 days.

    Join the community of 500,000 technology professionals and ask your questions.

    Join & Ask a Question

    Need Help in Real-Time?

    Connect with top rated Experts

    21 Experts available now in Live!

    Get 1:1 Help Now