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
- Full trust for the immediate caller. This member cannot be used by partially trusted code. For more information, see Using Libraries from Partially Trusted Code.