Click here to Skip to main content
15,886,017 members
Home / Discussions / C#
   

C#

 
GeneralRe: conditional compilation Pin
joost.versteegen14-Mar-16 5:48
joost.versteegen14-Mar-16 5:48 
GeneralRe: conditional compilation Pin
Eddy Vluggen14-Mar-16 6:50
professionalEddy Vluggen14-Mar-16 6:50 
AnswerRe: conditional compilation Pin
Sascha Lefèvre14-Mar-16 6:18
professionalSascha Lefèvre14-Mar-16 6:18 
QuestionRe: conditional compilation Pin
John Torjo14-Mar-16 13:12
professionalJohn Torjo14-Mar-16 13:12 
AnswerRe: conditional compilation Pin
joost.versteegen14-Mar-16 21:32
joost.versteegen14-Mar-16 21:32 
GeneralRe: conditional compilation Pin
John Torjo14-Mar-16 21:41
professionalJohn Torjo14-Mar-16 21:41 
GeneralRe: conditional compilation Pin
joost.versteegen14-Mar-16 23:03
joost.versteegen14-Mar-16 23:03 
QuestioniTextSharp Split large table with Headers on each pages Pin
Zefir114-Mar-16 1:09
Zefir114-Mar-16 1:09 
Hi all
I would like to ask How to Split large table on each pages.
I would also like start my table In certain point of my pages.
I using Visual Studio 2013 and Windows Forms application.

This is my program:

C#
private void Testowe_Z_Netu_Click(object sender, EventArgs e)
        {


            MemoryStream memt4 = new MemoryStream();

            Document doc4 = new Document(iTextSharp.text.PageSize.A4, 80, 80, 42, 35);
            doc4.SetPageSize(iTextSharp.text.PageSize.A4.Rotate());
            PdfWriter wrik4 = PdfWriter.GetInstance(doc4, memt4); //Utworzenie pliku pdf w pamięci
            var ft4 = FontFactory.GetFont("Times New Roman", 9, BaseColor.RED);
            var gt4 = FontFactory.GetFont("Times New Roman", 12, BaseColor.BLACK);
            var NaFirt4 = FontFactory.GetFont("Calibri", 12, BaseColor.DARK_GRAY);
            var NaFirBot4 = FontFactory.GetFont("Calibri", 12, BaseColor.DARK_GRAY);
            doc4.Open();

            PdfContentByte cbt4 = wrik4.DirectContent;


            PdfPTable tabled4 = new PdfPTable(1) { WidthPercentage = 100, RunDirection = PdfWriter.RUN_DIRECTION_LTR, ExtendLastRow = false };
            tabled4.TotalWidth = 600f;
            tabled4.DefaultCell.UseAscender = true;
            tabled4.DefaultCell.UseDescender = true;

            PdfContentByte ct4 = wrik4.DirectContent;
            tabled4.HeaderRows = 1;
            PdfPCell ceko = new PdfPCell(new Phrase("Naglówek"));
            ceko.VerticalAlignment = Element.ALIGN_CENTER;
            ceko.HorizontalAlignment = Element.ALIGN_CENTER;
            ceko.BorderWidth = 2;
            ceko.BorderColor = new BaseColor(Color.Red);
            tabled4.AddCell(ceko);
            tabled4.SplitLate = false;
            tabled4.SplitRows = true;
            for (int j = 0; j < 300; j++)
            {
                PdfPCell cek4 = new PdfPCell(new Phrase(String.Format("{0}", j)));

                tabled4.AddCell(cek4);
            }
            int pageRows4 = 0;
            while (pageRows4 < tabled4.Rows.Count + 20)
            {
                
                tabled4.HeaderRows = 1;
                tabled4.HorizontalAlignment = Element.ALIGN_TOP;
                tabled4.WriteSelectedRows(pageRows4, pageRows4 + 21, 200, 500, ct4);
                pageRows4 = pageRows4 + 21;
                // cbt3.EndText();
                doc4.NewPage();
            }    
            doc4.Close();
            wrik4.Close();

            PdfReader readt4 = new PdfReader(memt4.ToArray());
            PdfStamper stampt4 = new PdfStamper(readt4, new FileStream(Konfi.Rpath + "Test_4 " + Konfi.RfileName + ".pdf", FileMode.Create, FileAccess.Write, FileShare.None));
            stampt4.FormFlattening = true;
            stampt4.Close();



        }


Best Regards Zefir
QuestionNewbee Facebook SDK questions Pin
ForNow13-Mar-16 6:30
ForNow13-Mar-16 6:30 
AnswerRe: Newbee Facebook SDK questions Pin
Richard MacCutchan13-Mar-16 7:12
mveRichard MacCutchan13-Mar-16 7:12 
GeneralRe: Newbee Facebook SDK questions Pin
ForNow13-Mar-16 7:27
ForNow13-Mar-16 7:27 
GeneralRe: Newbee Facebook SDK questions Pin
Richard MacCutchan13-Mar-16 23:11
mveRichard MacCutchan13-Mar-16 23:11 
QuestionC# Pin
Member 1238806113-Mar-16 4:20
Member 1238806113-Mar-16 4:20 
AnswerRe: C# Pin
Richard Andrew x6413-Mar-16 4:25
professionalRichard Andrew x6413-Mar-16 4:25 
AnswerRe: C# Pin
OriginalGriff13-Mar-16 4:56
mveOriginalGriff13-Mar-16 4:56 
AnswerRe: C# Pin
Dave Kreskowiak13-Mar-16 5:23
mveDave Kreskowiak13-Mar-16 5:23 
AnswerRe: C# Pin
Pete O'Hanlon13-Mar-16 5:45
mvePete O'Hanlon13-Mar-16 5:45 
QuestionValidation Pin
chandra tiwari12-Mar-16 17:29
chandra tiwari12-Mar-16 17:29 
AnswerRe: Validation Pin
Dave Kreskowiak12-Mar-16 17:57
mveDave Kreskowiak12-Mar-16 17:57 
AnswerRe: Validation Pin
Pete O'Hanlon12-Mar-16 22:05
mvePete O'Hanlon12-Mar-16 22:05 
QuestionProblem about MDI child form in C# Pin
guest8011-Mar-16 23:54
guest8011-Mar-16 23:54 
QuestionRe: Problem about MDI child form in C# Pin
Richard MacCutchan12-Mar-16 0:03
mveRichard MacCutchan12-Mar-16 0:03 
AnswerRe: Problem about MDI child form in C# Pin
guest8012-Mar-16 0:23
guest8012-Mar-16 0:23 
AnswerRe: Problem about MDI child form in C# Pin
Sascha Lefèvre12-Mar-16 0:06
professionalSascha Lefèvre12-Mar-16 0:06 
GeneralRe: Problem about MDI child form in C# Pin
guest8012-Mar-16 0:23
guest8012-Mar-16 0:23 

General General    News News    Suggestion Suggestion    Question Question    Bug Bug    Answer Answer    Joke Joke    Praise Praise    Rant Rant    Admin Admin   

Use Ctrl+Left/Right to switch messages, Ctrl+Up/Down to switch threads, Ctrl+Shift+Left/Right to switch pages.