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. Image for the cookie policy date

Different fonts in one grid cell

Is there a way to put something like the following line in a grid cell? I need to bold the title and have the value not bold.

Title: Value

1 Reply

GR Gayathri Ramalingam Syncfusion Team March 17, 2017 01:52 PM UTC

Hi Daniel, 
Thank you for using Syncfusion product. 
Style can be applied to a single cell in PdfGrid by using BeginCellLayout event handler. Please find the code snippet and sample for the same. 
  private void PdfGrid_BeginCellLayout(object sender, PdfGridBeginCellLayoutEventArgs args) 
            if (args.RowIndex == 0 && args.CellIndex == 0) 
                //skip the cell 
                args.Skip = true; 
                // draw the cell 
                args.Graphics.DrawRectangle(PdfPens.Black, args.Bounds); 
                PdfFont font = new PdfStandardFont(PdfFontFamily.Courier, 10); 
                // Set the text. 
                string text = "Title:"; 
                //Measure the size of the text. 
                SizeF size = font.MeasureString(text); 
                //draw the string in cell 
                args.Graphics.DrawString(text, new PdfStandardFont(PdfFontFamily.Courier, 10, PdfFontStyle.Bold), PdfBrushes.Black, new PointF(0, 0)); 
                args.Graphics.DrawString("value", font , PdfBrushes.Black, new PointF(size.Width+2, 0)); 
Please find the Screen shot for your requirement, 
Please find sample from the following link, 
Please let us know if you need further assistance on this. 

With Regards, 
Gayathri R 

Live Chat Icon For mobile
Up arrow icon