ok I found my probleme.
 
This was the width which was too small to put the entire cell (Apparently in a PdfPTable which has a width of 100, you can put 14 car in size 12 and no more, and if you have more car in the cell, itext creates a second element, see as a second row).
 
So itext create 2 "rows" in the cell (I have to go in the itext source code to find it), and the second "row" is placed just after the first (this is why i couldn't see it in my pdf file)
 
Thanks for your precious help and go on your very useful work.
ER

Eric Rosaz <[EMAIL PROTECTED]> a écrit :
Here is the output:
Line 0: line h=16.0, total h=16.0, nbCar=14
Line 1: line h=16.0, total h=32.0, nbCar=14
Line 2: line h=16.0, total h=48.0, nbCar=14
Line 3: line h=16.0, total h=64.0, nbCar=15
Line 4: line h=28.0, total h=92.0, nbCar=15
 
Here is the pdf file:
titre
01234567890123
01234567890123
01234567890123
012345678901234
012345678901234
 
I notice that the line #3 has 15car and its height is 16. But the line #4 is 28 heigh
 
A more simple version of my code:
 
// Init data table
PdfPTable dataTableN1 = new PdfPTable(edition.getColonnes().size());
dataTableN1.setTotalWidth(100f);
 
// add a first line
PdfPCell cell1 = new PdfPCell(new Phrase("titre"));
dataTableN1.addCell(cell1);
 
// add lines
for (int indexLine = 0; indexLine < 10; indexLine++) {
  // get a data line
  String lib1 = "01234567890123";
  if (indexLine > 5) {
    lib1 = "012345678901234";
  }
  cell1 = new PdfPCell(new Phrase(lib1));
 
  // debug
  dataTableN1.calculateHeightsFast();
  System.out.println("Line " + indexLine + ": line h=" + dataTableN1.getRowHeight(indexLine) + ", total h=" + dataTableN1.getTotalHeight() + ", nbCar="+lib1.length());
 
  // add the ligne into the data table
  dataTableN1.addCell(cell1);
}
document.add(dataTableN1);
document.newPage();
 
 
thks for trying this.
ER
ps: I notice that if I don't put the first line, the row height is 0.0, but this is another probleme)


Paulo Soares <[EMAIL PROTECTED]> a écrit :
If you post some code I won't have to guess.

Paulo

> -----Original Message-----
> From: [EMAIL PROTECTED]
> [mailto:[EMAIL PROTECTED] On
> Behalf Of Eric Rosaz
> Sent: Friday, October 06, 2006 12:15 PM
> To: [email protected]
> Subject: [iText-questions] RE : Re: height of row
>
> Ok but when i open the pdf file, it contains only one line. I
> did another test: when I put 14 caracters in the row, its
> height is 16, and when I put 15 caracters , its height is 28.
>
> I don't understand why itext calculate 2 rows for 15
> caracters instead of 1 ? I try to change de totalWidth,
> thinking that itext didn't have too much place to put the
> text in only one row, but the height didn't change.
>
> ER
>
>
>
> Paulo Soares <[EMAIL PROTECTED]>a écrit :
>
> That looks like two lines: padding = 2+2 = 4, font size = 12.
> One line = 2+2 + 12 = 16
> two lines = 2+2 + 2*12 = 28
>
> Paulo
>
> > -----Original Message-----
> > From: [EMAIL PROTECTED]
> > [mailto:[EMAIL PROTECTED] On
> > Behalf Of Eric Rosaz
> > Sent: Friday, October 06, 2006 11:13 AM
> > To: [email protected]
> > Subject: [iText-questions] height of row
> >
> > Hi,
> >
> > I read a lot of mail about the height of the row in PdfPTable
> > and I fixed some problems but I still have one.
> >
> > I had a table with 1 column and always the same thing in the
> > rows. I set a total width "tableLigne.setTotalWidth(100f);"
> > and when I write 12 caracters in the rows "dddddddddddd", the
> > height of the row is 16 and when I write 24 caracters
> > "zzzzzzzzzzzzzzzzzzzzzzzz", the height is 28.
> >
> > It's a bit hard to understand how the height is calculated, i
> > understood that it's important to set the width but I don't
> > understand how , please can you explain me what's happen?
> >
> > thks
> > ER
> >
> > ________________________________
> >
> > Découvrez un nouveau moyen de poser toutes vos questions quel
> > que soit le sujet ! Yahoo! Questions/Réponses pour partager
> > vos connaissances, vos opinions et vos expériences. Cliquez
> > ici .
> >
>
>
> Aviso Legal:
> Esta mensagem é destinada exclusivamente ao
> destinatário. Pode conter informação confidencial ou
> legalmente protegida. A incorrecta transmissão desta mensagem
> não significa a perca de confidencialidade. Se esta mensagem
> for recebida por engano, por favor envie-a de volta para o
> remetente e apague-a do seu sistema de imediato. É proibido a
> qualquer pessoa que não o destinatário de usar, revelar ou
> distribuir qualquer parte desta mensagem.
>
> Disclaimer:
> This message is destined exclusively to the intended
> receiver. It may contain confidential or legally protected
> information. The incorrect transmission of this message does
> not mean the loss of its confidentiality. If this message is
> received by mistake, please send it back to the sender and
> delete it from your system immediately. It is forbidden to
> any person who is not the intended receiver to use,
> distribute or copy any part of this message.
>
>
> --------------------------------------------------------------
> -----------
> Take Surveys. Earn Cash. Influence the Future of IT
> Join SourceForge.net's Techsay panel and you'll get the
> chance to share your
> opinions on IT & business topics through brief surveys
> -- and earn cash
>
> http://www.techsay.com/default.php?page=join.php&p=sourceforge
> &CID=DEVDEV
> _______________________________________________
> iText-questions mailing list
> [email protected]
> https://lists.sourceforge.net/lists/listinfo/itext-questions
>
>
>
> ________________________________
>
> Découvrez un nouveau moyen de poser toutes vos questions quel
> que soit le sujet ! Yahoo! Questions/Réponses pour partager
> vos connaissances, vos opinions et vos expériences. Cliquez
> ici .
>


Aviso Legal:
Esta mensagem é destinada exclusivamente ao destinatário. Pode conter informação confidencial ou legalmente protegida. A incorrecta transmissão desta mensagem não significa a perca de confidencialidade. Se esta mensagem for recebida por engano, por favor envie-a de volta para o remetente e apague-a do seu sistema de imediato. É proibido a qualquer pessoa que não o destinatário de usar, revelar ou distribuir qualquer parte desta mensagem.

Disclaimer:
This message is destined exclusively to the intended receiver. It may contain confidential or legally protected information. The incorrect transmission of this message does not mean the loss of its confidentiality. If this message is received by mistake, please send it back to the sender and delete it from your system immediately. It is forbidden to any person who is not the intended receiver to use, distribute or copy any part of this message.

-------------------------------------------------------------------------
Take Surveys. Earn Cash. Influence the Future of IT
Join SourceForge.net's Techsay panel and you'll get the chance to share your
opinions on IT & business topics through brief surveys -- and earn cash
http://www.techsay.com/default.php?page=join.php&p=sourceforge&CID=DEVDEV
_______________________________________________
iText-questions mailing list
[email protected]
https://lists.sourceforge.net/lists/listinfo/itext-questions


Découvrez un nouveau moyen de poser toutes vos questions quel que soit le sujet ! Yahoo! Questions/Réponses pour partager vos connaissances, vos opinions et vos expériences. Cliquez ici. -------------------------------------------------------------------------
Take Surveys. Earn Cash. Influence the Future of IT
Join SourceForge.net's Techsay panel and you'll get the chance to share your
opinions on IT & business topics through brief surveys -- and earn cash
http://www.techsay.com/default.php?page=join.php&p=sourceforge&CID=DEVDEV_______________________________________________
iText-questions mailing list
[email protected]
https://lists.sourceforge.net/lists/listinfo/itext-questions


Découvrez un nouveau moyen de poser toutes vos questions quel que soit le sujet ! Yahoo! Questions/Réponses pour partager vos connaissances, vos opinions et vos expériences. Cliquez ici.
-------------------------------------------------------------------------
Take Surveys. Earn Cash. Influence the Future of IT
Join SourceForge.net's Techsay panel and you'll get the chance to share your
opinions on IT & business topics through brief surveys -- and earn cash
http://www.techsay.com/default.php?page=join.php&p=sourceforge&CID=DEVDEV
_______________________________________________
iText-questions mailing list
[email protected]
https://lists.sourceforge.net/lists/listinfo/itext-questions

Reply via email to