Automating Footer with a Text Box. RRS feed

  • Question

  • VSTO in Word 2007 everything works just fine.  But we're upgrading to Office 2010, and part of the program is broke.

    I'm trying to set a textbox in the footer, show the "FILE COPY" text, and print the document.  I need a textshape with a name so I can catch it after printing and delete the shape to leave the document in its original condition.

    float imgtop = activeDoc.Application.InchesToPoints(top);
    float imgleft = activeDoc.Application.InchesToPoints(left);

    activeDoc.ActiveWindow.ActivePane.View.Type = Word.WdViewType.wdPrintView;
    activeDoc.ActiveWindow.ActivePane.View.SeekView = Word.WdSeekView.wdSeekCurrentPageHeader;

    Word.Shape imageShape =

    imageShape.TextFrame.TextRange.Text = "FILE COPY";

    imageShape.Line.Visible = MsoTriState.msoFalse;

    imageShape.RelativeHorizontalPosition = Word.WdRelativeHorizontalPosition.wdRelativeHorizontalPositionPage;
    imageShape.RelativeVerticalPosition = Word.WdRelativeVerticalPosition.wdRelativeVerticalPositionPage;

    imageShape.Name = "FILECOPY";

    imageShape.Height = activeDoc.Application.InchesToPoints((float)1);
    imageShape.Top = imgtop;
    imageShape.Left = imgleft;

    activeDoc.ActiveWindow.ActivePane.View.SeekView = Word.WdSeekView.wdSeekMainDocument;

    It appears to run normally, but the shape does not appear on the page.

    Any suggestions????

    Wednesday, November 7, 2012 7:50 PM


  • HI snyder

    Any chance that you may not have activated the First Page Header option on the document where you're testing this?

    (By the way, you can delete the lines for SeekView...)

    Cindy Meister, VSTO/Word MVP, my blog

    Thursday, November 8, 2012 7:18 AM