Document document = new Document(PageSize.A4, ml, mr, mt, mb);
PdfWriter writer=PdfWriter.getInstance(document, response.getOutputStream());
String sc_na=request.getParameter("school_name");
String name=sc_na;
writer.setPageEvent(new HeaderAndFooter(name));
document.open();
XMLWorkerHelper worker = XMLWorkerHelper.getInstance();
//HTMLWorker htmlWorker = new HTMLWorker(document);
Class.forName("com.mysql.jdbc.Driver");
Connection con = DriverManager.getConnection("jdbc:mysql://localhost:3306/elect", "root", "root");
Statement st=con.createStatement();
ResultSet rs=st.executeQuery("Select * from test3");
List arrlist = new ArrayList();
while(rs.next()){
String xa =rs.getString("display");
if(xa.equals("1")){
arrlist.add(rs.getString("question_text"));
}
}
Collections.shuffle(arrlist);
for(int i=0;i<nb;i++){
String str = (String) arrlist.get(i);
worker.parseXHtml(writer, document, new StringReader("<br>"));
worker.parseXHtml(writer, document, new StringReader(str));
}
document.close();
这是我code.Using的片段,我得到我在一个单一的column.What所有的数据,我应该这样做,我可以进入多个columns.One方式我想是使用PDFptable但我怎么应用它here.Please帮助。