Class BackgroundGradient
Represents the background gradient effect.
Implements
Inherited Members
Namespace: Syncfusion.DocIO.DLS
Assembly: Syncfusion.DocIO.UWP.dll
Syntax
public class BackgroundGradient : XDLSSerializableBase, IXDLSSerializable
Examples
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.Gradient;
//Set the first color of the background gradient of the document
document.Background.Gradient.Color1 = Color.AliceBlue;
//Set the second color of the background gradient of the document
document.Background.Gradient.Color2 = Color.Purple;
//Set the first shading style of the background gradient of the document
document.Background.Gradient.ShadingStyle = GradientShadingStyle.DiagonalDown;
//Set the first shading variant of the background gradient of the document
document.Background.Gradient.ShadingVariant = GradientShadingVariant.ShadingMiddle;
//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.Gradient
'Set the first color of the background gradient of the document
document.Background.Gradient.Color1 = Color.AliceBlue
'Set the second color of the background gradient of the document
document.Background.Gradient.Color2 = Color.Purple
'Set the first shading style of the background gradient of the document
document.Background.Gradient.ShadingStyle = GradientShadingStyle.DiagonalDown
'Set the first shading variant of the background gradient of the document
document.Background.Gradient.ShadingVariant = GradientShadingVariant.ShadingMiddle
'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
Constructors
BackgroundGradient()
Initializes a new instance of the BackgroundGradient class.
Declaration
public BackgroundGradient()
Properties
Color1
Gets or sets the first color for gradient effect.
Declaration
public Color Color1 { get; set; }
Property Value
Type | Description |
---|---|
Color | The first System.Drawing.Color for the gradient effect. |
Color2
Gets or sets the second color for gradient effect.
Declaration
public Color Color2 { get; set; }
Property Value
Type | Description |
---|---|
Color | The second System.Drawing.Color for the gradient effect. |
ShadingStyle
Gets or sets the shading style for gradient effect.
Declaration
public GradientShadingStyle ShadingStyle { get; set; }
Property Value
Type | Description |
---|---|
GradientShadingStyle | The GradientShadingStyle member that represents the shading style for gradient effect. |
ShadingVariant
Gets or sets the shading variants for gradient effect.
Declaration
public GradientShadingVariant ShadingVariant { get; set; }
Property Value
Type | Description |
---|---|
GradientShadingVariant | The GradientShadingVariant member that represents the shading variants for gradient effect. |
Methods
Clone()
Creates the duplicate copy of the background gradient.
Declaration
public BackgroundGradient Clone()
Returns
Type | Description |
---|---|
BackgroundGradient | The BackgroundGradient which is a copy of current gradient. |
ReadXmlAttributes(IXDLSAttributeReader)
Reads object data from xml attributes.
Declaration
protected override void ReadXmlAttributes(IXDLSAttributeReader reader)
Parameters
Type | Name | Description |
---|---|---|
IXDLSAttributeReader | reader | The IXDLSAttributeReader object. |
Overrides
WriteXmlAttributes(IXDLSAttributeWriter)
Writes object data as xml attributes.
Declaration
protected override void WriteXmlAttributes(IXDLSAttributeWriter writer)
Parameters
Type | Name | Description |
---|---|---|
IXDLSAttributeWriter | writer | The IXDLSAttributeWriter object. |