Holger Rieß wrote:

> Hi,
>
> Is it possible to change line spacing within one document?
> I've tried the following code:
>
>     Paragraph mainParagraph = new Paragraph();
>     mainParagraph.setLeading(11.5f);
>
>     Paragraph subParagraph = new Paragraph();
>     subParagraph.setLeading(14f);
>
>     // ...
>     // add some text to subParagraph
>     for (...) {
>         subParagraph.add(new Chunk(tokenizer.sval, fonts[0]));
>         // ...   
>         subParagraph.add(new Chunk(Chunk.NEWLINE));
>         // ...
>     }
>
>     mainParagraph.add(subParagraph);
>     document.add(mainParagraph);
>
> The space between the lines of subParagraph is always 11.5 from 
> mainParagraph.
> This is only an example - I have to change the leading often within 
> the document.
> My intention was keeping all lines with the same distance together in 
> one paragraph.
> But this doesn't work. It looks like that the top paragraph 
> determinies the leading. 

You shouldn't nest paragraphs.
Add every paragraph to the document directly.
br,
Bruno

-------------------------------------------------------------------------
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