Hi Bruno and Paulo,

 

First of all thanks for your library! It's great!

But I faced with a problem of using it. If it possible please help me.

 

I'm using .NET port of iText for creating PDF files. I have a table with
header cells in my PDF document. In some circumstances  the header become
too big and can't be fitted into page size. As result the table is not
rendered and "Infinite table loop" message is appeared in the document. I
would like to avoid such behavior and in case when header is too big do not
render it on every page (that is set HeaderRows property to 0).

But I don't know how to do it. Is it possible to detect somehow if header
will not be fitted into page? The PdfPTable  class has HeaderHeight property
which I suppose should return the height of header but it returns some value
which cant' be compared with page size (it's always too big). I couldn't
understand what does represent this value.

 

So, please, how can I manage this issue and what HeaderHeight property value
is represent?

 

I attached a file with demo code.

 

Thank you,

Eugene

 

 

 

 

 

using System;
using iTextSharp.text.pdf;
using iTextSharp.text;
using System.IO;   

namespace ConsoleApplication9
{
    class Program
    {
        static void Main(string[] args)
        {
            Document document = new Document(PageSize.A4.Rotate(), 10, 10, 10, 
10);
            PdfWriter.GetInstance(document, new 
FileStream(@"c:\AddBigTable.pdf", FileMode.Create));
            document.Open();

            document.Add(new Phrase("bla-lba"));                        

            PdfPTable datatable = new PdfPTable(1);            
            datatable.HeaderRows = 3;

            string big = 
"header\nheader\nheader\nheader\nheader\nheader\nheader\nheader\nheader\nheader\nheader\nheader\nheader\nheader\nheader\nheader\nheader\nheader\nheader\n";
            datatable.DefaultCell.GrayFill = 0.9f;
            datatable.AddCell(big);
            datatable.AddCell(big);
            datatable.AddCell(big);

            datatable.DefaultCell.GrayFill = 0f;
            for (int i = 0; i < 30; i++)
                datatable.AddCell("Body #\nBody \n#Body \n#Body \n#Clock #");   
             

            document.Add(datatable);
            document.Add(new Phrase("bla-lba"));     
            document.Close();
        }
    }
}
------------------------------------------------------------------------------
Let Crystal Reports handle the reporting - Free Crystal Reports 2008 30-Day 
trial. Simplify your report design, integration and deployment - and focus on 
what you do best, core application coding. Discover what's new with 
Crystal Reports now.  http://p.sf.net/sfu/bobj-july
_______________________________________________
iText-questions mailing list
[email protected]
https://lists.sourceforge.net/lists/listinfo/itext-questions

Buy the iText book: http://www.1t3xt.com/docs/book.php
Check the site with examples before you ask questions: 
http://www.1t3xt.info/examples/
You can also search the keywords list: http://1t3xt.info/tutorials/keywords/

Reply via email to