Hi Rajeev
Thanks for your inquiry. Please use
tag for line break, it will help you to move text on new line. Moreover I am afraid I am unable to notice the HtmlFragment object issue with cell object. Please check following code snippet to details.
Document doc = new Document();<o:p></o:p>
Page page = doc.getPages().add();<o:p></o:p>
// Initializes a new instance of the
Table<o:p></o:p>
com.aspose.pdf.Table table = new
com.aspose.pdf.Table();<o:p></o:p>
table.setColumnWidths(“150 150”);<o:p></o:p>
// Set the table border color as
LightGray<o:p></o:p>
table.setBorder(new com.aspose.pdf.BorderInfo(com.aspose.pdf.BorderSide.All, .5f,
com.aspose.pdf.Color.getLightGray()));<o:p></o:p>
HtmlFragment html = new HtmlFragment("<fontsize=10>Html
FragmentsTable Of
Contents");<o:p></o:p>
html.getMargin().setBottom(10);<o:p></o:p>
// add row to table<o:p></o:p>
com.aspose.pdf.Row row1 =
table.getRows().add();<o:p></o:p>
// add table cells<o:p></o:p>
row1.getCells().add(“Column
1”);<o:p></o:p>
row1.getCells().add(“Column
2”);<o:p></o:p>
// create a loop to add 10 rows<o:p></o:p>
for (int row_count = 1;
row_count < 5; row_count++)<o:p></o:p>
{<o:p></o:p>
//
add row to table<o:p></o:p>
com.aspose.pdf.Row row = table.getRows().add();<o:p></o:p>
//
add table cells<o:p></o:p>
com.aspose.pdf.Cell cell1 = row.getCells().add();<o:p></o:p>
cell1.getParagraphs().add(new TextFragment(“test”));<o:p></o:p>
<o:p></o:p>
com.aspose.pdf.Cell cell2 = row.getCells().add();<o:p></o:p>
cell2.getParagraphs().add(html);<o:p></o:p>
}<o:p></o:p>
// Add table object to first page of
input document<o:p></o:p>
page.getParagraphs().add(table);<o:p></o:p>
doc.save(myDir+“out_htmltext.pdf”); <o:p></o:p>
Please feel free to contact us for any further assistance.
Best Regards,