Export (0) Print
Expand All
Expand Minimize

How to: Add Pictures and Word Art to Documents

NoteNote

Some code examples in this topic use the this or Me keyword or the Globals class in a way that is specific to document-level customizations, or they rely on features of document-level customizations such as host controls. These examples can be compiled only if you have the required applications installed. For more information, see Features Available by Product Combination.

You can add pictures and drawing objects to your documents at design time or during run time. WordArt enables you to add decorative text to Microsoft Office Word 2003 documents. These special text effects are drawing objects that you can customize and insert into your document.

At Design Time

You can use the Picture menu item to insert both WordArt and pictures into your document. You can also find these options on Drawing toolbar.

To add WordArt to your document at design time

  1. Place your cursor at the position you want to insert the WordArt in the document.

  2. On the Insert menu, click Picture, and then click Insert WordArt.

  3. Select a WordArt Style from the WordArt Gallery dialog box and click OK.

  4. Add the text that you want to appear in the document to the Edit WordArt Text dialog box and click OK.

    The text is added to your document with the selected WordArt style applied.

To Add a Picture to your document at design time

  1. Place your cursor at the position you want to insert the picture in the document.

  2. On the Insert menu, click Picture, and then click From File.

  3. In the Insert Picture dialog box, navigate to the picture you want to insert, and click Insert.

    The picture is added to your document at the current cursor location.

At Run Time

You can insert pictures or WordArt programmatically into your document at the current cursor location.

To add a Picture to the document at the current selection

  • Call the AddPicture method of InlineShapes objects and pass in the name of the file.

    this.Application.Selection.InlineShapes.AddPicture(@"C:\SamplePicture.jpg", 
        ref missing, ref missing, ref missing);
    
    

To add WordArt to the document at the current selection

  1. Get the left and top position of the current cursor location.

    float leftPosition = (float)this.Application.Selection.get_Information(
        Word.WdInformation.wdHorizontalPositionRelativeToPage);
    
    float topPosition = (float)this.Application.Selection.get_Information(
        Word.WdInformation.wdVerticalPositionRelativeToPage);
    
    
  2. Call the AddTextEffect method of the Shapes object.

    this.Shapes.AddTextEffect(
        Microsoft.Office.Core.MsoPresetTextEffect.msoTextEffect29, "SampleText",
        "Arial Black", 24, 
        Microsoft.Office.Core.MsoTriState.msoFalse, Microsoft.Office.Core.MsoTriState.msoFalse,
        leftPosition, topPosition, ref missing);
    
    

Compiling the Code

  • A picture named SamplePicture.jpg must exist on the C: drive.

See Also

Community Additions

ADD
Show:
© 2014 Microsoft