java - Replace a certain String with iText TextField in ListArray -
using of itext want create pdf document containing table values file db. next step, before putting values table want find values matching pre-defined keyword , replace them textfields. thus, text fields should in appropriate cells, i.e. if keyword @ 2nd row , 3rd column, cell should text field inserted. perform wrote following method:
try { scanner scan = new scanner(new file("filedb.txt")); scan.usedelimiter(",|" + system.getproperty("line.separator")); int = 0; while(scan.hasnext()) { string t1 = scan.next(); string t2 = scan.next(); string t3 = scan.next(); string t4 = scan.next(); // puts columns arraylist list<object> allcolumns = new arraylist<object>(); allcolumns.add(t1); allcolumns.add(t2); allcolumns.add(t3); // *updated* checks 'keywrd' in columns , replaces them txt_fld (int n=0; n < allcolumns.size(); n++) { pdfpcell cell = new pdfpcell(); cell.setcellevent(new textfields(n)); if (allcolumns.get(n).equals("keywrd")) { allcolumns.set(n, cell); } } // inserts columns table cells (pdfpcell values : allcolumns) { table.addcell(values); } // creates textfields @ last column of given table pdfpcell cell = new pdfpcell(); cell.setcellevent(new textfields(i)); table.addcell(cell); i++; } scan.close(); } catch (exception e) { e.printstacktrace(); }
error:
the method add(pdfpcell) in type list not applicable arguments (object)
how adapt above structure code in order perform replace method according keyword?
Comments
Post a Comment