I don't see anything wrong with your approach, and without having code to look at, I have no idea where your exceptions are coming from, but the examples still throw me. In your examples containing your name on the first and second rows, these still do not look "centered." Rather, they look left-justified with a lot of padding, hence my earlier suggestion.
Padded, left-justified layout: |First Name: | Kyrill | |Last Names: | Alyoshin | Centered layout: |First Name: | Kyrill | |Last Names: | Alyoshin | -Matt --- Kyrill Alyoshin <[EMAIL PROTECTED]> wrote: > Matt, > > The text in second column has to be centered. > > However it look really ugly when you try to display > lots of text it it. Say a > user wants to enter this > > if(x==0) { > dothis(); > for(int i=0; i<5; ++i) { > //do something > } > } > else { > > } > > > How do you think this formatting will look like when > you center-justify it? :-) > > Try it. > > The only way to achieve such effect is to left > justify it, and let white spaces > take care of the indentation. > > But the text has to be centered in a cell. But how > do we left-justify it, and at > the same time center it? My idea was to create > another table, add a row and a > cell, left justify the text there, and then center > the table in that cell. > That's what I do in HTML and it sure works. > > Kyrill > > > > > > Date: Wed, 23 Oct 2002 08:11:03 -0700 (PDT) > > From: Matt Benson <[EMAIL PROTECTED]> > > Subject: Re: [iText-questions] Tabulation Effect, > Centering Data > > To: Kyrill Alyoshin <[EMAIL PROTECTED]>, > [EMAIL PROTECTED] > > > > I am not sure I understand the difference between > the > > default behavior of Table and what you want to > > achieve. From your diagrams I would have expected > you > > to want to left-justify rather than center your > text; > > if you still want that distance between the edge > of > > the cell and the text within, I would think that > could > > be achieved by setPadding(). > > > > -Matt > > > > --- Kyrill Alyoshin <[EMAIL PROTECTED]> > wrote: > > > Hey guys, > > > > > > Here is an issue that I am having with > iText/PDF. It > > > is rather serious, and I am > > > actually wondering if it can be resolved at all. > > > > > > 1. Tabulation > > > > > > The main point here is that Tabs are actually > not > > > (as users are used to > > > experience it) a certain number of white spaces. > > > See, if you use almost any text > > > editor, including filling out a form in a > browser, > > > and use tabs, here is how the > > > text will be aligned. > > > > > > aaaaaa aaaaaaa > > > aaa aaaaaa > > > aaaaa aaaaaaaaaa > > > aaaa aaaaa > > > > > > > > > The white spaces above are tabs. They are > definitely > > > not the same width, the > > > application formats those tabs in a such a way > that > > > it allows for this > > > column-like appearance. > > > > > > So my users are used to this. They do it in the > web > > > worms (in TextArea HTML > > > tags), and they want to see the same formatting > when > > > their text is displayed in > > > PDF. > > > > > > So, what is the easiest way to achieve such > > > formatting? > > > > > > > > > > > > 2. ALIGNMENT > > > > > > Let's say I have an HTML table that looks like > this: > > > > > > |First Name: | Kyrill | > > > |Last Names: | Alyoshin | > > > |About Him: | XXXXXXXX | > > > > > > > > > As you can see the data in the second column is > > > centered. I can sure reproduce > > > such look-n-feel in PDF using iText. > > > But the problem is the third row. We don't know > what > > > the user is going to write > > > there. It could be: > > > > > > |First Name: | Kyrill | > > > |Last Names: | Alyoshin | > > > |About Him: | Programmer | > > > > > > > > > OR > > > > > > |First Name: | Kyrill | > > > |Last Names: | Alyoshin | > > > |About Him: | A silly guy | > > > | | who is | > > > | | asking silly questions| > > > > > > > > > > > > The first one looks great when it is centered. > The > > > second option looks really > > > ugly. I could left-align it, but then the first > > > option will be left aligned too. > > > Not pretty either. > > > > > > So my idea was to put that third row/second > column > > > cell in a table of its own, > > > left align the text in it, and then center that > > > helper-table in a cell. I > > > couldn't figure out how to do it in iText. I > tried a > > > lot of things, and was > > > getting exceptions all the time. > > > > > > So, what do I need to do to achieve what I want? > > > > > > I'd greatly appreciate anybody's help. THANKS! > > > > > > Kyrill Alyoshin > > > > > > > > > > > > > > > > > > > > > > > > > > > ------------------------------------------------------- > > > This sf.net email is sponsored by: Influence the > > > future > > > of Java(TM) technology. Join the Java Community > > > Process(SM) (JCP(SM)) program now. > > > > > > http://ads.sourceforge.net/cgi-bin/redirect.pl?sunm0002en > > > > > > _______________________________________________ > > > iText-questions mailing list > > > [EMAIL PROTECTED] > > > > > > https://lists.sourceforge.net/lists/listinfo/itext-questions > > > > > > __________________________________________________ > > Do you Yahoo!? > > Y! Web Hosting - Let the expert host your web site > > http://webhosting.yahoo.com/ > __________________________________________________ Do you Yahoo!? Y! Web Hosting - Let the expert host your web site http://webhosting.yahoo.com/ ------------------------------------------------------- This sf.net email is sponsored by: Influence the future of Java(TM) technology. Join the Java Community Process(SM) (JCP(SM)) program now. http://ads.sourceforge.net/cgi-bin/redirect.pl?sunm0002en _______________________________________________ iText-questions mailing list [EMAIL PROTECTED] https://lists.sourceforge.net/lists/listinfo/itext-questions