当我运行此代码时,它会生成 PDF,尽管只会显示品牌而不显示成本。它似乎只显示字符串而不是整数、浮点数等。如果我要创建一个表并使用.addCell(temptr.getFltTyreCost());
它不仅不起作用,而且我得到一个错误
找不到适合 addCell(float) 的方法。
代码:
EntityManagerFactory emf = Persistence.createEntityManagerFactory("TyreTread2013DTAPU");
EntityManager em = emf.createEntityManager();
List<Tyrerange> tr = em.createNamedQuery("Tyrerange.findAll").getResultList();
Document document = new Document();
PdfWriter.getInstance(document, new FileOutputStream(tireFile));
document.open();
Image ttlogo = Image.getInstance(ttLogo);
ttlogo.scaleAbsolute(525, 85);
document.add(ttlogo);
document.add(new Paragraph("Inventory Tire Stock on Hand Report",
FontFactory.getFont(FontFactory.TIMES_BOLDITALIC, 18, Font.BOLD, BaseColor.RED)));
document.add(new Paragraph(new Date().toString()));
document.add(new Paragraph(" "));
document.add(new Paragraph("Brand \t\t Cost"));
for (Tyrerange temptr : tr) {
document.add(new Paragraph(temptr.getStrTyreBrand()));
document.add(new Paragraph(temptr.getFltTyreCost()));
}