none
add text at bottom of last page RRS feed

Answers

  • Hi Rose Anna

    Yes, it's possible but could be a bit tricky... What should happen if this text would conflict with text already on the page?

    I'm inclined to suggest that the best solution for this might not be one that uses programming code. Here's something for your user and you to try:

    1. Use the Drawing tools (Insert/Illustrations/Shapes) to insert a Text Box. This is a rectangle into which text can be typed. Type in some sample text that's about the amount the user imagines this should be.

    2. Position it at the bottom of a page (any page) by dragging. Now right click the edge and choose the command: More layout options. Under "Horizontal" choose an appropriate alignment, perhaps "Center" to the "Margins". Under "Vertical", perhaps Bottom to the Margin. Make sure "Move with text" is NOT activated.

    At this point, no matter what kind of editing is done the text box will remain at the bottom of the page. The important question is then: at the bottom of WHICH page? Every graphics object that has text flow formatting (is not treated like a character in the text - the text wraps around it) is ANCHORED to a specific bit of text. If the setting File/Options/Display: Object anchors is activated you should be able to see the anchor near the left side of a paragraph. The graphic will appear on the same page as this anchor point - so if the text is edited in a way that moves the paragraph to a different page, the text box will go with it.

    There is no way to ensure the text will ALWAYS appear on the last page if additional editing is done in the document.

    ADDENDUM: Go to the Text Wrapping tab of the dialog box and activate "Top and Bottom" to make sure text flows by the box, not behind or in front of it.

    3. The text box with the text can then be saved as a BUILDING BLOCK (Insert/TExt/Quick Parts/Building Blocks) so that the user can insert it any time it's required. (A builing block can also be inserted using code, saving you from having to write all the code to position and format the text box.)

    ===========

    Another possibility would be to put the text in the document's FOOTER, inside an IF field, so that it only displays when the Page number equals the Number of Pages in the document. This would only be appropriate, however, if the document does not otherwise contain a Footer.


    Cindy Meister, VSTO/Word MVP, my blog


    Wednesday, March 11, 2015 5:05 PM
    Moderator

All replies

  • Hello Anna,

    VSTO doesn't provide anything for pages. I'd suggest asking Word specific questions on the Word for Developers forum instead.

    Wednesday, March 4, 2015 4:31 PM
  • Hi Rose Anna

    Yes...

    Which programming language are you working with?


    Cindy Meister, VSTO/Word MVP, my blog

    Friday, March 6, 2015 8:19 PM
    Moderator
  • Hi Cindy,

    I use VB.net in VS2010. 

    Friday, March 6, 2015 9:07 PM
  • Hi ra_smith

    Thank you for the additional information :-)

    In essence, what you need to do is go to the end of the document. There are a number of ways to get there; this is what I use:

    Dim rng as Word.Range = doc.Content 'doc = the Word.Document object you're using
    rng.Collapse(Word.WdCollapseDirection.wdCollapseEnd)
    rng.Text = "the text you want to add"


    Cindy Meister, VSTO/Word MVP, my blog

    Sunday, March 8, 2015 8:49 PM
    Moderator
  • Cindy

    Thanks for your reply.  What my user would really like is to have a paragraph show up about an inch above the end of the last page.  Is this possible? 

    Thanks

    Rose Anna

    Wednesday, March 11, 2015 3:34 PM
  • Hi Rose Anna

    Yes, it's possible but could be a bit tricky... What should happen if this text would conflict with text already on the page?

    I'm inclined to suggest that the best solution for this might not be one that uses programming code. Here's something for your user and you to try:

    1. Use the Drawing tools (Insert/Illustrations/Shapes) to insert a Text Box. This is a rectangle into which text can be typed. Type in some sample text that's about the amount the user imagines this should be.

    2. Position it at the bottom of a page (any page) by dragging. Now right click the edge and choose the command: More layout options. Under "Horizontal" choose an appropriate alignment, perhaps "Center" to the "Margins". Under "Vertical", perhaps Bottom to the Margin. Make sure "Move with text" is NOT activated.

    At this point, no matter what kind of editing is done the text box will remain at the bottom of the page. The important question is then: at the bottom of WHICH page? Every graphics object that has text flow formatting (is not treated like a character in the text - the text wraps around it) is ANCHORED to a specific bit of text. If the setting File/Options/Display: Object anchors is activated you should be able to see the anchor near the left side of a paragraph. The graphic will appear on the same page as this anchor point - so if the text is edited in a way that moves the paragraph to a different page, the text box will go with it.

    There is no way to ensure the text will ALWAYS appear on the last page if additional editing is done in the document.

    ADDENDUM: Go to the Text Wrapping tab of the dialog box and activate "Top and Bottom" to make sure text flows by the box, not behind or in front of it.

    3. The text box with the text can then be saved as a BUILDING BLOCK (Insert/TExt/Quick Parts/Building Blocks) so that the user can insert it any time it's required. (A builing block can also be inserted using code, saving you from having to write all the code to position and format the text box.)

    ===========

    Another possibility would be to put the text in the document's FOOTER, inside an IF field, so that it only displays when the Page number equals the Number of Pages in the document. This would only be appropriate, however, if the document does not otherwise contain a Footer.


    Cindy Meister, VSTO/Word MVP, my blog


    Wednesday, March 11, 2015 5:05 PM
    Moderator
  • Good Morning Cindy,

    Thanks for your reply.  I have been in software development for many years and haven't actually used Word or Excel for MANY more years.  The text being required at the bottom of the last page is standard on several documents and reports.  I'll look into the Building Block suggestion. 

    Do you have recommendations for references - I have a VSTO for Dummies purchased about 5 years ago. Other than that I do a search which gives me input from various forums and sometimes from MS Help. 

    Thanks again for your replies.

    Rose Anna

    Wednesday, March 11, 2015 6:35 PM
  • Hi Rose Anna

    <<The text being required at the bottom of the last page is standard on several documents and reports.  I'll look into the Building Block suggestion.>>

    If you haven't encountered it already in your research, also check out the "template" concept (as opposed to creating everything from scratch).

    <<Do you have recommendations for references >>

    Could you be more specific about what kind of information you'd like to reference? "Power user" or developer?

    I think there may be some decent power user books around, although I don't know any titles, off-hand (been too long since I've felt the need!).

    There's nothing current at the developer end, unless you read German. Publishers say there's no market for it...

    As for on-line, this forum for developer questions and the IT Pro (Technet) and Answers forums for end-user. You might also ask in one of those what else the people who support end-user recommend.


    Cindy Meister, VSTO/Word MVP, my blog

    Wednesday, March 11, 2015 7:02 PM
    Moderator
  • Hi Cindy,

    Thanks for your reply.  I am a developer (and had hoped my days as a power user were over).  Looking into "templates" has been on my list for several years.  This application takes data from several databases, displays on screen, then exports to Word. Only specific users are allowed to use the application and none are given the database passwords.  Most of the users are novice Word/Excel users. 

    Rose Anna

    Wednesday, March 11, 2015 9:03 PM
  • Hi Rose Anna

    Mmm, in the case of Office - since the object model so closely emulates what the user does - it's an advantage to have a "power user" understanding of the way things work. For esample, a "pure developer" - not knowing about styles, building blocks, templates - would tend to create the entire document from scratch, meaning more code and less efficiency in maintenance and execution of the solution.

    And, once you know "Word can do that" often you can use the macro recorder to discover the objects, methods and properties available in the object model, even though you can seldom use the recorded code, as it stands.


    Cindy Meister, VSTO/Word MVP, my blog

    Thursday, March 12, 2015 6:49 PM
    Moderator
  • Hi Cindy,

    I'm so glad that you are willing to work with me this way.  I started my transition from secretary to software developer by becoming the "Power User" of many tools like Office that have come and gone.  I am constantly surprised at the lack of knowledge of many individuals who use Office tools on a daily basis.  Setting up macros and formulas was such a kick for me that I had to make the move to software development and the best part of my job  is automating common tasks.  I fully understand the power of Office products and that there is a great deal of that power that I haven't used (due to opportunity or learning curve).  I also understand that many users do not know the power at their fingertips (or because of their novice standing, find the power intimidating rather than intoxicating). 

    Thanks for your input and I'll be doing more reading of your blog in the future.

    Rose Anna

    Thursday, March 12, 2015 10:15 PM