CodeGuru Home VC++ / MFC / C++ .NET / C# Visual Basic VB Forums Developer.com
Results 1 to 4 of 4
  1. #1
    Join Date
    Jun 2013
    Posts
    2

    Delete blank page in MS word document using C#

    I am using C# to create a word document from a template (Word) that contains several bookmarks. My application generates different tables and paragraphs at specific bookmarks. However, there is a blank page created in the end of the document which I am not sure how to get rid of. I searched on the internet but could not find much help. Will appreciate if anyone could provide some guidance.

  2. #2
    Arjay's Avatar
    Arjay is offline Moderator / EX MS MVP Power Poster
    Join Date
    Aug 2004
    Posts
    13,490

    Re: Delete blank page in MS word document using C#

    Figure out what's wrong by opening the document you created in word. Probably a slight adjustment of the margins will cause the extra page to go away.

    Determine what you need to do manually in Word, then change the code accordingly.

  3. #3
    Join Date
    Jun 2013
    Posts
    2

    Re: Delete blank page in MS word document using C#

    I was inserting extra paragraphs after each table I created. I just removed them and it worked fine!

    Thanks for your reply.

  4. #4
    Join Date
    Jul 2001
    Location
    Sunny South Africa
    Posts
    11,283

    Re: Delete blank page in MS word document using C#

    Margins in MS Word ( all versions ) is a real pain! I had similar issues with VB.NET. Remember as well that not each PC's margins might be the same as yours on your machine. What I had to do was to add logic into my program that sets the margins precisely. Just some food for thought

Tags for this Thread

Posting Permissions

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





Click Here to Expand Forum to Full Width

Featured