Hi

I'm trying to change the horizontal alignment of a table cell containing
just an Image, but the call to Cell.setHorizontalAlignment(int) has no
effect. It works fine when I add some text to the cell thought.

Here is the code:

import java.io.FileOutputStream;
import java.io.IOException;

import com.lowagie.text.Cell;
import com.lowagie.text.Document;
import com.lowagie.text.DocumentException;
import com.lowagie.text.Image;
import com.lowagie.text.PageSize;
import com.lowagie.text.Table;
import com.lowagie.text.rtf.RtfWriter2;

public class RtfTable {

    public static void main(String[] args) {

        Document document = new Document(PageSize.A4);

        try {
            RtfWriter2 rtf = RtfWriter2.getInstance(document, new
FileOutputStream("Table.rtf"));
               
            Table table = new Table(2);
            
            table.addCell("Cell 1\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n");

            Image image =       Image.getInstance("9016.png");
            
            Cell cell2 = new Cell();
            
            cell2.setHorizontalAlignment(Cell.ALIGN_CENTER);
            cell2.setVerticalAlignment(Cell.ALIGN_MIDDLE);            
            cell2.add(image);
              
            table.addCell(cell2);

            document.open();
            
            document.add(table);
            
        } catch (DocumentException de) {
            System.err.println(de.getMessage());
        } catch (IOException ioe) {
            System.err.println(ioe.getMessage());
        }
        document.close();
    }
}


I would really appreciatte it if you could tell me what am I doing wrong.

Thanks.
-- 
View this message in context: 
http://www.nabble.com/Cell-Horizontal-Alignment-tf2225350.html#a6166603
Sent from the iText - General forum at Nabble.com.


-------------------------------------------------------------------------
Using Tomcat but need to do more? Need to support web services, security?
Get stuff done quickly with pre-integrated technology to make your job easier
Download IBM WebSphere Application Server v.1.0.1 based on Apache Geronimo
http://sel.as-us.falkag.net/sel?cmd=lnk&kid=120709&bid=263057&dat=121642
_______________________________________________
iText-questions mailing list
[email protected]
https://lists.sourceforge.net/lists/listinfo/itext-questions

Reply via email to