Spire.PDF is a professional PDF library applied to creating, writing, editing, handling and reading PDF files without any external dependencies. Get free and professional technical support for Spire.PDF for .NET, Java, Android, C++, Python.

Fri Apr 30, 2021 8:04 am

Hi,
Bellow is sample code for add 2 text lines in cell

Code: Select all
textAndStyle = new PdfGridCellContent();
            textAndStyle.Text = Environment.NewLine + "for COMPANYNAME";// + Convert.ToString(CompanyDetails.CompanyName);
            textAndStyle.Font = new PdfTrueTypeFont(new System.Drawing.Font("Arial", 8f, FontStyle.Bold), true);
            textAndStyle.Brush = PdfBrushes.Black;
            textAndStyle.StringFormat = new PdfStringFormat { Alignment = PdfTextAlignment.Right};
           
            lst.List.Add(textAndStyle);

            textAndStyle = new PdfGridCellContent();
            textAndStyle.Text = Environment.NewLine + Environment.NewLine + Environment.NewLine + "Authorised Signatory";
            textAndStyle.Font = new PdfTrueTypeFont(new System.Drawing.Font("Arial", 7f, FontStyle.Bold), true);
            textAndStyle.Brush = PdfBrushes.Black;
            textAndStyle.StringFormat = new PdfStringFormat { Alignment = PdfTextAlignment.Right };           
            lst.List.Add(textAndStyle);

            bankdetailsrow.Cells[2].Value = lst;


and get output like bellow
pdf.png


but I expect bellow out put,need some lone break between this 2 lines
pdf.png

kuntal.bose
 
Posts: 20
Joined: Thu Apr 29, 2021 6:05 am

Fri Apr 30, 2021 11:04 am

Hi,

Thanks for your inquiry.
Please use the code below to achieve your requirment. If there is any question, please feel free to write back.
Code: Select all
PdfGridCellContent textAndStyle = new PdfGridCellContent();
textAndStyle.Text = " \n" + "for COMPANYNAME";// + Convert.ToString(CompanyDetails.CompanyName);
textAndStyle.Font = new PdfTrueTypeFont(new System.Drawing.Font("Arial", 8f, FontStyle.Bold), true);
textAndStyle.Brush = PdfBrushes.Black;
textAndStyle.StringFormat = new PdfStringFormat { Alignment = PdfTextAlignment.Right };
lst.List.Add(textAndStyle);

textAndStyle = new PdfGridCellContent();
textAndStyle.Text =" \n"+" \n"+ "Authorised Signatory";
textAndStyle.Font = new PdfTrueTypeFont(new System.Drawing.Font("Arial", 7f, FontStyle.Bold), true);
textAndStyle.Brush = PdfBrushes.Black;
textAndStyle.StringFormat = new PdfStringFormat { Alignment = PdfTextAlignment.Right }; ;
lst.List.Add(textAndStyle);

bankdetailsrow.Cells[2].Value = lst;


Sincerely,
Nina
E-iceblue support team
User avatar

Nina.Tang
 
Posts: 1187
Joined: Tue Sep 27, 2016 1:06 am

Fri Apr 30, 2021 11:51 am

Thankx,Working fine.

kuntal.bose
 
Posts: 20
Joined: Thu Apr 29, 2021 6:05 am

Mon May 03, 2021 10:23 am

Thanks for your feedback.
If you encounter any issues related to our products in the future, please feel free to contact us.

Sincerely,
Brian
E-iceblue support team
User avatar

Brian.Li
 
Posts: 1271
Joined: Mon Oct 19, 2020 3:04 am

Return to Spire.PDF