i have a paragraph,i want to align the paragraph one in the left another in the right.
My output
My Required Ouptut:
how to align the paragraph.here is my code
table = new PdfPTable(2);
table.HorizontalAlignment = 0;
table.SetWidths(new float[] {100f,100f});
table.TotalWidth = 500f;
table.LockedWidth = true;
// cell.Colspan = 2;
phrase = new Phrase();
phrase.Add(new Chunk("Work Experience:" + "\n\n", FontFactory.GetFont("Arial", 10, Font.BOLD)));
phrase.Add(new Chunk(txtDesc.Text.ToString() + "\n\n", FontFactory.GetFont("Arial", 8, Font.NORMAL)));
phrase.Add(new Chunk(txtComname.Text + "\n\n\n", FontFactory.GetFont("Arial", 5, Font.NORMAL)));
phrase.Add(new Paragraph(txttask1.Text + "\n\n", FontFactory.GetFont("Arial", 8, Font.NORMAL)));
phrase.Add(new Paragraph(txttask2.Text + "\n\n", FontFactory.GetFont("Arial", 8, Font.NORMAL)));
phrase.Add(new Paragraph(txttask3.Text + "\n\n", FontFactory.GetFont("Arial", 8, Font.NORMAL)));
table.AddCell(PhraseCell(phrase, PdfPCell.ALIGN_LEFT));
phrase = new Phrase();
cell = new PdfPCell(new Phrase());
cell.HorizontalAlignment = 1;
cell.BorderWidth = 0;
cell.Padding = 0;
cell.BorderWidthTop = 0;
cell.BorderWidthBottom = 0;
cell.BorderWidthLeft = 0;
cell.BorderWidthRight = 0;
cell.Colspan = 2;
phrase.Add(new Chunk("Skills :" + "\n\n", FontFactory.GetFont("Arial", 10, Font.BOLD)));
int rowindex = 0;
foreach (GridViewRow row in gvSkills.Rows)
{
TextBox t1 = (TextBox)gvSkills.Rows[rowindex].Cells[1].FindControl("txtskils1");
TextBox t2 = (TextBox)gvSkills.Rows[rowindex].Cells[2].FindControl("txtskils2");
string skil1 = t1.Text;
string skil2 = t2.Text;
Paragraph p1 = new Paragraph(skil1, FontFactory.GetFont("Arial", 8, Font.NORMAL));
p1.SetLeading(5f, 5f);
phrase.Add(p1);
Paragraph p2 = new Paragraph(" " + skil2, FontFactory.GetFont("Arial", 8, Font.NORMAL));
p2.SetLeading(5f, 5f);
p2.Alignment = 2;
p2.IndentationRight = 50f;
phrase.Add(p2);
phrase.Add(new Chunk(Environment.NewLine));
phrase.Add(new Chunk(Environment.NewLine));
rowindex++;
}
table.AddCell(PhraseCell(phrase, PdfPCell.ALIGN_LEFT));
ds.Add(table);