Runnable? that would need to pass the whole project, which is rather
complex, but here is the relevant method.document.TOTAL_WIDTH is
verified and correct.
The decontructed logic basically is quite simple:
do {
PdfPTable t = new PdfPTable(new float[] {13, 12, 11, 12, 10, 15,
27});
t.setTotalWidth(document.TOTAL_WIDTH);
// adding cells....
} while (document.writer.fitsPage(t)); // returns false after 2/3 of the
page
The other condition in the while loop is not the problem. I checked
that.
Thanks in advance...
private PdfPCell getColumn() {
Font headFont = BaseAbrechnung.fontEVNHead;
Font f = BaseAbrechnung.fontEVN;
PdfPTable t = new PdfPTable(new float[] {13, 12, 11, 12, 10, 15,
27});
t.setTotalWidth(document.TOTAL_WIDTH);
t.addCell(getHeadCell(new Phrase("Datum", headFont)));
t.addCell(getHeadCell(new Phrase("Uhrzeit", headFont)));
t.addCell(getHeadCell(new Phrase("Dauer", headFont)));
t.addCell(getHeadCell(new Phrase("ServiceNr", headFont)));
t.addCell(getHeadCell(new Phrase("Kunden\nKennung", headFont)));
t.addCell(getHeadCell(new Phrase("Gegenstelle", headFont)));
PdfPTable tOp = new PdfPTable(2);
tOp.addCell(getHeadCell(new Phrase("Operator\nDauer", headFont)));
tOp.addCell(getHeadCell(new Phrase("Operator\nKennung", headFont)));
PdfPCell opCell = new PdfPCell(tOp);
opCell.setBorder(0);
t.addCell(opCell);
boolean fits;
do { // gehe solange durch bis spalte voll oder evn fertig
HashMap call = (HashMap) calls.get(currentIndex);
// call-spalten
t.addCell(getCell(new
Phrase(getDatum((String)call.get("ts")),f)));
t.addCell(getCell(new
Phrase(getUhrzeit((String)call.get("ts")),f)));
t.addCell(getCell(new
Phrase(Util.getMinutes((Integer)call.get("dauer")),f)));
t.addCell(getCell(new Phrase((String) call.get("servicenr"),f)));
t.addCell(getCell(new Phrase((String)call.get("kundenid"),f)));
t.addCell(getCell(new
Phrase(getGegenstelle((String)call.get("gegenstelle")),f)));
// op-anteile
List opAnteile = (List) call.get("opanteile");
Iterator oa = opAnteile.iterator();
tOp = new PdfPTable(2);
while (oa.hasNext()) {
HashMap opCall = (HashMap) oa.next();
tOp.addCell(getCell(new
Phrase(Util.getMinutes((Integer)opCall.get("dauer")),f)));
tOp.addCell(getCell(new
Phrase((String)opCall.get("operatorid"),f)));
}
opCell = new PdfPCell(tOp);
opCell.setBorder(0);
t.addCell(opCell);
fits =document.writer.fitsPage(t);
if (!fits) {
t.deleteLastRow();
} else currentIndex++;
} while(fits && gesamtAnzahl > currentIndex);
PdfPCell c = new PdfPCell(t);
//c.setBorder(0);
return c;
}
> -----Urspr�ngliche Nachricht-----
> Von: Paulo Soares [mailto:[EMAIL PROTECTED]
> Gesendet: Samstag, 23. August 2003 14:06
> An: Marc Lustig; iText list
> Betreff: Re: [iText-questions] writer.fitsPage(table)
> returning false even if there's space enough
>
>
> I would like to see a runable example with that behavior.
>
> Best Regards,
> Paulo Soares
>
> ----- Original Message -----
> From: "Marc Lustig" <[EMAIL PROTECTED]>
> To: "iText list" <[EMAIL PROTECTED]>
> Sent: Friday, August 22, 2003 17:38
> Subject: [iText-questions] writer.fitsPage(table) returning
> false even if there's space enough
>
>
> > Hi again,
> >
> > I tried to solve the problem another way and use
> > writer.fitsPage(table); to check whether there is enough
> space or not.
> > Strangely this doesn't work either: writer.fitsPage(table) returns
> > false even when the table covers only 2/3 of the available space of
> > the page. It always allows 32 rows, independently where the table
> > starts, and then returns false. How comes that? It it a bug?
> >
> > Regards
> > Marc
> >
> >
> >
> >
> > -------------------------------------------------------
> > This SF.net email is sponsored by: VM Ware
> > With VMware you can run multiple operating systems on a single
> > machine. WITHOUT REBOOTING! Mix Linux / Windows / Novell virtual
> > machines at the same time. Free trial click
> > here:http://www.vmware.com/wl/offer/358/0
> > _______________________________________________
> > iText-questions mailing list [EMAIL PROTECTED]
> > https://lists.sourceforge.net/lists/listinfo/itext-questions
> >
>
-------------------------------------------------------
This SF.net email is sponsored by: VM Ware
With VMware you can run multiple operating systems on a single machine.
WITHOUT REBOOTING! Mix Linux / Windows / Novell virtual machines
at the same time. Free trial click here:http://www.vmware.com/wl/offer/358/0
_______________________________________________
iText-questions mailing list
[EMAIL PROTECTED]
https://lists.sourceforge.net/lists/listinfo/itext-questions