Com.aspose.pdf.table

i have a table and would like to add cells with newline characters in it, but have had a hard time figuring out how.


below i have set row.get(i) = “name line 1 \n last on line two.”
"name line 1 #$NL last on line two"

nothing seems to work.

public com.aspose.pdf.Row tableAddRow(com.aspose.pdf.Table t, List row){
Row r = t.getRows().add();

for(Integer i=0;i<row.size();i++) {
r.getCells().add(row.get(i));
}
return r;
}

how do i get a newline into a cell and force the rest of the string
onto the next line within the same cell???

using a textfragment was suggested to me by an aspose guy and this is my proof of concept hack that accomplishes what i needed.


for(Integer i=0;i<row.size();i++) {
r.getCells().add();
Cell c = r.getCells().get_Item(i);

String[] parts = row.get(i).split("#:#");
System.out.println(parts[0]);
for(Integer j=0;j<parts.length;j++) {
com.aspose.pdf.TextFragment textFragment = new com.aspose.pdf.TextFragment(parts[j]);
c.getParagraphs().add(textFragment);
}
}

Hi Reggie,


Thanks for using our API’s.

As suggested on Live Chat, in order to have Line break, please try using separate TextFragment objects. Please continue using our API’s and should you have any further query, please feel free to contact.