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

Different fonts in one grid cell

Thread ID:





129422 Mar 16,2017 02:10 PM UTC Mar 17,2017 01:52 PM UTC WinForms 1
Tags: PDF
Daniel Talley
Asked On March 16, 2017 02:10 PM UTC

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

Gayathri Ramalingam [Syncfusion]
Replied On 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 


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