Hello,

How can I influence the word - splitting in a cell?

I created a PdfPTable with a lockedWidth. I added 2 PdfPCells containing a Paragrah with a chunk:


Paragraph paragraph = new Paragraph();
                if (label != null) {
                        label = label.trim();
                        Chunk labelChunk = new Chunk(label, DESCRIPTIONFONT);
                        labelChunk.setSplitCharacter(new WordSplitter());
                        paragraph.add(labelChunk);

                }
                PdfPCell descriptionCell = new PdfPCell(paragraph);

Now I want that the label chunk should only spit after full words. So I implemented the SplitCharecter - Interface like this:

public class WordSplitter implements SplitCharacter {
public boolean isSplitCharacter(int start, int current, int end, char[] cc,
                        PdfChunk[] ck) {
                char c;
                if (ck == null)
                        c = cc[current];
                else
                        c = ck[Math.min(current, ck.length - 1)]
                                        .getUnicodeEquivalent(cc[current]);

                if (c == ' ')
                        return true;

                return false;
        }

}

However, altough I have implemented and set this interface, sometimes the words are splitted in the middle.

Can somebody tell me how to implment this interface correctly or how to tell the PdfPCell that it should only after full words?

Regards

Peter




-------------------------------------------------------
This SF.net email is sponsored by: Splunk Inc. Do you grep through log files
for problems?  Stop!  Download the new AJAX search engine that makes
searching your log files as easy as surfing the  web.  DOWNLOAD SPLUNK!
http://sel.as-us.falkag.net/sel?cmd=lnk&kid=103432&bid=230486&dat=121642
_______________________________________________
iText-questions mailing list
[email protected]
https://lists.sourceforge.net/lists/listinfo/itext-questions

Reply via email to