That's a side effect of the font propagation that changes the Chunk. 

pschema.add(new Chunk(schemaLabel));

will solve the problem.

Paulo 

> -----Original Message-----
> From: [EMAIL PROTECTED] 
> [mailto:[EMAIL PROTECTED] On 
> Behalf Of Antonio Gurisatti
> Sent: Friday, May 19, 2006 5:01 PM
> To: itext-questions@lists.sourceforge.net
> Subject: Re: [iText-questions] New paragraph is appending 
> data from previous one.
> 
> Paulo Soares wrote:
> 
> >Post code that can be run standalone.
> >
> >Paulo 
> >
> >  
> >
> >>-----Original Message-----
> >>From: [EMAIL PROTECTED] 
> >>[mailto:[EMAIL PROTECTED] On 
> >>Behalf Of Antonio Gurisatti
> >>Sent: Friday, May 19, 2006 5:25 AM
> >>To: iText
> >>Subject: [iText-questions] New paragraph is appending data 
> >>from previous one.
> >>
> >>I'm brand new using iText and I'm trying to build some 
> reports in an 
> >>Eclipse RCP application.
> >>
> >>The report is very simple. It reads  some records from a 
> database and 
> >>prints them.
> >>
> >>This is the source:
> >>
> >>package com.maguri.derbypad.reports;
> >>
> >>import java.io.FileNotFoundException;
> >>import java.io.FileOutputStream;
> >>import java.sql.ResultSet;
> >>import java.sql.SQLException;
> >>
> >>import com.lowagie.text.Chunk;
> >>import com.lowagie.text.Document;
> >>import com.lowagie.text.DocumentException;
> >>import com.lowagie.text.Font;
> >>import com.lowagie.text.PageSize;
> >>import com.lowagie.text.Paragraph;
> >>import com.lowagie.text.pdf.PdfWriter;
> >>import com.maguri.derbypad.db.sql.NavigatorSql;
> >>import com.maguri.utilities.DateUtilities;
> >>
> >>/**
> >> * @author agurisatti
> >> *
> >> */
> >>public class ObjectInventoryReport {
> >>
> >>    Font tit1 = new Font(Font.HELVETICA, 12, Font.BOLD);
> >>
> >>    Font tit2 = new Font(Font.HELVETICA, 9, Font.BOLD);
> >>
> >>    Font tit3 = new Font(Font.HELVETICA, 7, Font.NORMAL);
> >>
> >>    Font paragraph1 = new Font(Font.HELVETICA, 8, Font.NORMAL);
> >>
> >>    protected Document document;
> >>
> >>    protected Paragraph title1;
> >>
> >>    protected Paragraph title2;
> >>
> >>    protected Paragraph title3;
> >>
> >>    protected Paragraph emptyline = new Paragraph(" ");
> >>
> >>    protected Paragraph pschema;
> >>
> >>    protected Chunk schemaLabel = new Chunk(" Schema: ", tit2);
> >>
> >>    protected Chunk schemaName;
> >>
> >>    /**
> >>     *
> >>     */
> >>    public ObjectInventoryReport() {
> >>        initialize();
> >>    }
> >>
> >>    private void initialize() {
> >>        document = new Document();
> >>        try {
> >>            PdfWriter.getInstance(document, new FileOutputStream(
> >>                    "D:/Temporal/HelloWorld.pdf"));
> >>        } catch (FileNotFoundException e) {
> >>            e.printStackTrace();
> >>        } catch (DocumentException e) {
> >>            e.printStackTrace();
> >>        }
> >>        document.setPageSize(PageSize.LETTER);
> >>        document.addTitle("Object Inventory");
> >>        document.addSubject("The inventory of database objects");
> >>        document.addAuthor("maguriWorks");
> >>        document.addCreator("DerbyPad 1.0");
> >>
> >>        // Left, right, top, bottom in points (72 x inch)
> >>        document.setMargins(72, 40, 72, 36);
> >>        configureTitles();
> >>    }
> >>
> >>    private void configureTitles() {
> >>        title1 = new Paragraph("DerbyPad 1.0", tit3);
> >>        title2 = new Paragraph(
> >>                "Generated on " + 
> >>DateUtilities.getCurrentDate(), tit3);
> >>        title3 = new Paragraph("Object Inventory", tit1);
> >>    }
> >>
> >>    public void generateDocument() {
> >>        document.open();
> >>        printTitles();
> >>        ResultSet rs = NavigatorSql.getSchemas("%");
> >>        try {
> >>            while (rs.next()) {
> >>                printSchemaTitle(rs.getString(1));
> >>            }
> >>        } catch (SQLException e) {
> >>            e.printStackTrace();
> >>        } finally {
> >>            if (rs != null) {
> >>                try {
> >>                    rs.close();
> >>                } catch (SQLException e) {
> >>                    e.printStackTrace();
> >>                }
> >>            }
> >>        }
> >>        document.close();
> >>    }
> >>
> >>    private void printTitles() {
> >>        try {
> >>            document.add(title1);
> >>            document.add(title2);
> >>            document.add(title3);
> >>        } catch (DocumentException e) {
> >>            e.printStackTrace();
> >>        }
> >>    }
> >>
> >>    private void printSchemaTitle(String schName) {
> >>        pschema = new Paragraph();
> >>        Chunk ch = new Chunk(schName, tit2);
> >>*        pschema.add(schemaLabel);
> >>        pschema.add(ch);*
> >>        try {
> >>            document.add(emptyline);
> >>            document.add(pschema);
> >>        } catch (DocumentException e) {
> >>            e.printStackTrace();
> >>        }
> >>    }
> >>}
> >>
> >>The result is quite odd:
> >>
> >>DerbyPad 1.0
> >>Generated on 2006-5-18 22:34:40
> >>Object Inventory
> >>Schema: APP
> >>Schema: APPDERBYPAD
> >>Schema: APPDERBYPADESQUEMA1
> >>Schema: APPDERBYPADESQUEMA1ESQUEMA2
> >>Schema: APPDERBYPADESQUEMA1ESQUEMA2ESQUEMA3
> >>Schema: APPDERBYPADESQUEMA1ESQUEMA2ESQUEMA3LOADER_TESTS
> >>Schema: APPDERBYPADESQUEMA1ESQUEMA2ESQUEMA3LOADER_TESTSMGCOMUN
> >>
> >>As you can see eache new schema name is appended to the 
> previous one.
> >>
> >>The odd thing is that if a change the order of the two 
> >>statements in bold,
> >>
> >>instead of
> >>*        pschema.add(schemaLabel);
> >>        pschema.add(ch);*
> >>use
> >>*        pschema.add(ch);*
> >>*        pschema.add(schemaLabel);
> >>
> >>*then the result is:
> >>
> >>DerbyPad 1.0
> >>Generated on 2006-5-18 23:20:4
> >>Object Inventory
> >>APP Schema:
> >>DERBYPAD Schema:
> >>ESQUEMA1 Schema:
> >>ESQUEMA2 Schema:
> >>ESQUEMA3 Schema:
> >>LOADER_TESTS Schema:
> >>MGCOMUN Schema:
> >>MGCONTABIL Schema:
> >>
> >>I've spent quite a time trying to find the problem but 
> unfortunatelly 
> >>couldn't.
> >>
> >>So the question is WHAT AM I DOING WRONG?
> >>
> >>Thanks a lot for any help
> >>
> >>
> >>
> >>
> >>
> >>-------------------------------------------------------
> >>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
> >>iText-questions@lists.sourceforge.net
> >>https://lists.sourceforge.net/lists/listinfo/itext-questions
> >>
> >>    
> >>
> >
> >
> >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.
> >
> >
> >
> >
> >-------------------------------------------------------
> >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=k&kid0709&bid&3057&dat1642
> >_______________________________________________
> >iText-questions mailing list
> >iText-questions@lists.sourceforge.net
> >https://lists.sourceforge.net/lists/listinfo/itext-questions
> >
> >  
> >
> I'm attaching a tiny app showing the problem.
> 
> Thanks again
> 
> 


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.

Rȧ�:&q�[���y�hv����^y�h��i��py����z�r���!���n}�h�ꮉ�%����ފ{^���y�^r薈2����쨺��m欉�ã
     塧HŞm*az����bq�b�t�����]5m�v����!xg��x��m���zV���ږF�����\�

Reply via email to