dcsimg
Results 1 to 5 of 5

Thread: Word automation

  1. #1

    Thread Starter
    New Member
    Join Date
    Jan 2019
    Posts
    3

    Word automation

    I am trying to take text created from another application and print/save it in a word document.
    I want to keep the line breaks from the original application.

    If I use:

    moApp.selection.typetext(Convert.ToString("line 1" & vbNewLine))
    moApp.selection.typetext(Convert.ToString("line 2" & vbNewLine))
    moApp.selection.typetext(Convert.ToString("line 3" & vbNewLine))

    etc. I get an extra line between my lines. (vbNewLine , vbCr and vbLf) seem to work the same way.

    If I leave out "vbNewLine" Word reformats the paragraphs and creates it's own line breaks.

    How do I get around this?

    Thanks in advance, BILL

  2. #2
    Frenzied Member
    Join Date
    Oct 2001
    Location
    Idaho Falls, Idaho USA
    Posts
    1,229

    Re: Word automation

    Did you check the formatting of the document under the Paragraph settings? That may be what is supposed to happen by the default settings - a paragraph ends with a NewLine, followed by a blank line.

  3. #3

    Thread Starter
    New Member
    Join Date
    Jan 2019
    Posts
    3

    Re: Word automation

    Quote Originally Posted by jdc2000 View Post
    Did you check the formatting of the document under the Paragraph settings? That may be what is supposed to happen by the default settings - a paragraph ends with a NewLine, followed by a blank line.
    How do I do that in Word 2010?

  4. #4

    Thread Starter
    New Member
    Join Date
    Jan 2019
    Posts
    3

    Re: Word automation

    Never mind. I figured it out and it does exactly what I need. Thank you very much!!!!

  5. #5
    Fanatic Member cory_jackson's Avatar
    Join Date
    Dec 2011
    Location
    Fallbrook, California
    Posts
    723

    Re: Word automation

    When I'm working with Office applications I use the MS Office Interop API. It allows one to control Office applications from within your .NET program. Very slick and easy to use.

Posting Permissions

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



Featured


Click Here to Expand Forum to Full Width