• 设为首页
  • 点击收藏
  • 手机版
    手机扫一扫访问
    迪恩网络手机版
  • 关注官方公众号
    微信扫一扫关注
    迪恩网络公众号

C# pdf.PdfPTable类代码示例

原作者: [db:作者] 来自: [db:来源] 收藏 邀请

本文整理汇总了C#中iTextSharp.text.pdf.PdfPTable的典型用法代码示例。如果您正苦于以下问题:C# PdfPTable类的具体用法?C# PdfPTable怎么用?C# PdfPTable使用的例子?那么恭喜您, 这里精选的类代码示例或许可以为您提供帮助。



PdfPTable类属于iTextSharp.text.pdf命名空间,在下文中一共展示了PdfPTable类的20个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于我们的系统推荐出更棒的C#代码示例。

示例1: GenerateRow

        private static void GenerateRow(PdfPTable table, PlayerInfo player, Font font, BaseColor backgroundColor)
        {
            var jpg = Image.GetInstance(player.PictureUrl);
            table.AddCell(jpg);

            PdfPCell cell;

            cell = new PdfPCell(new Phrase(player.JerseyNumber, font)) {BackgroundColor = backgroundColor};
            table.AddCell(cell);

            cell = new PdfPCell(new Phrase(player.Name, font)) {BackgroundColor = backgroundColor};
            table.AddCell(cell);

            if (table.NumberOfColumns == NumberColsWithPosition)
            {
                cell = new PdfPCell(new Phrase(player.Position, font)) {BackgroundColor = backgroundColor};
                table.AddCell(cell);
            }

            cell = new PdfPCell(new Phrase(player.Height, font)) {BackgroundColor = backgroundColor};
            table.AddCell(cell);

            cell = new PdfPCell(new Phrase(player.Weight, font)) {BackgroundColor = backgroundColor};
            table.AddCell(cell);

            cell = new PdfPCell(new Phrase(player.DateOfBirth, font)) {BackgroundColor = backgroundColor};
            table.AddCell(cell);

            cell = new PdfPCell(new Phrase(player.Age, font)) {BackgroundColor = backgroundColor};
            table.AddCell(cell);

            cell = new PdfPCell(new Phrase(player.BirthPlace, font)) {BackgroundColor = backgroundColor};
            table.AddCell(cell);
        }
开发者ID:ColinStranc,项目名称:MockDraftAnalysis,代码行数:34,代码来源:PdfGenerator.cs


示例2: ManipulatePdf

// ---------------------------------------------------------------------------    
    /**
     * Manipulates a PDF file src with the file dest as result
     * @param src the original PDF
     */
    public byte[] ManipulatePdf(byte[] src) {
    // Create a table with named actions
      Font symbol = new Font(Font.FontFamily.SYMBOL, 20);
      PdfPTable table = new PdfPTable(4);
      table.DefaultCell.Border = Rectangle.NO_BORDER;
      table.DefaultCell.HorizontalAlignment = Element.ALIGN_CENTER;
      Chunk first = new Chunk( ((char)220).ToString() , symbol);
      first.SetAction(new PdfAction(PdfAction.FIRSTPAGE));
      table.AddCell(new Phrase(first));
      Chunk previous = new Chunk( ((char)172).ToString(), symbol);
      previous.SetAction(new PdfAction(PdfAction.PREVPAGE));
      table.AddCell(new Phrase(previous));
      Chunk next = new Chunk( ((char)174).ToString(), symbol);
      next.SetAction(new PdfAction(PdfAction.NEXTPAGE));
      table.AddCell(new Phrase(next));
      Chunk last = new Chunk( ((char)222).ToString(), symbol);
      last.SetAction(new PdfAction(PdfAction.LASTPAGE));
      table.AddCell(new Phrase(last));
      table.TotalWidth = 120;
      
      // Create a reader
      PdfReader reader = new PdfReader(src);
      using (MemoryStream ms = new MemoryStream()) {
        // Create a stamper
        using (PdfStamper stamper = new PdfStamper(reader, ms)) {
          // Add the table to each page
          PdfContentByte canvas;
          for (int i = 0; i < reader.NumberOfPages; ) {
            canvas = stamper.GetOverContent(++i);
            table.WriteSelectedRows(0, -1, 696, 36, canvas);
          }
        }
        return ms.ToArray();
      }    
    }    
开发者ID:,项目名称:,代码行数:40,代码来源:


示例3: Write

// ---------------------------------------------------------------------------
    public void Write(Stream stream) {
      // step 1
      using (Document document = new Document(PageSize.A5.Rotate())) {
        // step 2
        PdfWriter writer = PdfWriter.GetInstance(document, stream);
        writer.PdfVersion = PdfWriter.VERSION_1_5;
        writer.ViewerPreferences = PdfWriter.PageModeFullScreen;
        writer.PageEvent = new TransitionDuration();        
        // step 3
        document.Open();
        // step 4
        IEnumerable<Movie> movies = PojoFactory.GetMovies();
        Image img;
        PdfPCell cell;
        PdfPTable table = new PdfPTable(6);
        string RESOURCE = Utility.ResourcePosters;
        foreach (Movie movie in movies) {
          img = Image.GetInstance(Path.Combine(RESOURCE, movie.Imdb + ".jpg"));
          cell = new PdfPCell(img, true);
          cell.Border = PdfPCell.NO_BORDER;
          table.AddCell(cell);
        }
        document.Add(table);
      }
    }
开发者ID:,项目名称:,代码行数:26,代码来源:


示例4: GeneratePDFReport

        // to generate the report call the GeneratePDFReport static method.
        // The pdf file will be generated in the SupermarketChain.ConsoleClient folder
        // TODO measures are missing
        // TODO code refactoring to limitr repeated chunks
        public static void GeneratePDFReport()
        {
            Document doc = new Document(iTextSharp.text.PageSize.A4, 10, 10, 40, 35);
            string filePath = @"..\..\..\..\Reports\salesReports.pdf";
            PdfWriter writer = PdfWriter.GetInstance(doc, new FileStream(filePath, FileMode.Create));
            doc.Open();
            PdfPTable table = new PdfPTable(5);

            Font verdana = FontFactory.GetFont("Verdana", 16, Font.BOLD);
            Font verdana2 = FontFactory.GetFont("Verdana", 12, Font.BOLD);

            PdfPCell header = new PdfPCell(new Phrase("Aggregated Sales Report", verdana));
            header.Colspan = 5;
            header.HorizontalAlignment = 1;
            table.AddCell(header);

            double totalSales = PourReportData(table);

            PdfPCell totalSum = new PdfPCell(new Phrase("Grand total:"));
            totalSum.Colspan = 4;
            totalSum.HorizontalAlignment = 2;
            totalSum.BackgroundColor = new BaseColor(161, 212, 224);
            table.AddCell(totalSum);

            PdfPCell totalSumNumber = new PdfPCell(new Phrase(String.Format("{0:0.00}", totalSales), verdana));
            totalSumNumber.BackgroundColor = new BaseColor(161, 212, 224);
            table.AddCell(totalSumNumber);

            doc.Add(table);
            doc.Close();

            DirectoryInfo directoryInfo = new DirectoryInfo(filePath);
            Console.WriteLine("Pdf report generated.");
            Console.WriteLine("File:  {0}", directoryInfo.FullName);
        }
开发者ID:TeamMingFern,项目名称:DatabaseApplicationsTeamwork,代码行数:39,代码来源:PDFGenerator.cs


示例5: VerticalPositionTest0

        public void VerticalPositionTest0() {
            String file = "vertical_position.pdf";

            Document document = new Document();
            PdfWriter writer = PdfWriter.GetInstance(document, File.Create(OUTPUT_FOLDER + file));
            document.Open();

            writer.PageEvent = new CustomPageEvent();

            PdfPTable table = new PdfPTable(2);
            for (int i = 0; i < 100; i++) {
                table.AddCell("Hello " + i);
                table.AddCell("World " + i);
            }

            document.Add(table);

            document.NewPage();

            StringBuilder sb = new StringBuilder();
            for (int i = 0; i < 1000; i++) {
                sb.Append("some more text ");
            }
            document.Add(new Paragraph(sb.ToString()));

            document.Close();

            // compare
            CompareTool compareTool = new CompareTool();
            String errorMessage = compareTool.CompareByContent(OUTPUT_FOLDER + file, TEST_RESOURCES_PATH + file,
                OUTPUT_FOLDER, "diff");
            if (errorMessage != null) {
                Assert.Fail(errorMessage);
            }
        }
开发者ID:newlysoft,项目名称:itextsharp,代码行数:35,代码来源:VerticalPositionTest.cs


示例6: Write

 // ---------------------------------------------------------------------------
 public void Write(Stream stream)
 {
     // Use old example to create PDF
     MovieTemplates mt = new MovieTemplates();
     byte[] pdf = Utility.PdfBytes(mt);
     using (ZipFile zip = new ZipFile())
     {
         using (MemoryStream ms = new MemoryStream())
         {
             // step 1
             using (Document document = new Document())
             {
                 // step 2
                 PdfWriter writer = PdfWriter.GetInstance(document, ms);
                 // step 3
                 document.Open();
                 // step 4
                 PdfPTable table = new PdfPTable(2);
                 PdfReader reader = new PdfReader(pdf);
                 int n = reader.NumberOfPages;
                 PdfImportedPage page;
                 for (int i = 1; i <= n; i++)
                 {
                     page = writer.GetImportedPage(reader, i);
                     table.AddCell(Image.GetInstance(page));
                 }
                 document.Add(table);
             }
             zip.AddEntry(RESULT, ms.ToArray());
         }
         zip.AddEntry(Utility.ResultFileName(mt.ToString() + ".pdf"), pdf);
         zip.Save(stream);
     }
 }
开发者ID:kuujinbo,项目名称:iTextInAction2Ed,代码行数:35,代码来源:ImportingPages1.cs


示例7: GetTable

// ---------------------------------------------------------------------------
    /**
     * Creates a table with film festival screenings.
     * @param day a film festival day
     * @return a table with screenings.
     */
    public PdfPTable GetTable(string day) {
      PdfPTable table = new PdfPTable(new float[] { 2, 1, 2, 5, 1 });
      table.WidthPercentage = 100f;
      table.DefaultCell.Padding = 3;
      table.DefaultCell.UseAscender = true;
      table.DefaultCell.UseDescender = true;
      table.DefaultCell.Colspan = 5;
      table.DefaultCell.BackgroundColor = BaseColor.RED;
      table.DefaultCell.HorizontalAlignment = Element.ALIGN_CENTER;
      table.AddCell(day);
      table.DefaultCell.HorizontalAlignment = Element.ALIGN_LEFT;
      table.DefaultCell.Colspan = 1;
      table.DefaultCell.BackgroundColor = BaseColor.ORANGE;
      for (int i = 0; i < 2; i++) {
        table.AddCell("Location");
        table.AddCell("Time");
        table.AddCell("Run Length");
        table.AddCell("Title");
        table.AddCell("Year");
      }
      table.DefaultCell.BackgroundColor = null;
      table.HeaderRows = 3;
      table.FooterRows = 1;
      List<Screening> screenings = PojoFactory.GetScreenings(day);
      Movie movie;
      foreach (Screening screening in screenings) {
        movie = screening.movie;
        table.AddCell(screening.Location);
        table.AddCell(screening.Time.Substring(0, 5));
        table.AddCell(movie.Duration.ToString() + " '");
        table.AddCell(movie.MovieTitle);
        table.AddCell(movie.Year.ToString());
      }
      return table;
    }
开发者ID:,项目名称:,代码行数:41,代码来源:


示例8: AddRow

 private void AddRow(PdfPTable table, ExpenseTableRow dataRow)
 {
     table.AddCell(new Paragraph(dataRow.Cost, FontFactory.GetFont(BaseFont.COURIER, BaseFont.CP1257, 10)));
     table.AddCell(new Paragraph(dataRow.Date, FontFactory.GetFont(BaseFont.COURIER, BaseFont.CP1257, 10)));
     table.AddCell(new Paragraph(dataRow.Paid, FontFactory.GetFont(BaseFont.COURIER, BaseFont.CP1257, 10)));
     table.AddCell(new Paragraph(dataRow.ResposiblePerson, FontFactory.GetFont(BaseFont.COURIER, BaseFont.CP1257, 10)));
 }
开发者ID:Quantzo,项目名称:baudi,代码行数:7,代码来源:ExpenseReport.cs


示例9: TestKeepTogether

 public void TestKeepTogether(bool tagged, bool keepTogether) {
     Document document = new Document();
     String file = "tagged_" + tagged + "-keeptogether_" + keepTogether + ".pdf";
     PdfWriter writer = PdfWriter.GetInstance(document, File.Create(outFolder + file));
     if (tagged)
         writer.SetTagged();
     document.Open();
     int columns = 3;
     int tables = 3;
     for (int tableCount = 0; tableCount < tables; tableCount++) {
         PdfPTable table = new PdfPTable(columns);
         for (int rowCount = 0; rowCount < 50; rowCount++) {
             PdfPCell cell1 = new PdfPCell(new Paragraph("t" + tableCount + " r:" + rowCount));
             PdfPCell cell2 = new PdfPCell(new Paragraph("t" + tableCount + " r:" + rowCount));
             PdfPCell cell3 = new PdfPCell(new Paragraph("t" + tableCount + " r:" + rowCount));
             table.AddCell(cell1);
             table.AddCell(cell2);
             table.AddCell(cell3);
         }
         table.SpacingAfter = 10f;
         table.KeepTogether = keepTogether;
         document.Add(table);
     }
     document.Close();
 }
开发者ID:Niladri24dutta,项目名称:itextsharp,代码行数:25,代码来源:KeepTogetherTest.cs


示例10: CreatePdf

 public void CreatePdf(String dest)
 {
     Document document = new Document();
     PdfWriter.GetInstance(document, new FileStream(dest, FileMode.Create));
     document.Open();
     PdfPTable table = new PdfPTable(5);
     table.SetWidths(new int[] {1, 2, 2, 2, 1});
     PdfPCell cell;
     cell = new PdfPCell(new Phrase("S/N"));
     cell.Rowspan = 2;
     table.AddCell(cell);
     cell = new PdfPCell(new Phrase("Name"));
     cell.Colspan = 3;
     table.AddCell(cell);
     cell = new PdfPCell(new Phrase("Age"));
     cell.Rowspan = 2;
     table.AddCell(cell);
     table.AddCell("SURNAME");
     table.AddCell("FIRST NAME");
     table.AddCell("MIDDLE NAME");
     table.AddCell("1");
     table.AddCell("James");
     table.AddCell("Fish");
     table.AddCell("Stone");
     table.AddCell("17");
     document.Add(table);
     document.Close();
 }
开发者ID:Niladri24dutta,项目名称:itextsharp,代码行数:28,代码来源:SimpleRowColspan.cs


示例11: GenerateReportTable

        private static PdfPTable GenerateReportTable(DayReport report)
        {
            PdfPTable table = new PdfPTable(5);
            
            string[] headerTitles = {"Product", "Quantity", "Unit Price", "Location", "Sum"};
            foreach (var title in headerTitles)
            {
                Phrase phrase = new Phrase(title);
                phrase.Font = FontFactory.GetFont("Arial", 14, Font.BOLD);
                PdfPCell cell = new PdfPCell(phrase);
                cell.BackgroundColor = new BaseColor(175, 166, 166);
                table.AddCell(cell);
                cell.Padding = 0;
            }

            foreach (var sale in report.Sales)
            {
                table.AddCell(sale.ProductName);
                table.AddCell(sale.MeasureFormatted);
                table.AddCell(sale.UnitPrice.ToString());
                table.AddCell(sale.Supermarket);
                table.AddCell(sale.Sum.ToString());
            }

            PdfPCell footerCell = new PdfPCell(new Phrase("Total sum for " + report.FormattedDate + ": "));
            footerCell.Colspan = 4;
            footerCell.HorizontalAlignment = 2;
            table.AddCell(footerCell);
            table.AddCell(new Phrase(report.TotalSum.ToString()));
            return table;
        }
开发者ID:NikolayKostadinov,项目名称:TelerikAkademy,代码行数:31,代码来源:PdfReportGenerator.cs


示例12: GeneratePdfReport

        public static void GeneratePdfReport(string filepath)
        {
            FileStream fileStream = new FileStream(filepath, FileMode.Create);
            Document document = new Document();
            PdfWriter writer = PdfWriter.GetInstance(document, fileStream);
            document.SetPageSize(PageSize.A3);
            document.Open();

            var paragraph = new Paragraph("Aggregated Sales Report",
                FontFactory.GetFont("Arial", 19, Font.BOLD));
            paragraph.SpacingAfter = 20.0f;
            paragraph.Alignment = 1;

            document.Add(paragraph);

            PdfPTable mainTable = new PdfPTable(1);
            var reports = GetDayReports();
            foreach (var dayReport in reports)
            {
                var headerCell = new PdfPCell(new Phrase("Date: " + dayReport.FormattedDate));
                headerCell.BackgroundColor = new BaseColor(175, 166, 166);
                mainTable.AddCell(headerCell);
                var table = GenerateReportTable(dayReport);
                mainTable.AddCell(table);
            }

            document.Add(mainTable);
            document.Close();
        }
开发者ID:NikolayKostadinov,项目名称:TelerikAkademy,代码行数:29,代码来源:PdfReportGenerator.cs


示例13: CreateHardwareReport

 public static void CreateHardwareReport(string fileName, IEnumerable<HardwareCountReport> hardwares)
 {
     try
     {
         Document document = new Document(PageSize.A4, 72, 72, 72, 72);
         PdfWriter.GetInstance(document, new FileStream(fileName, FileMode.Create, FileAccess.Write, FileShare.None));
         document.Open();
         document.Add(new Paragraph(Element.ALIGN_CENTER, "Hardware Report", new Font(iTextSharp.text.Font.FontFamily.HELVETICA, 16, Font.BOLD)));
         document.Add(new Chunk(Chunk.NEWLINE));
         var table = new PdfPTable(3);
         table.SetTotalWidth(new float[] { 25f, 50f, 25f });
         table.WidthPercentage = 100;
         table.AddCell(new Phrase("Category"));
         table.AddCell(new Phrase("Hardware Model/Type"));
         table.AddCell(new Phrase("Total"));
         foreach (var hw in hardwares)
         {
             table.AddCell(new Phrase(hw.Category));
             table.AddCell(new Phrase(hw.Model));
             table.AddCell(new Phrase(hw.Count));
         }
         document.Add(table);
         document.Close();
     }
     catch (Exception x)
     {
         Log.Error("Error when creating report.", x);
     }
 }
开发者ID:rabbicse,项目名称:WPF-SBMS,代码行数:29,代码来源:ReportGenerator.cs


示例14: Button2_Click

    protected void Button2_Click(object sender, EventArgs e)
    {
        int columnsCount = GridView1.HeaderRow.Cells.Count;
        // Create the PDF Table specifying the number of columns
        PdfPTable pdfTable = new PdfPTable(columnsCount);

        // Loop thru each cell in GrdiView header row
        foreach(TableCell gridViewHeaderCell in GridView1.HeaderRow.Cells)
        {
        // Create the Font Object for PDF document
        Font font = new Font();
        // Set the font color to GridView header row font color
        font.Color = new BaseColor(GridView1.HeaderStyle.ForeColor);

        // Create the PDF cell, specifying the text and font
        PdfPCell pdfCell = new PdfPCell(new Phrase(gridViewHeaderCell.Text, font));

        // Set the PDF cell backgroundcolor to GridView header row BackgroundColor color
        pdfCell.BackgroundColor = new BaseColor(GridView1.HeaderStyle.BackColor);

        // Add the cell to PDF table
        pdfTable.AddCell(pdfCell);
        }

        // Loop thru each datarow in GrdiView
        foreach (GridViewRow gridViewRow in GridView1.Rows)
        {
        if (gridViewRow.RowType == DataControlRowType.DataRow)
        {
            // Loop thru each cell in GrdiView data row
            foreach (TableCell gridViewCell in gridViewRow.Cells)
            {
                Font font = new Font();
                font.Color = new BaseColor(GridView1.RowStyle.ForeColor);

                PdfPCell pdfCell = new PdfPCell(new Phrase(gridViewCell.Text, font));

                pdfCell.BackgroundColor = new BaseColor(GridView1.RowStyle.BackColor);

                pdfTable.AddCell(pdfCell);
            }
        }
        }

        // Create the PDF document specifying page size and margins
        Document pdfDocument = new Document(PageSize.A4, 10f, 10f, 10f, 10f);

        PdfWriter.GetInstance(pdfDocument, Response.OutputStream);

        pdfDocument.Open();
        pdfDocument.Add(pdfTable);
        pdfDocument.Close();

        Response.ContentType = "application/pdf";
        Response.AppendHeader("content-disposition",
        "attachment;filename=Employees.pdf");
        Response.Write(pdfDocument);
        Response.Flush();
        Response.End();
    }
开发者ID:wandilediba,项目名称:Asset-App,代码行数:60,代码来源:Default.aspx.cs


示例15: writePdf

        public override void writePdf(bool bBlackAndWhite=false)
        {
            initFile();
            PdfPTable table = new PdfPTable(m_iCount + 1);
            int cellHeight = ((int)m_doc.PageSize.Height - 200) / m_iCount;
            iTextSharp.text.Image image = iTextSharp.text.Image.GetInstance("");
            image.ScaleAbsolute(cellHeight / 2, cellHeight / 2);
            for (int j = 0; j < m_iCount; j++)
            {
                int cnt = s_random.Next(1, m_iMax);

                for (int i = 0; i < m_iMax; i++)
                {
                    if (i < cnt)
                    {
                        table.AddCell(image);
                    }
                    else
                    {
                        table.AddCell(new Phrase(" "));
                    }

                }

                table.AddCell(rectangle);

            }
            m_doc.Add(table);

            printSiteName();
            m_doc.Close();
        }
开发者ID:mangalambigai,项目名称:WorksheetGen,代码行数:32,代码来源:CountingWorksheet.cs


示例16: GeneratePdfElement

        public override iTextSharp.text.IElement GeneratePdfElement()
        {
            TableStyle style = (Manifest != null) ? Manifest.Styles.GetMergedFromConfiguration(Style) : Style;

            int columnCount = (Rows.Any()) ? Rows.First().Cells.Count : 0;
            iTextPdf.PdfPTable table = new iTextPdf.PdfPTable(columnCount)
            {
                HorizontalAlignment = (int) (style.HorizontalAlignment ?? TableStyle.Default.HorizontalAlignment.Value),
                SpacingBefore = style.SpacingBefore ?? TableStyle.Default.SpacingBefore.Value,
                SpacingAfter = style.SpacingAfter ?? TableStyle.Default.SpacingAfter.Value,
                LockedWidth = style.LockedWidth ?? TableStyle.Default.LockedWidth.Value,
            };

            Rows.SelectMany(r => r.Cells).ForEach(c => table.AddCell((iTextPdf.PdfPCell) c.GeneratePdfElement()));

            if (style.Widths != null && style.Widths.Any())
            {
                table.SetTotalWidth(style.Widths);
            }
            if (style.WidthPercentage.HasValue)
            {
                table.WidthPercentage = style.WidthPercentage.Value;
            }

            return table;
        }
开发者ID:onesimoh,项目名称:Andamio,代码行数:26,代码来源:Table.cs


示例17: AddDetails

        private static void AddDetails(ref PdfPTable table, ref Claim claim)
        {
            table.AddCell(CreateDetailTitleCell("Customer Complaint"));
            table.AddCell(CreateDetailCell(claim.CustomerComplaint.ToUpper()));
            table.AddCell(CreateSpacerCell());
            table.AddCell(CreateDetailTitleCell("Cause of Failure"));
            table.AddCell(CreateDetailCell(claim.CauseOfFailure.ToUpper()));
            table.AddCell(CreateSpacerCell());
            table.AddCell(CreateDetailTitleCell("Corrective Action"));
            table.AddCell(CreateDetailCell(claim.CorrectiveAction.ToUpper()));
            table.AddCell(CreateSpacerCell());

            if(claim.MiscAmountExplanation.Trim().Length > 0 && !claim.MiscAmountExplanation.Trim().ToUpper().Equals("NONE"))
            {
                table.AddCell(CreateDetailTitleCell("Misc Amount Explanation"));
                table.AddCell(CreateDetailCell(claim.MiscAmountExplanation.ToUpper()));
                table.AddCell(CreateSpacerCell());
            }

            if(claim.ReimbursementComment.Trim().Length > 0 && !claim.ReimbursementComment.Trim().ToUpper().Equals("NONE"))
            {
                table.AddCell(CreateDetailTitleCell("Reimbursement Comment"));
                table.AddCell(CreateDetailCell(claim.ReimbursementComment.ToUpper()));
                table.AddCell(CreateSpacerCell());
            }
        }
开发者ID:dsokol,项目名称:dsokol.com,代码行数:26,代码来源:ClaimPrinter.cs


示例18: OnEndPage

        public override void OnEndPage(PdfWriter writer, Document document)
        {
            PdfPTable footer = new PdfPTable(3);
            footer.SetWidths(new float[] { 88f, 7f, 5f });
            footer.WidthPercentage = 100;
            footer.TotalWidth = document.PageSize.Width - (document.LeftMargin + document.RightMargin);

            PdfPCell emptycell = new PdfPCell();
            emptycell.Border = 0;
            footer.AddCell(emptycell);

            Chunk text = new Chunk(string.Format(GlobalStringResource.PageOfFooter,
                document.PageNumber), FontFactory.GetFont(FontFactory.HELVETICA, 8));

            PdfPCell footerCell = new PdfPCell(new Phrase(text));
            footerCell.Border = 0;
            footerCell.HorizontalAlignment = Element.ALIGN_RIGHT;
            footer.AddCell(footerCell);

            PdfPCell cell = new PdfPCell(iTextSharp.text.Image.GetInstance(total));
            cell.Border = 0;
            cell.HorizontalAlignment = Element.ALIGN_LEFT;
            footer.AddCell(cell);
            footer.WriteSelectedRows(0, -1, 50, (document.BottomMargin - 10), writer.DirectContent);
        }
开发者ID:meanprogrammer,项目名称:sawebreports_migrated,代码行数:25,代码来源:Strategy2020ReportBuilder.cs


示例19: AddAirlineReportsTableColumns

 private void AddAirlineReportsTableColumns(PdfPTable table)
 {
     table.AddCell(AirlineNameColumnHeader);
     table.AddCell(TotalFlightsColumnHeader);
     table.AddCell(AverageFlightDurationColumnHeader);
     table.AddCell(TotalFlightDurationColumnHeader);
 }
开发者ID:RadoChervenkov,项目名称:Airports,代码行数:7,代码来源:PdfExporter.cs


示例20: GenerarDocumento

 public void GenerarDocumento(Document document)
 {
     int i, j;
     PdfPTable datatable = new PdfPTable(dataGridView1.ColumnCount);
     datatable.DefaultCell.Padding = 3;
     float[] headerwidths = GetTamañoColumnas(dataGridView1);
     datatable.SetWidths(headerwidths);
     datatable.WidthPercentage = 100;
     datatable.DefaultCell.BorderWidth = 2;
     datatable.DefaultCell.HorizontalAlignment = Element.ALIGN_CENTER;
     for (i = 0; i < dataGridView1.ColumnCount; i++)
     {
         datatable.AddCell(dataGridView1.Columns[i].HeaderText);
     }
     datatable.HeaderRows = 1;
     datatable.DefaultCell.BorderWidth = 1;
     for (i = 0; i < dataGridView1.Rows.Count; i++)
     {
         for (j = 0; j < dataGridView1.Columns.Count; j++)
         {
             if (dataGridView1[j, i].Value != null)
             {
                 datatable.AddCell(new Phrase(dataGridView1[j, i].Value.ToString()));//En esta parte, se esta agregando un renglon por cada registro en el datagrid
             }
         }
         datatable.CompleteRow();
     }
     document.Add(datatable);
 }
开发者ID:Warrior6021,项目名称:ReportesItextSharp,代码行数:29,代码来源:Form1.cs



注:本文中的iTextSharp.text.pdf.PdfPTable类示例由纯净天空整理自Github/MSDocs等源码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。


鲜花

握手

雷人

路过

鸡蛋
该文章已有0人参与评论

请发表评论

全部评论

专题导读
上一篇:
C# pdf.PdfPatternPainter类代码示例发布时间:2022-05-26
下一篇:
C# pdf.PdfPRow类代码示例发布时间:2022-05-26
热门推荐
阅读排行榜

扫描微信二维码

查看手机版网站

随时了解更新最新资讯

139-2527-9053

在线客服(服务时间 9:00~18:00)

在线QQ客服
地址:深圳市南山区西丽大学城创智工业园
电邮:jeky_zhao#qq.com
移动电话:139-2527-9053

Powered by 互联科技 X3.4© 2001-2213 极客世界.|Sitemap