java - iText, insert new blank line inside PdfPTable column -


how insert new blank line inside pdfptable column. \n , n number of spaces has not done trick me. java code working with.

chtbc_report1_table.setmodel(new javax.swing.table.defaulttablemodel( new object [][] {     {"h.b.g", "some value", "lbs/kg", "adult m : 120lbs \n adult f : 90lbs"},     .....     .....     //other rows     }, new string [] {     "investigation", "result", "unit", "weight" } )); 

i want put new line between "adult m : 120lbs **\n** adult f : 90lbs"

update

this code have used creating pdfptable

document.open();      pdfptable pdftable = new pdfptable(chtbc_report1_table.getcolumncount());         (int rows = 0; rows < chtbc_report1_table.getrowcount(); rows++) {         (int cols = 0; cols < chtbc_report1_table.getcolumncount(); cols++) {             pdftable.addcell(chtbc_report1_table.getmodel().getvalueat(rows, cols).tostring());          }     }     float[] columnwidths_pdftable = new float[]{30f, 25f, 40f, 50f};     pdftable.setwidths(columnwidths_pdftable);     document.add(pdftable);  document.close() 

any suggestions help.

oh, quite simple indeed. try following same works me :-

table contents

jtable1.setmodel(new javax.swing.table.defaulttablemodel(         new object [][] {             {"lorem ipsum", "next line here \n, new line\n, 2 new lines\n\ni end here"},             {"lorem ipsum", "another cell demonstrate \n\n\n\n4 new lines above , 2 below \n\n"}         },         new string [] {             "text", "long text"         }     )); 

let me know, if worked. , pdfptable should same.


Comments

Popular posts from this blog

javascript - Karma not able to start PhantomJS on Windows - Error: spawn UNKNOWN -

Nuget pack csproj using nuspec -

c# - Display ASPX Popup control in RowDeleteing Event (ASPX Gridview) -