« Return to Thread: In 3 col x 7 row table cannot add less than 21 records

Re: In 3 col x 7 row table cannot add less than 21 records

by Paulo Soares-3 :: Rate this Message:

Reply to Author | View in Thread

Where's the table creation?

Paulo

> -----Original Message-----
> From: bogorman [mailto:brian_og@...]
> Sent: Monday, June 08, 2009 6:30 PM
> To: itextsharp-questions@...
> Subject: [itextsharp-questions] In 3 col x 7 row table cannot
> add less than 21 records
>
>
> I am using itextsharp to create a pdf containing a table with
> the above
> format and then read text from a mySQL database into its
> cells. Everything
> works ok unless:
> a) there are less than 21 records in the recordset. I then
> get the error
> "the document has no pages"
> b) if there are more than 21 records in the recordset and
> total number of
> records in the recordset is not  a multiple of 21, the pdf is
> created but
> the last page is missing (i.e. the one which should contain
> less than 21
> records).
>
> The part of the coding which reads in the data is:
>
>
>
>     try {
>       // Open and execute the command
>       conn.Open();
>      
>    
>  
>       using (MySqlDataReader reader = comm.ExecuteReader())
>       {
>           while (reader.Read())
>           {
>               string text = string.Format(
>                 "{0}\r\n{1}\r\n{2}\r\n{3}\r\n{4}\r\n{5}\r\n{6}",
>                 reader["fldContact"],
>                 reader["Name"],
>                 reader["ad1"],
>                 reader["ad2"],
>                 reader["ad3"],
>                 reader["ad4"],
>                 reader["ad5"]);
>  
>               Phrase myPhrase = new Phrase(text, times);
>              
>               table.AddCell(myPhrase);
>              
>           }
>       }    
>  
>  
>  
>       doc.Add(table);
>
>   }
>   finally
>   {
>       // Close should always be called now
>       // If the PDF has no contents, an exception will not be caught,
>       // but at least the file will be closed (and unlocked)
>       try
>       {
>           doc.Close();
>       }
>       finally
>       {
>           // Also make sure the underlying stream is closed
>           // You could delete the file here if it's empty
>           docStream.Close();
>          
>       }
>
>       conn.Dispose();
>       comm.Dispose();
>   }
>  
>
> fldContact, Name, ad1, ad2, ad3, ad4 and ad5 are fields in
> the recordset. I
> have run the debugger in VS2005 and checked that the data is
> correct. It is.
>
> Would very much appreciate anyones help on this.

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.



------------------------------------------------------------------------------
Crystal Reports - New Free Runtime and 30 Day Trial
Check out the new simplified licensing option that enables unlimited
royalty-free distribution of the report engine for externally facing
server and web deployment.
http://p.sf.net/sfu/businessobjects
_______________________________________________
itextsharp-questions mailing list
itextsharp-questions@...
https://lists.sourceforge.net/lists/listinfo/itextsharp-questions

 « Return to Thread: In 3 col x 7 row table cannot add less than 21 records