Articles in this section

How to apply custom color in PdfLightTable cell background

Apply custom color in PdfLightTable cell background

Custom background color for the PdfGridCell can be applied using BackgroundBrush property in PdfCellStyle,

The code snippet for the same can be found below:

//Create a new PDF document.
PdfDocument doc = new PdfDocument();
 
//Add a page.
PdfPage page = doc.Pages.Add();
 
var headerStyle = new PdfCellStyle
{
       BackgroundBrush = new PdfSolidBrush(new PdfColor(Color.FromArgb(255,109, 175, 61))),
       BorderPen = new PdfPen(new PdfColor(Color.FromArgb(255, 109, 175, 61)))
};
var defaultStyle = new PdfCellStyle
{
      TextBrush = PdfBrushes.Black,
     BorderPen = new PdfPen(new PdfColor(Color.FromArgb(255, 109, 175, 61)))
};
 
var pdfLightTable = new PdfLightTable
{
      Style =
      {
          BorderPen = new PdfPen(new PdfColor(Color.FromArgb(255, 109, 175, 61))),
          ShowHeader=true,
          RepeatHeader=true,
          HeaderStyle=headerStyle,
          DefaultStyle=defaultStyle
      }             
};

 

Sample link:

https://www.syncfusion.com/downloads/support/directtrac/general/ze/Sample-62113850

Did you find this information helpful?
Yes
No
Help us improve this page
Please provide feedback or comments
Comments (0)
Access denied
Access denied