c# - Dynamic number of rows in itextsharp -
I would like to use it to generate a PDF using my extrappap so that I can record the number of records According to the dynamic number of rows, for example, if I have 3 records in my stored procedure, then I would like to generate it like an Exchange P like this:
(column 1) (column 2) ( Column 3)
line 1 roti 1 $ 93215321
Punk 2 milk 1.5 $ 12345678
line 3 sausage 5 $ 54678 912
PDF for the next, if the stored function has 5 records, it will display 3 columns and 5 rows. .
Is it possible to use the exchanges?
Yes, this is possible. I have written a complete book about it.
You probably want to use the PdfPTable
class. This class is explained in the example, for example, for example, where I am using Loop on a number of film titles and screenings on these films. In the result tables, there is a PDF in which there are several rows, because there are records consistent with a given day:
I think that you are using iTextSharp, so you can see it. / P>
Creating a PdfPTable
is very easy. You can simply make an example of class and then add the PdfPCell
example. This is an example, which also features rowspan and callspans:
// a table with three columns PDFPTables table = new PDFPTable (3); // cell object PDFPCL cell; // we add a cell with colspan 3 cell = new PdfPCell (the new phrase ("cell with callspan 3"); Cell.Colpan = 3; table.AddCell (cell); // Now we will highlight the light cell 2 = new Add a cell with PDFPCL (the new phrase ("cell with illumination 2"); cell; light = 2; table.AddCell (cell); // we add four remaining cells with the addCell () table AdCell ("line1; cell1") table; edel ("line1; cell2"); table.edsel ("line2; cell1"); table.edsel ("line2; cell2") ;
Your mum In the field, there is enough to create a PdfPTable
with 3 columns in the small code snippet, and after that, set a result of your stored procedure to create a loop on all records. Place the contents in PdfPCell
and add that cell to PdfPTable
. After the loop is over, enter PdfPTable
as a document
Add in the example.
Warning: Some people asked for your question You can do a "homework" question. Your question does not show what you have tried. Generally people expect that before you post a question, you try some hard work. Do not shoot the messenger I give you only one head so that you will not be surprised that your question is downvote or closed.
Comments
Post a Comment