次の方法で共有


DocumentBase.Background Property

Gets or sets a Shape that represents the background image for the specified document.

Namespace:  Microsoft.Office.Tools.Word
Assembly:  Microsoft.Office.Tools.Word.v4.0.Utilities (in Microsoft.Office.Tools.Word.v4.0.Utilities.dll)

Syntax

'Declaration
Public Property Background As Shape
public Shape Background { get; set; }

Property Value

Type: Microsoft.Office.Interop.Word.Shape
A Shape that represents the background image for the specified document.

Remarks

Backgrounds are visible only in Web layout view.

Examples

The following code example sets the background of the document to a picture. This example assumes that there is a file named Image.jpg at the root of the C directory. To use this example, run it from the ThisDocument class in a document-level project.

Private Sub DocumentBackground()
        Me.ActiveWindow.View.Type = Word.WdViewType.wdWebView
        Me.Background.Fill.UserPicture("C:\Image.jpg")
    End Sub
private void DocumentBackground()
{
    this.ActiveWindow.View.Type = Word.WdViewType.wdWebView;
    this.Background.Fill.UserPicture("C:\\Image.jpg");
}

.NET Framework Security

See Also

Reference

DocumentBase Class

Microsoft.Office.Tools.Word Namespace