Ignore my sample algorithm with the colspan calculation.

2009/11/9 Iliadis Yannis <[email protected]>

> Sorry but I had in mind that you want to show them in one row.
>
> PdfPTable automatically adds a new row if all the cells in one row are
> full, but since you define that the table must have 6 columns and the second
> row only contains 4, no row is created. Each row must be of same size.
>
> Thus either you change your table to 5 columns per row (new PdfPTable(5))
> if you know from the beginning the amount of cells (10) or keep it like it
> is (dynamic amount of cells) and try to calculate the amount of empty cells
> so you can use setColSpan(x) where x the amount of the remaining cells.
>
> Something like this:
>
> for every item
>    create cell
>    add value
>    if cell Number equals the table witdh then
>        calculate the difference (e.g. 6-4=2)
>        add cell with col span from the calculation
>    end if
>    add cell into table
> next
>
> 2009/11/9 Iliadis Yannis <[email protected]>
>
> Could it have something to do with the fact that you only define a table of
>> 6 columns instead of 10?
>>
>> 2009/11/9 Codex <[email protected]>
>>
>>
>>> Why are there no more than 6 cells added to the table!
>>> What should I change to display the other generated cells?
>>>
>>>
>>>
>>> Dim doc As New Document(iTextSharp.text.PageSize.A4, 15, 15, 15, 15)
>>>        Dim name As String = "test.pdf"
>>>
>>>        Try
>>>
>>>            Dim Writer As PdfWriter = PdfWriter.GetInstance(doc, New
>>> FileStream(Server.MapPath("~/Pdf/") + name, FileMode.Create))
>>>            doc.Open()
>>>
>>>
>>>            Dim ci As CartItem =
>>> DirectCast(Profile.ShoppingCart._CartItems(ID), CartItem)
>>>
>>>            Dim table As PdfPTable = New PdfPTable(6)
>>>            table.WidthPercentage = 100
>>>
>>>
>>>            For Each ci In Profile.ShoppingCart.CartItems
>>>
>>>                Dim nr = ci.Filenumber.ToString()
>>>                Dim jpg As Image = GetInstance(Server.MapPath("~/Images/"
>>> &
>>> nr & ".jpg"))
>>>                jpg.ScalePercent(10)
>>>
>>>                Dim cell As PdfPCell = New PdfPCell()
>>>                cell.Border = NO_BORDER
>>>                cell.HorizontalAlignment = Element.ALIGN_LEFT
>>>                cell.VerticalAlignment = Element.ALIGN_BOTTOM
>>>                cell.AddElement(jpg)
>>>                table.AddCell(cell)
>>>
>>>            Next
>>>
>>>            doc.Add(table)
>>>
>>>        Catch de As DocumentException
>>>            Console.Error.WriteLine(de.Message)
>>>        Catch ioe As IOException
>>>            Console.Error.WriteLine(ioe.Message)
>>>        Finally
>>>            doc.Close()
>>>        End Try
>>>
>>>
>>>    End Sub
>>> --
>>> View this message in context:
>>> http://old.nabble.com/When-adding-10-cells-only-6-are-displayed-in-PdfPTable-tp26264672p26264672.html
>>> Sent from the iText - General mailing list archive at Nabble.com.
>>>
>>>
>>>
>>> ------------------------------------------------------------------------------
>>> 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/
>>>
>>
>>
>
------------------------------------------------------------------------------
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