public void DocumentBuilderApplyBordersAndShading()
{
//ExStart
//ExFor:BorderCollection.Item(BorderType)
//ExFor:Shading
//ExFor:TextureIndex
//ExFor:ParagraphFormat.Shading
//ExFor:Shading.Texture
//ExFor:Shading.BackgroundPatternColor
//ExFor:Shading.ForegroundPatternColor
//ExId:DocumentBuilderApplyBordersAndShading
//ExSummary:Shows how to apply borders and shading to a paragraph.
Document doc = new Document();
DocumentBuilder builder = new DocumentBuilder(doc);
// Set paragraph borders
BorderCollection borders = builder.ParagraphFormat.Borders;
borders.DistanceFromText = 20;
borders[BorderType.Left].LineStyle = LineStyle.Double;
borders[BorderType.Right].LineStyle = LineStyle.Double;
borders[BorderType.Top].LineStyle = LineStyle.Double;
borders[BorderType.Bottom].LineStyle = LineStyle.Double;
// Set paragraph shading
Shading shading = builder.ParagraphFormat.Shading;
shading.Texture = TextureIndex.TextureDiagonalCross;
shading.BackgroundPatternColor = Color.LightCoral;
shading.ForegroundPatternColor = Color.LightSalmon;
builder.Write("I'm a formatted paragraph with double border and nice shading.");
//ExEnd
}