I write bellow code to show text in a line
- Code: Select all
textAndStyle.Text = " \n"+ "Contact Name : " + shippingdetails.Con_Contactname + ", Contact No : " + shippingdetails.Con_Contactno;
How can I make variable texts bold ?
textAndStyle.Text = " \n"+ "Contact Name : " + shippingdetails.Con_Contactname + ", Contact No : " + shippingdetails.Con_Contactno;
textAndStyle.Font = new PdfTrueTypeFont(new System.Drawing.Font("Arial", 8f, FontStyle.Bold), true);
PdfGridCellContent textAndStyle = new PdfGridCellContent();
textAndStyle.Text = textAndStyle.Text = " \n" + "Contact Name : ";
textAndStyle.Font = new PdfTrueTypeFont(new System.Drawing.Font("Arial", 8f, FontStyle.Regular), true);
textAndStyle.Brush = PdfBrushes.Black;
textAndStyle.StringFormat = new PdfStringFormat { Alignment = PdfTextAlignment.Left };
lst.List.Add(textAndStyle);
PdfGridCellContent textAndStyle2 = new PdfGridCellContent();
textAndStyle2.Text = shippingdetails.Con_Contactname;
textAndStyle2.Font = new PdfTrueTypeFont(new System.Drawing.Font("Arial", 8f, FontStyle.Bold), true);
textAndStyle2.Brush = PdfBrushes.Black;
textAndStyle2.StringFormat = new PdfStringFormat { Alignment = PdfTextAlignment.Left };
lst.List.Add(textAndStyle2);
PdfGridCellContent textAndStyle3 = new PdfGridCellContent();
textAndStyle3.Text = ", Contact No : " + shippingdetails.Con_Contactno;
textAndStyle3.Font = new PdfTrueTypeFont(new System.Drawing.Font("Arial", 8f, FontStyle.Regular), true);
textAndStyle3.Brush = PdfBrushes.Black;
textAndStyle3.StringFormat = new PdfStringFormat { Alignment = PdfTextAlignment.Left };
lst.List.Add(textAndStyle3);