Background Class
Represents the background effects.
Inherited Members
System.Object.Equals(System.Object)
System.Object.Equals(System.Object, System.Object)
System.Object.GetHashCode()
System.Object.GetType()
System.Object.MemberwiseClone()
System.Object.ReferenceEquals(System.Object, System.Object)
System.Object.ToString()
Namespace: Syncfusion.DocIO.DLS
Assembly: Syncfusion.DocIO.Base.dll
Syntax
public class Background : XDLSSerializableBase, IXDLSSerializable
Properties
Color
Gets or sets the background color of the document.
Declaration
public Color Color { get; set; }
Property Value
Type | Description |
---|---|
System.Drawing.Color | The System.Drawing.Color specifies the background color for this document. |
Examples
private void Button1_Click(System.Object sender, System.EventArgs e)
{
//Load an existing Word document into WordDocument instance
WordDocument document = new WordDocument("Sample.docx");
//Set the background type of the document
document.Background.Type = BackgroundType.Color;
//Set the background color of the document
document.Background.Color = Color.AliceBlue;
//Save the document in the given name and format
document.Save("Document.docx", FormatType.Docx);
//Release the resources occupied by WordDocument instance
document.Close();
}
Private Sub button_Click(sender As Object, e As EventArgs)
'Load an existing Word document into WordDocument instance
Dim document As New WordDocument("Sample.docx")
'Set the background type of the document
document.Background.Type = BackgroundType.Color
'Set the background color of the document
document.Background.Color = Color.AliceBlue
'Save the document in the given name and format
document.Save("Document.docx", FormatType.Docx)
'Release the resources occupied by WordDocument instance
document.Close()
End Sub
Gradient
Gets or sets the background gradient.
Declaration
public BackgroundGradient Gradient { get; set; }
Property Value
Type | Description |
---|---|
BackgroundGradient | The BackgroundGradient object that specifies the gradient effect. |
See Also
Picture
Gets or sets the background picture.
Declaration
public Image Picture { get; set; }
Property Value
Type | Description |
---|---|
System.Drawing.Image | The System.Drawing.Image that represents the background for the document. |
Examples
The following code example demonstrates how to set the background for the document.
private void Button1_Click(System.Object sender, System.EventArgs e)
{
//Create an instance of WordDocument class
WordDocument document = new WordDocument();
//Set the background type of the document
document.Background.Type = BackgroundType.Picture;
//Set the background image of the document
document.Background.Picture = Image.FromFile("Image.png");
//Add one section with one paragraph to the document
document.EnsureMinimal();
//Add the text range to the last paragraph of the section
document.LastParagraph.AppendText("Hello World!");
//Save the document in the given name and format
document.Save("Sample.docx", FormatType.Docx);
//Release the resources occupied by WordDocument instance
document.Close();
}
Private Sub button_Click(sender As Object, e As EventArgs)
'Create an instance of WordDocument class
Dim document As New WordDocument()
'Set the background type of the document
document.Background.Type = BackgroundType.Picture
'Set the background image of the document
document.Background.Picture = Image.FromFile("Image.png")
'Add one section with one paragraph to the document
document.EnsureMinimal()
'Add the text range to the last paragraph of the section
document.LastParagraph.AppendText("Hello World!")
'Save the document in the given name and format
document.Save("Sample.docx", FormatType.Docx)
'Release the resources occupied by WordDocument instance
document.Close()
End Sub
Type
Gets or sets the type of background effect.
Declaration
public BackgroundType Type { get; set; }
Property Value
Type | Description |
---|---|
BackgroundType | The BackgroundType member that specifies the type of background. |
Methods
InitXDLSHolder()
Registers child objects in XDSL holder.
Declaration
protected override void InitXDLSHolder()
Overrides
Syncfusion.DocIO.DLS.XML.XDLSSerializableBase.InitXDLSHolder()