We use cookies to give you the best experience on our website. If you continue to browse, then you agree to our privacy policy and cookie policy. (Last updated on: November 16, 2018).
Unfortunately, activation email could not send to your email. Please try again.
Syncfusion Feedback

Color not setting correctly in pdf grid row cells

Thread ID:





119252 May 29,2015 05:01 AM UTC Jun 1,2015 12:08 PM UTC WinForms 1
Tags: PDF
Asked On May 29, 2015 05:01 AM UTC

private void Form1_Load(object sender, EventArgs e)
            //create a new pdf document
            PdfDocument doc = new PdfDocument();

            //create new page
            PdfPage page = doc.Pages.Add();

            Font ffont = new Font("Arial", 6, FontStyle.Regular);

            //create a new pdf font
            PdfFont font = new PdfTrueTypeFont(ffont,true);

            //create a pdfgrid
            PdfGrid grid = new PdfGrid();

            //add new row to grid

            //add new column to grid

            PdfGridCellStyle style = new PdfGridCellStyle();
            style.Font = font;
            grid.Rows[0].Cells[0].Style = style;


            //measure the string height
            SizeF size = font.MeasureString("Toto jeřetězec, který sycnfusion státy by změna velikosti");

            grid.Rows[0].Cells[0].ColumnSpan = 9;
            //set the text to grid cell
            grid.Rows[0].Cells[0].Value = "Toto jeřetězec, který sycnfusion státy by změna velikosti";

           //set color of cell[0] to red
            //draw the grid to pdf
            grid.Draw(page, PointF.Empty);

            //save the pdf document

            //close the document

The entire row has red background color as opposed on only cell[0] and cell[1] having white background color

Chinnu Muniyappan [Syncfusion]
Replied On June 1, 2015 12:08 PM UTC

Hi Jp,

Thank you for using syncfusion products.

We can’t apply styles separately to a particular cell if it is spanned with other cells. While spanning, the entire spanned column/Row is considered as a single cell, so we can’t apply the styles for spanned cells separately. This is the default behaviour of Pdf Grid, please let us know if you need any further assistance.




This post will be permanently deleted. Are you sure you want to continue?

Sorry, An error occured while processing your request. Please try again later.

Please sign in to access our forum

This page will automatically be redirected to the sign-in page in 10 seconds.

Warning Icon You are using an outdated version of Internet Explorer that may not display all features of this and other websites. Upgrade to Internet Explorer 8 or newer for a better experience.Close Icon