« Return to Thread: RtfShape line width

Re: Cell Height

by Paulo Soares :: Rate this Message:

Reply to Author | View in Thread

You need to call PdfPTable.setTotalWidth().

Paulo

----- Original Message -----
From: <glen.hamel@...>
To: "Post all your questions about iText here"
<itext-questions@...>
Sent: Tuesday, May 13, 2008 8:00 PM
Subject: Re: [iText-questions] Cell Height


> Hi Paulo,
>
> I tried that and in my Java Debug Console I get an answer of 0.0 for the
> height.   Here is the complete code I am using along with the addition of
> what you gave me:
>
>        float widths[] = {4.0f, 2.0f};
>        houtTable = new PdfPTable(widths);
>        houtTable.setWidthPercentage(100);
>                inTable01 = new PdfPTable(1);
>                inTable01.setWidthPercentage(100);
>                img = Image.getInstance("C:\\RBGApp\\RBGlogo.jpg");
>                cell = new PdfPCell(img);
>                cell.setBorder(Rectangle.NO_BORDER);
>                cell.setHorizontalAlignment(Element.ALIGN_LEFT);
>                inTable01.addCell(cell);
>                outLine = companyAdd + ", " + companyCity + ", " +
> companyProv + ", " + companyPostal;
>                outPara = new Paragraph(outLine,
> FontFactory.getFont(FontFactory.HELVETICA, 8));
>                cell = new PdfPCell(new Paragraph(outPara));
>                cell.setBorder(Rectangle.NO_BORDER);
>                cell.setHorizontalAlignment(Element.ALIGN_LEFT);
>                inTable01.addCell(cell);
>                outLine = "Telephone: " + companyPhone + " / Fax: " +
> companyFax  + " / " + companyWeb;
>                outPara = new Paragraph(outLine,
> FontFactory.getFont(FontFactory.HELVETICA, 8));
>                cell = new PdfPCell(new Paragraph(outPara));
>                cell.setBorder(Rectangle.NO_BORDER);
>                cell.setHorizontalAlignment(Element.ALIGN_LEFT);
>                inTable01.addCell(cell);
>        cell = new PdfPCell(inTable01);
>        cell.setBorder(Rectangle.BOX);
>        cell.setHorizontalAlignment(Element.ALIGN_LEFT);
>        houtTable.addCell(cell);
> //      -----------------
>                inTable02 = new PdfPTable(1);
>                inTable02.setWidthPercentage(100);
>                outLine = " ";
>                outPara = new Paragraph(outLine,
> FontFactory.getFont(FontFactory.HELVETICA, 8));
>                cell = new PdfPCell(new Paragraph(outPara));
>                cell.setBorder(Rectangle.NO_BORDER);
>                cell.setHorizontalAlignment(Element.ALIGN_LEFT);
>                inTable02.addCell(cell);
>                outLine = " ";
>                outPara = new Paragraph(outLine,
> FontFactory.getFont(FontFactory.HELVETICA, 8));
>                cell = new PdfPCell(new Paragraph(outPara));
>                cell.setBorder(Rectangle.NO_BORDER);
>                cell.setHorizontalAlignment(Element.ALIGN_LEFT);
>                inTable02.addCell(cell);
>                outLine = " ";
>                outPara = new Paragraph(outLine,
> FontFactory.getFont(FontFactory.HELVETICA, 8));
>                cell = new PdfPCell(new Paragraph(outPara));
>                cell.setBorder(Rectangle.NO_BORDER);
>                cell.setHorizontalAlignment(Element.ALIGN_LEFT);
>                inTable02.addCell(cell);
>                outLine = "Quotation";
>                outPara = new Paragraph(outLine,
> FontFactory.getFont(FontFactory.HELVETICA, 18, Font.BOLD));
>                cell = new PdfPCell(new Paragraph(outPara));
>                cell.setBorder(Rectangle.NO_BORDER);
>                cell.setHorizontalAlignment(Element.ALIGN_LEFT);
>                inTable02.addCell(cell);
>                outLine = " ";
>                outPara = new Paragraph(outLine,
> FontFactory.getFont(FontFactory.HELVETICA, 8));
>                cell = new PdfPCell(new Paragraph(outPara));
>                cell.setBorder(Rectangle.NO_BORDER);
>                cell.setHorizontalAlignment(Element.ALIGN_LEFT);
>                inTable02.addCell(cell);
> //      -----------------
>                        inTable03 = new PdfPTable(2);
>                        inTable03.setWidthPercentage(100);
>                        outLine = "Date: ";
>                        outPara = new Paragraph(outLine,
> FontFactory.getFont(FontFactory.HELVETICA, 10));
>                        cell = new PdfPCell(new Paragraph(outPara));
>                        cell.setBorder(Rectangle.NO_BORDER);
>                        cell.setHorizontalAlignment(Element.ALIGN_LEFT);
>                        inTable03.addCell(cell);
>                        outLine = quoteDate;
>                        outPara = new Paragraph(outLine,
> FontFactory.getFont(FontFactory.HELVETICA, 10));
>                        cell = new PdfPCell(new Paragraph(outPara));
>                        cell.setBorder(Rectangle.NO_BORDER);
>                        cell.setHorizontalAlignment(Element.ALIGN_LEFT);
>                        inTable03.addCell(cell);
>                        outLine = "Estimate #: ";
>                        outPara = new Paragraph(outLine,
> FontFactory.getFont(FontFactory.HELVETICA, 10));
>                        cell = new PdfPCell(new Paragraph(outPara));
>                        cell.setBorder(Rectangle.NO_BORDER);
>                        cell.setHorizontalAlignment(Element.ALIGN_LEFT);
>                        inTable03.addCell(cell);
>                        outLine = quoteNum;
>                        outPara = new Paragraph(outLine,
> FontFactory.getFont(FontFactory.HELVETICA, 10));
>                        cell = new PdfPCell(new Paragraph(outPara));
>                        cell.setBorder(Rectangle.NO_BORDER);
>                        cell.setHorizontalAlignment(Element.ALIGN_LEFT);
>                        inTable03.addCell(cell);
>                        outLine = "Terms: ";
>                        outPara = new Paragraph(outLine,
> FontFactory.getFont(FontFactory.HELVETICA, 10));
>                        cell = new PdfPCell(new Paragraph(outPara));
>                        cell.setBorder(Rectangle.NO_BORDER);
>                        cell.setHorizontalAlignment(Element.ALIGN_LEFT);
>                        inTable03.addCell(cell);
>                        outLine = quoteTerms;
>                        outPara = new Paragraph(outLine,
> FontFactory.getFont(FontFactory.HELVETICA, 10));
>                        cell = new PdfPCell(new Paragraph(outPara));
>                        cell.setBorder(Rectangle.NO_BORDER);
>                        cell.setHorizontalAlignment(Element.ALIGN_LEFT);
>                        inTable03.addCell(cell);
>                        outLine = "Validity: ";
>                        outPara = new Paragraph(outLine,
> FontFactory.getFont(FontFactory.HELVETICA, 10));
>                        cell = new PdfPCell(new Paragraph(outPara));
>                        cell.setBorder(Rectangle.NO_BORDER);
>                        cell.setHorizontalAlignment(Element.ALIGN_LEFT);
>                        inTable03.addCell(cell);
>                        outLine = quoteValidity;
>                        outPara = new Paragraph(outLine,
> FontFactory.getFont(FontFactory.HELVETICA, 10));
>                        cell = new PdfPCell(new Paragraph(outPara));
>                        cell.setBorder(Rectangle.NO_BORDER);
>                        cell.setHorizontalAlignment(Element.ALIGN_LEFT);
>                        inTable03.addCell(cell);
>                cell = new PdfPCell(inTable03);
>                cell.setBorder(Rectangle.NO_BORDER);
>                cell.setHorizontalAlignment(Element.ALIGN_LEFT);
>                inTable02.addCell(cell);
>        cell = new PdfPCell(inTable02);
>        cell.setBorder(Rectangle.BOX);
>        cell.setHorizontalAlignment(Element.ALIGN_LEFT);
>        houtTable.addCell(cell);
>        print("Height = " + houtTable.getRowHeight(0)); <====== This here
> reports 0.0 in the console.
>
> Glen Hamel
> Lead Programmer / Technician
> Auric Networks Canada, Inc.
> 570 Orwell Street, Unit 1
> Mississauga, Ontario
> L5A 3V7
>
> Phone 905.361.7621
> Fax 905.274.3912
> http://www.auricnet.ca
>
>
>
> From:
> "Paulo Soares" <psoares@...>
> To:
> "Post all your questions about iText here"
> <itext-questions@...>
> Date:
> 05/13/2008 02:48 PM
> Subject:
> Re: [iText-questions] Cell Height
>
>
>
> PdfPTable.getRowHeight(). You must set the total width first.
>
> Paulo
>
> ----- Original Message -----
> From: <glen.hamel@...>
> To: "Post all your questions about iText here"
> <itext-questions@...>
> Sent: Tuesday, May 13, 2008 7:17 PM
> Subject: [iText-questions] Cell Height
>
>
>> Hi all,
>>
>> I need be able to find the height of a cell that was just created with
> the
>> data having been placed into the cell.
>> The thing is, I do not know how much data is going into the cell as the
>> data is pulled from a database.
>> It could be a few words long or 500 words long.
>> I have gone through the iText Docs that I downloaded with all the
> classes
>> and tried to figure out how I can do it, but I find nothing of value, or
> I
>> am missing it altogether.
>> My book has not yet arrived and am expecting it maybe next week, if I am
>> lucky.  Chapters tends to be slow to my area for some reason..
>> Has anyone tried doing this??
>>
>> Example code I am using:
>>        outLine = quoteValidity;
>>        outPara = new Paragraph(outLine,
>> FontFactory.getFont(FontFactory.HELVETICA, 10));
>>        cell = new PdfPCell(new Paragraph(outPara));
>>        cell.setBorder(Rectangle.NO_BORDER);
>>        cell.setHorizontalAlignment(Element.ALIGN_LEFT);
>>        inTable03.addCell(cell);
>>
>> Thanks in advance.
>>
>> Glen Hamel
>> Lead Programmer / Technician
>> Auric Networks Canada, Inc.
>> 570 Orwell Street, Unit 1
>> Mississauga, Ontario
>> L5A 3V7
>>
>> Phone 905.361.7621
>> Fax 905.274.3912
>> http://www.auricnet.ca


-------------------------------------------------------------------------
This SF.net email is sponsored by: Microsoft
Defy all challenges. Microsoft(R) Visual Studio 2008.
http://clk.atdmt.com/MRT/go/vse0120000070mrt/direct/01/
_______________________________________________
iText-questions mailing list
iText-questions@...
https://lists.sourceforge.net/lists/listinfo/itext-questions

Do you like iText?
Buy the iText book: http://www.1t3xt.com/docs/book.php
Or leave a tip: https://tipit.to/itexttipjar

 « Return to Thread: RtfShape line width

LightInTheBox - Buy quality products at wholesale price