read a doc file
CodeGuru Home VC++ / MFC / C++ .NET / C# Visual Basic VB Forums Developer.com
Results 1 to 6 of 6

Thread: read a doc file

  1. #1
    Join Date
    Apr 2004
    Posts
    7

    reading a word file through VB

    hi,

    i am a newbe in vb and i want to read a word file through vb
    so i don't how to do it...
    if you can please help me...
    word application is the way but i want all the methods described in that

  2. #2
    Join Date
    Jul 2000
    Location
    Milano, Italy
    Posts
    7,726

    Follow links or make a search

    You can search the forum (see near Codeguru image, to the right:
    user cp | register | calendar | members | f.a.q. | search |... and
    click on search)
    Or follow some links:

    http://www.codeguru.com/forum/showth...highlight=word
    ...at present time, using mainly Net 4.0, Vs 2010



    Special thanks to Lothar "the Great" Haensler, Chris Eastwood , dr_Michael, ClearCode, Iouri and
    all the other wonderful people who made and make Codeguru a great place.
    Come back soon, you Gurus.

  3. #3
    Join Date
    Apr 2004
    Posts
    7

    read a doc file

    hi

    I want to open the word file. and I want to read text from it. How can I do it? What methods should I use?

    What I want is that I need to read all the text in a string variable without any formatting and then search some stuff in it using RegExp.

    vikas

  4. #4
    Join Date
    Jul 2000
    Location
    Milano, Italy
    Posts
    7,726

    Here how to open it and get text

    Here an example on how to open it and get text.
    (Warning: this example get document and make a copy
    of it as plain text in same folder, with same name plus
    a ".txt" at end of name of doc.
    Ie: if you load c:\myDoc.Doc, you get also c:\myDoc.Doc.txt)
    Plus it load the text in memory, and if TXT file is not too big,
    shows it in a richtextBox.
    Attached Files Attached Files
    Last edited by Cimperiali; April 8th, 2004 at 08:30 AM.
    ...at present time, using mainly Net 4.0, Vs 2010



    Special thanks to Lothar "the Great" Haensler, Chris Eastwood , dr_Michael, ClearCode, Iouri and
    all the other wonderful people who made and make Codeguru a great place.
    Come back soon, you Gurus.

  5. #5
    Join Date
    Apr 2004
    Posts
    7

    Angry reading a doc file

    hi,
    thankyou Cimperiali...
    for helping me in reading a doc file....
    but by that way it is taking a lot of extra memory and hard disk space as i am storing the doc file in text format and then reading it...
    if there is any direct way to read a doc file then please tell me



    bye

    vikas

  6. #6
    Join Date
    Jul 2000
    Location
    Milano, Italy
    Posts
    7,726

    Open file for binary....

    Then you could
    1)open ythe file for binary,
    2)read all file in a variable (see cakkie sticky post)
    3)strip all chars that are not valid (use replace. you will have to
    match all non A-Zz-a0-9 plus spaces and chr 13 and chr10. There
    could be some else you may want to save....)
    4)open a file for output and print the resulting variable
    ...at present time, using mainly Net 4.0, Vs 2010



    Special thanks to Lothar "the Great" Haensler, Chris Eastwood , dr_Michael, ClearCode, Iouri and
    all the other wonderful people who made and make Codeguru a great place.
    Come back soon, you Gurus.

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •  


Windows Mobile Development Center


Click Here to Expand Forum to Full Width

This is a CodeGuru survey question.


Featured


HTML5 Development Center