当前位置: 首页>>代码示例>>C#>>正文


C# pdf.PdfPRow类代码示例

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


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

示例1: PdfPRow

 /**
 * Makes a copy of an existing row.
 *
 * @param row
 */
 public PdfPRow(PdfPRow row)
 {
     maxHeight = row.maxHeight;
     calculated = row.calculated;
     cells = new PdfPCell[row.cells.Length];
     for (int k = 0; k < cells.Length; ++k) {
         if (row.cells[k] != null)
             cells[k] = new PdfPCell(row.cells[k]);
     }
     widths = new float[cells.Length];
     System.Array.Copy(row.widths, 0, widths, 0, cells.Length);
     InitExtraHeights();
 }
开发者ID:boecko,项目名称:iTextSharp,代码行数:18,代码来源:PdfPRow.cs

示例2: PdfPRow

 public PdfPRow(PdfPCell[] cells, PdfPRow source) {
     this.cells = cells;
     widths = new float[cells.Length];
     InitExtraHeights();
     if (source != null) {
         this.id = source.ID;
         this.role = source.Role;
         if (source.accessibleAttributes != null)
             this.accessibleAttributes = new Dictionary<PdfName, PdfObject>(source.GetAccessibleAttributes());
     }
 }
开发者ID:jagruti23,项目名称:itextsharp,代码行数:11,代码来源:PdfPRow.cs

示例3: RtfRow

 /**
 * Constructs a RtfRow for a Row.
 * 
 * @param doc The RtfDocument this RtfRow belongs to
 * @param rtfTable The RtfTable this RtfRow belongs to
 * @param row The Row this RtfRow is based on
 * @param rowNumber The number of this row
 * @since 2.1.3
 */
 protected internal RtfRow(RtfDocument doc, RtfTable rtfTable, PdfPRow row, int rowNumber) : base(doc) {
     this.parentTable = rtfTable;
     this.rowNumber = rowNumber;
     ImportRow(row);
 }
开发者ID:nicecai,项目名称:iTextSharp-4.1.6,代码行数:14,代码来源:RtfRow.cs

示例4: ImportRow

 /**
 * Imports a PdfPRow and copies all settings
 * 
 * @param row The PdfPRow to import
 * @since 2.1.3
 */
 private void ImportRow(PdfPRow row) {
     this.cells = new ArrayList();
     this.width = this.document.GetDocumentHeader().GetPageSetting().GetPageWidth() - this.document.GetDocumentHeader().GetPageSetting().GetMarginLeft() - this.document.GetDocumentHeader().GetPageSetting().GetMarginRight();
     this.width = (int) (this.width * this.parentTable.GetTableWidthPercent() / 100);
     
     int cellRight = 0;
     int cellWidth = 0;
     PdfPCell[] cells = row.GetCells();
     for (int i = 0; i < cells.Length; i++) {
         cellWidth = (int) (this.width * this.parentTable.GetProportionalWidths()[i] / 100);
         cellRight = cellRight + cellWidth;
         
         PdfPCell cell = cells[i];
         RtfCell rtfCell = new RtfCell(this.document, this, cell);
         rtfCell.SetCellRight(cellRight);
         rtfCell.SetCellWidth(cellWidth);
         this.cells.Add(rtfCell);
     }
 }
开发者ID:nicecai,项目名称:iTextSharp-4.1.6,代码行数:25,代码来源:RtfRow.cs

示例5: PdfPTable

        /** Constructs a copy of a <CODE>PdfPTable</CODE>.
        * @param table the <CODE>PdfPTable</CODE> to be copied
        */

        public PdfPTable(PdfPTable table)
        {
            CopyFormat(table);
            for (int k = 0; k < currentRow.Length; ++k)
            {
                if (table.currentRow[k] == null)
                    break;
                currentRow[k] = new PdfPCell(table.currentRow[k]);
            }
            for (int k = 0; k < table.rows.Count; ++k)
            {
                PdfPRow row = table.rows[k];
                if (row != null)
                    row = new PdfPRow(row);
                rows.Add(row);
            }
        }
开发者ID:,项目名称:,代码行数:21,代码来源:

示例6: btnPDF_Click2

        protected void btnPDF_Click2(object sender, EventArgs e)
        {
            try
            {
                string CurrentDate = Convert.ToDateTime(lblDate2.Text).ToString("MM-dd-yyyy") + Convert.ToDateTime(lblDate2.Text).ToString("hhmmsstt");
                string Location = Session["LocationName"].ToString();
                string PayrollDate = "PAYROLL REPORT " + lblWeekPayrollReport.Text;
                string filepath = Server.MapPath("~/Payroll/" + Location + "/" + CurrentDate + "/");
                if (!System.IO.Directory.Exists(filepath))
                {
                    System.IO.Directory.CreateDirectory(filepath);
                }
                if (ddlLocation.SelectedItem.Text == "INDG" || ddlLocation.SelectedItem.Value == "INBH")
                {
                    var pdfDoc = new Document(PageSize.A3);
                    PdfWriter.GetInstance(pdfDoc, new FileStream(filepath + "Payroll" + CurrentDate + ".pdf", FileMode.Create));
                    Session["FilePath"] = filepath + "Payroll" + CurrentDate + ".pdf";
                    Session["filename"] = "Payroll" + CurrentDate + ".pdf";
                    pdfDoc.Open();
                    var table1 = new PdfPTable(15);
                    table1.WidthPercentage = 100;
                    table1.HorizontalAlignment = Element.ALIGN_CENTER;
                    float[] widths = new float[] { 1.2f, 3f, 1.5f, 1.5f, 2.5f, 1.5f, 1.2f, 1.5f, 2f, 1.5f, 1.5f, 1.5f, 1.5f, 1.2f, 2f };
                    table1.SetWidths(widths);
                    table1.SpacingAfter = 15;

                    iTextSharp.text.Font fntTableFont1 = new Font(Font.FontFamily.TIMES_ROMAN, 10, iTextSharp.text.Font.BOLD, BaseColor.BLACK);
                    iTextSharp.text.Font fntTableFont = new Font(Font.FontFamily.TIMES_ROMAN, 8, iTextSharp.text.Font.NORMAL, BaseColor.BLACK);
                    iTextSharp.text.Font fntTableHeading = new Font(Font.FontFamily.TIMES_ROMAN, 14, iTextSharp.text.Font.BOLD, BaseColor.MAGENTA);
                    iTextSharp.text.Font fntTableFont2 = new Font(Font.FontFamily.TIMES_ROMAN, 10, iTextSharp.text.Font.NORMAL, BaseColor.BLACK);

                    iTextSharp.text.Font georgia = FontFactory.GetFont("georgia", 16f, 1, new BaseColor(System.Drawing.Color.Red));
                    Chunk beginning = new Chunk(PayrollDate, georgia);
                    Phrase p1 = new Phrase(beginning);
                    PdfPCell CellHeading = new PdfPCell(p1);
                    CellHeading.Colspan = 15;
                    CellHeading.Border = 0;
                    CellHeading.HorizontalAlignment = Element.ALIGN_MIDDLE;
                    CellHeading.HorizontalAlignment = Element.ALIGN_CENTER;
                    table1.AddCell(CellHeading);

                    CellHeading = new PdfPCell(new Phrase(" "));
                    CellHeading.Colspan = 15;
                    CellHeading.Rowspan = 4;
                    CellHeading.Border = 0;
                    CellHeading.HorizontalAlignment = Element.ALIGN_MIDDLE;
                    CellHeading.HorizontalAlignment = Element.ALIGN_CENTER;
                    table1.AddCell(CellHeading);

                    CellHeading = new PdfPCell(new Phrase(lblTotal.Text, fntTableFont));
                    CellHeading.Colspan = 7;
                    CellHeading.Border = 0;
                    CellHeading.HorizontalAlignment = Element.ALIGN_MIDDLE;
                    CellHeading.HorizontalAlignment = Element.ALIGN_CENTER;
                    table1.AddCell(CellHeading);

                    CellHeading = new PdfPCell(new Phrase("Report generated at  " + Convert.ToDateTime(lblDate2.Text).ToString("MM/dd/yyyy hh:mm:ss tt") + " by " + Session["EmpName"].ToString().Trim(), fntTableFont));
                    CellHeading.Colspan = 8;
                    CellHeading.Border = 0;
                    CellHeading.HorizontalAlignment = Element.ALIGN_MIDDLE;
                    CellHeading.HorizontalAlignment = Element.ALIGN_CENTER;
                    table1.AddCell(CellHeading);

                    if (ddlLocation.SelectedItem.Text.ToString() == "INDG" || ddlLocation.SelectedItem.Text.ToString() == "INBH")
                    {
                        DataTable dt = GetDataTable(grdPayRollIndia);

                        PdfPCell CellZero = new PdfPCell(new Phrase("Employee Information", fntTableFont1));
                        CellZero.Colspan = 8;
                        CellZero.BorderWidthRight = 1;
                        CellZero.BackgroundColor = BaseColor.LIGHT_GRAY;
                        CellZero.HorizontalAlignment = Element.ALIGN_MIDDLE;
                        CellZero.HorizontalAlignment = Element.ALIGN_CENTER;
                        CellZero.Rowspan = 2;
                        table1.AddCell(CellZero);

                        PdfPCell CellZero2 = new PdfPCell(new Phrase("Attendance Information", fntTableFont1));
                        CellZero2.Colspan = 7;
                        CellZero2.Rowspan = 2;
                        CellZero2.Border = 0;
                        CellZero2.BackgroundColor = BaseColor.LIGHT_GRAY;
                        CellZero.HorizontalAlignment = Element.ALIGN_MIDDLE;
                        CellZero2.HorizontalAlignment = Element.ALIGN_CENTER;
                        table1.AddCell(CellZero2);

                        PdfPCell[] cel = new PdfPCell[15];
                        PdfPRow row = new PdfPRow(cel);
                        cel[0] = new PdfPCell(new Phrase("EmpID", fntTableFont1));
                        cel[1] = new PdfPCell(new Phrase("Name", fntTableFont1));
                        cel[2] = new PdfPCell(new Phrase("StartDt", fntTableFont1));
                        cel[3] = new PdfPCell(new Phrase("TermDt", fntTableFont1));
                        cel[4] = new PdfPCell(new Phrase("Department", fntTableFont1));
                        cel[5] = new PdfPCell(new Phrase("Type", fntTableFont1));
                        cel[6] = new PdfPCell(new Phrase("Location", fntTableFont1));
                        cel[7] = new PdfPCell(new Phrase("Salary", fntTableFont1));
                        cel[8] = new PdfPCell(new Phrase("Working days", fntTableFont1));
                        cel[9] = new PdfPCell(new Phrase("Attend days", fntTableFont1));
                        cel[10] = new PdfPCell(new Phrase("Used", fntTableFont1));
                        cel[11] = new PdfPCell(new Phrase("Balanced", fntTableFont1));
                        cel[12] = new PdfPCell(new Phrase("Total Salary", fntTableFont1));
//.........这里部分代码省略.........
开发者ID:hugo-mirad,项目名称:test-hr-live,代码行数:101,代码来源:PayRoll.aspx.cs

示例7: Prepare_Print

    protected void Prepare_Print()
    {
        String[] weekDays = new String[] { " ","Sun", "Mon", "Tue", "Wed", "Thu" };
        int[] sessions = new int[] {0,1,2,3,4,5,6,7,8,9};
        PdfPTable tblSchedule = new PdfPTable(10);
        PdfPRow[] tempRow = new PdfPRow[6];
        PdfPCell[][] tempCell = new PdfPCell[6][];
        int rowIndex = 0;
        int cellIndex = 0;
        Paragraph subject = new Paragraph();
        Paragraph teacher = new Paragraph();
        Paragraph lunch = new Paragraph();
        Paragraph dayPara = new Paragraph();
        Paragraph sessionPara = new Paragraph();
        Paragraph teacherPara = new Paragraph();

        Font lunch_font = new Font();
        Font day_session_para = new Font();
        Font session_font = new Font();
        Font teacher_font = new Font();

        session_font.Size = 10;
        teacher_font.SetStyle("Italics");
        teacher_font.Size = 7;

        lunch_font.SetColor(153, 153, 255);
        lunch_font.SetStyle("italics");
        lunch = new Paragraph("Lunch", lunch_font);

        day_session_para.SetColor(0, 0, 153);

        foreach (String weekDay in weekDays)
        {
            tempCell[rowIndex] = new PdfPCell[10];
            tempRow[rowIndex] = new PdfPRow(tempCell[rowIndex]);
            foreach (int session in sessions)
            {
                if (session == 0 || session == 6)
                {
                    if (session == 0)
                    {
                        dayPara = new Paragraph(weekDays[rowIndex],day_session_para);
                        tempCell[rowIndex][cellIndex] = new PdfPCell(dayPara);
                    }
                    else
                        if (weekDay != " ")
                        {
                            tempCell[rowIndex][cellIndex] = new PdfPCell(lunch);
                        }
                        else
                        {
                            //tempCell[rowIndex][cellIndex] = new PdfPCell(new Phrase(Convert.ToString(sessions[cellIndex])));
                            dayPara = new Paragraph(Convert.ToString(sessions[cellIndex]), day_session_para);
                            tempCell[rowIndex][cellIndex] = new PdfPCell(dayPara);
                        }
                }
                else
                {
                    if (weekDay == " ")
                    {
                        dayPara = new Paragraph(Convert.ToString(sessions[cellIndex]), day_session_para);
                        tempCell[rowIndex][cellIndex] = new PdfPCell(dayPara);
                        //tempCell[rowIndex][cellIndex] = new PdfPCell(new Phrase(Convert.ToString(sessions[cellIndex])));
                    }
                    else
                    {
                        string query = "select B.CourseTitle,A.TeacherID from tblStudentCourseMap as A,tblCourses as B where A.ComCod = B.ComCod and A.DaySession = '" + weekDay + session + "' and A.StudentID = '" + Current_User_ID + "'";
                        myCon.ConOpen();
                        SqlDataReader sessionDet = myCon.ExecuteReader(query);

                        if (sessionDet.Read())
                            if (!sessionDet.IsDBNull(0))
                            {
                                sessionPara = new Paragraph(sessionDet.GetString(0), session_font);
                                //tempCell[rowIndex][cellIndex] = new PdfPCell(sessionPara);
                                teacherPara = new Paragraph(sessionDet.GetString(1), teacher_font);
                                tempCell[rowIndex][cellIndex] = new PdfPCell(new Phrase(sessionPara));
                                tempCell[rowIndex][cellIndex].Phrase.Add(new Phrase("\n"));
                                tempCell[rowIndex][cellIndex].Phrase.Add(teacherPara);
                                //tempCell[rowIndex][cellIndex] = new PdfPCell(new Phrase(sessionDet.GetString(0) + "\n" + sessionDet.GetString(1)));
                            }
                            else
                            {
                                tempCell[rowIndex][cellIndex] = new PdfPCell(new Phrase(""));
                                //tempCell[rowIndex][cellIndex
                            }
                        else
                            tempCell[rowIndex][cellIndex] = new PdfPCell(new Phrase(""));
                        myCon.ConClose();
                        tempCell[rowIndex][cellIndex].FixedHeight = 75;
                    }

                }

                //tempCell[rowIndex][cellIndex].Width = 50;
                cellIndex++;
                //tempRow[rowIndex].Cells.Add(tempCell[cellIndex++, rowIndex]);
            }
            cellIndex = 0;
            //rowIndex++;
//.........这里部分代码省略.........
开发者ID:kannan4355,项目名称:TimeTableManagementSystem,代码行数:101,代码来源:StudentHome.aspx.cs

示例8: generatePdf

        public Boolean generatePdf(String fileName, List<encuesta> e, resultado r)
        {
            try
            {
                new Utils.DeleteFile().deleteFile(@HttpContext.Current.Server.MapPath("~/Utils/pdfs/"));
                var colaborador = new EmpleadoDB().listAll(r.id_empleado);
                var evaluador = new EvaluadorDB().listAll(r.id_evaluador);

                var document = new Document(PageSize.LETTER);
                var pdfwriter = PdfWriter.GetInstance(document, new FileStream(@HttpContext.Current.Server.MapPath("~/Utils/pdfs/" + fileName), FileMode.Create));
                document.Open();
                String[] heads = { "ÁREA DEL DESEMPEÑO", "MUY BAJO", "BAJO", "MEDIO", "ALTO", "MUY ALTO" };
                String[] subHeads = { "", "1", "2", "3", "4", "5" };

                // Creamos el tipo de Font que vamos utilizar
                iTextSharp.text.Font docFont = new iTextSharp.text.Font(iTextSharp.text.Font.FontFamily.HELVETICA, 8, iTextSharp.text.Font.NORMAL, BaseColor.BLACK);
                iTextSharp.text.Font docFont1 = new iTextSharp.text.Font(iTextSharp.text.Font.FontFamily.HELVETICA, 8, iTextSharp.text.Font.BOLD, BaseColor.BLACK);

                document.Add(new Paragraph("Colaborador : " + colaborador[0].nombres + " " + colaborador[0].apellidos));
                document.Add(new Paragraph("Evaluador : " + evaluador[0].nombres + " " + evaluador[0].apellidos));
                document.Add(new Paragraph("Fecha : " + DateTime.Now.ToShortDateString()));
                document.Add(Chunk.NEWLINE);

                var tblEncuesta = new PdfPTable(heads.Length);
                float[] colWidth = { 1000, 150, 150, 150, 150, 150 };
                tblEncuesta.SetWidths(colWidth);
                tblEncuesta.WidthPercentage = 100;

                PdfPCell[] rowCell = new PdfPCell[heads.Length];
                for (var i = 0; i < heads.Length; i++)
                {
                    var pdfCell = new PdfPCell(new Phrase(heads[i], docFont1)) { HorizontalAlignment = Element.ALIGN_CENTER, BorderWidth = 0.75f, FixedHeight = 15f, BackgroundColor = new BaseColor(230, 230, 230) };
                    if (i == 0)
                    {
                        pdfCell.Rowspan = 2;
                        pdfCell.VerticalAlignment = Element.ALIGN_MIDDLE;
                        pdfCell.BorderWidthBottom = 0;
                    }
                    rowCell[i] = pdfCell;
                }
                var row1 = new PdfPRow(rowCell);
                tblEncuesta.Rows.Add(row1);

                PdfPCell[] rowCell1 = new PdfPCell[subHeads.Length];
                for (var i = 0; i < subHeads.Length; i++)
                {
                    var pdfCell = new PdfPCell(new Phrase(subHeads[i], docFont)) { BorderWidth = 0.75f, HorizontalAlignment = Element.ALIGN_CENTER, FixedHeight = 15f };
                    if (i == 0) pdfCell.BorderWidthTop = 0;
                    rowCell1[i] = pdfCell;
                }

                var row2 = new PdfPRow(rowCell1);
                tblEncuesta.Rows.Add(row2);

                //body table
                for (var i = 0; i < e.Count; i++)
                {
                    PdfPCell[] rowBody = new PdfPCell[heads.Length];
                    for (int c = 0; c < heads.Length; c++)
                    {
                        PdfPCell cell;
                        if (c == 0)
                        {
                            if (e[i].id_pregunta == 0)
                            {
                                cell = new PdfPCell(new Phrase(e[i].descripcion, docFont1)) { BorderWidth = 0.75f, FixedHeight = 15f };
                                cell.Colspan = 6;
                                cell.BackgroundColor = new BaseColor(230, 230, 230);

                            }
                            else
                                cell = new PdfPCell(new Phrase(e[i].descripcion, docFont)) { BorderWidth = 0.75f, FixedHeight = 15f };
                        }
                        else
                        {
                            if (c == e[i].puntaje)
                                cell = new PdfPCell(new Phrase(e[i].puntaje.ToString(), docFont)) { BorderWidth = 0.75f, HorizontalAlignment = Element.ALIGN_CENTER, FixedHeight = 15f };
                            else
                                cell = new PdfPCell(new Phrase(" ", docFont)) { BorderWidth = 0.75f, HorizontalAlignment = Element.ALIGN_CENTER, FixedHeight = 15f };
                        }
                        rowBody[c] = cell;
                    }
                    var row3 = new PdfPRow(rowBody);
                    tblEncuesta.Rows.Add(row3);
                }
                document.Add(tblEncuesta);

                document.Close();
                pdfwriter.Close();

                return true;
            }
            catch (Exception)
            {
                throw;
            }
        }
开发者ID:davidchoquerojas,项目名称:NG_RESOURCE,代码行数:97,代码来源:PdfGenerator.cs

示例9: CreateTestInfoTable

        /// <summary>
        /// 创建测试者信息和测试信息表格
        /// </summary>
        /// <param name="tableEle"></param>
        /// <param name="columnCount"></param>
        protected void CreateTestInfoTable(XElement tableEle, int columnCount)
        {
            string remark = tableEle.Attribute("remark").Value;
            Paragraph parTableRemark = new Paragraph(remark, fontTableRemark);
            parTableRemark.IndentationLeft = 24;
            parTableRemark.SpacingBefore = 20;
            pdfDoc.Add(parTableRemark);

            PdfPTable table = new iTextSharp.text.pdf.PdfPTable(columnCount);
            List<PdfPRow> rowList = new List<iTextSharp.text.pdf.PdfPRow>();
            foreach (XElement rowEle in tableEle.Elements())
            {
                List<PdfPCell> cellList = new List<iTextSharp.text.pdf.PdfPCell>();
                foreach (XElement cellEle in rowEle.Elements())
                {
                    string label = cellEle.Attribute("label").Value;
                    string value = cellEle.Attribute("value").Value;
                    if (value.Trim().Equals(""))
                    {
                        value = "/";
                    }

                    iTextSharp.text.pdf.PdfPCell cellLabel = new iTextSharp.text.pdf.PdfPCell(new Phrase(label, fontLabel));
                    cellLabel.FixedHeight = 24;
                    cellLabel.Padding = 4;
                    cellLabel.HorizontalAlignment = PdfPCell.ALIGN_RIGHT;
                    cellLabel.VerticalAlignment = PdfPCell.ALIGN_MIDDLE;

                    PdfPCell cellContent = new iTextSharp.text.pdf.PdfPCell(new Phrase(value, fontContent));
                    cellContent.FixedHeight = 24;
                    cellContent.PaddingTop = 4;
                    cellContent.VerticalAlignment = PdfPCell.ALIGN_MIDDLE;
                    XAttribute colSpanAtt = cellEle.Attribute("colspan");
                    if (colSpanAtt != null)
                    {
                        string colspan = colSpanAtt.Value;
                        if (colspan != "")
                        {
                            cellContent.Colspan = int.Parse(colspan);
                        }
                    }
                    cellList.Add(cellLabel);
                    cellList.Add(cellContent);
                }
                PdfPRow row = new iTextSharp.text.pdf.PdfPRow(cellList.ToArray<PdfPCell>());
                rowList.Add(row);
            }
            table.Rows.AddRange(rowList);
            table.KeepTogether = true;
            table.SpacingBefore = 10;
            table.TotalWidth = 750;
            table.LockedWidth = true;
            Paragraph pTable = new Paragraph();
            pTable.Add(table);
            pdfDoc.Add(pTable);
        }
开发者ID:dewade2003,项目名称:DSJL,代码行数:61,代码来源:AbsExportPDF.cs

示例10: SplitRow

 /**
 * Splits a row to newHeight. The returned row is the remainder. It will
 * return null if the newHeight was so small that only an empty row would
 * result.
 *
 * @param newHeight
 *            the new height
 * @return the remainder row or null if the newHeight was so small that only
 *         an empty row would result
 */
 public PdfPRow SplitRow(float newHeight)
 {
     PdfPCell[] newCells = new PdfPCell[cells.Length];
     float[] fh = new float[cells.Length * 2];
     bool allEmpty = true;
     for (int k = 0; k < cells.Length; ++k) {
         PdfPCell cell = cells[k];
         if (cell == null)
             continue;
         fh[k * 2] = cell.FixedHeight;
         fh[k * 2 + 1] = cell.MinimumHeight;
         Image img = cell.Image;
         PdfPCell c2 = new PdfPCell(cell);
         if (img != null) {
             if (newHeight > cell.EffectivePaddingBottom
                     + cell.EffectivePaddingTop + 2) {
                 c2.Phrase = null;
                 allEmpty = false;
             }
         } else {
             int status;
             float y;
             ColumnText ct = ColumnText.Duplicate(cell.Column);
             if (cell.Rotation == 90 || cell.Rotation == 270) {
                 y = SetColumn(ct,
                         cell.Top - newHeight + cell.EffectivePaddingBottom,
                         cell.Left + cell.EffectivePaddingLeft,
                         cell.Top - cell.EffectivePaddingTop,
                         cell.Right - cell.EffectivePaddingRight);
             }
             else {
                 float rightLimit = cell.NoWrap ? 20000 : cell.Right
                         - cell.EffectivePaddingRight;
                 float y1 = cell.Top - newHeight
                         + cell.EffectivePaddingBottom;
                 float y2 = cell.Top - cell.EffectivePaddingTop;
                 y = Math.Max(y1, y2);
                 y = SetColumn(ct,
                         cell.Left + cell.EffectivePaddingLeft, y1,
                         rightLimit, y2);
             }
             status = ct.Go(true);
             bool thisEmpty = (ct.YLine == y);
             if (thisEmpty)
                 ct = ColumnText.Duplicate(cell.Column);
             allEmpty = (allEmpty && thisEmpty);
             if ((status & ColumnText.NO_MORE_TEXT) == 0 || thisEmpty) {
                 c2.Column = ct;
                 ct.FilledWidth = 0;
             } else {
                 c2.Phrase = null;
             }
         }
         newCells[k] = c2;
         cell.FixedHeight = newHeight;
     }
     if (allEmpty) {
         for (int k = 0; k < cells.Length; ++k) {
             PdfPCell cell = cells[k];
             if (cell == null)
                 continue;
             float f = fh[k * 2];
             float m = fh[k * 2 + 1];
             if (f <= 0)
                 cell.MinimumHeight = m;
             else
                 cell.FixedHeight = f;
         }
         return null;
     }
     CalculateHeights();
     PdfPRow split = new PdfPRow(newCells);
     split.widths = (float[]) widths.Clone();
     split.CalculateHeights();
     return split;
 }
开发者ID:hjgode,项目名称:iTextSharpCF,代码行数:86,代码来源:PdfPRow.cs

示例11: CreateCompareTable2

        /// <summary>
        /// 创建参数表格
        /// </summary>
        /// <param name="tableEle"></param>
        /// <param name="columnCount"></param>
        protected void CreateCompareTable2(XElement tableEle, int columnCount)
        {
            string remark = tableEle.Attribute("remark").Value;
            Paragraph parTableRemark = new Paragraph(remark, fontTableRemark);
            parTableRemark.IndentationLeft = 24;
            parTableRemark.SpacingBefore = 20;
            pdfDoc.Add(parTableRemark);

            PdfPTable table = new iTextSharp.text.pdf.PdfPTable(new float[] { 270, 80, 80, 80, 80, 80, 80 });
            List<PdfPRow> rowList = new List<iTextSharp.text.pdf.PdfPRow>();
            for (int i = 0; i < tableEle.Elements().Count(); i++)
            {
                XElement rowEle = tableEle.Elements().ElementAt(i);
                List<PdfPCell> cellList = new List<iTextSharp.text.pdf.PdfPCell>();
                foreach (XElement cellEle in rowEle.Elements())
                {
                    string label = cellEle.Attribute("label").Value;
                    if (label.Trim().Equals(""))
                    {
                        label = "/";
                    }
                    if (label.Trim().Equals("-"))
                    {
                        label = "";
                    }

                    iTextSharp.text.pdf.PdfPCell cellLabel = null;
                    if (i < 1)
                    {
                        cellLabel = new iTextSharp.text.pdf.PdfPCell(new Phrase(label, fontLabel));
                        cellLabel.HorizontalAlignment = PdfPCell.ALIGN_CENTER;
                    }
                    else
                    {
                        cellLabel = new iTextSharp.text.pdf.PdfPCell(new Phrase(label, fontContent));
                        cellLabel.HorizontalAlignment = PdfPCell.ALIGN_LEFT;
                    }
                    cellLabel.FixedHeight = 24;
                    cellLabel.Padding = 4;

                    cellLabel.VerticalAlignment = PdfPCell.ALIGN_MIDDLE;

                    XAttribute colSpanAtt = cellEle.Attribute("colspan");
                    if (colSpanAtt != null)
                    {
                        string colspan = colSpanAtt.Value;
                        if (colspan != "")
                        {
                            cellLabel.Colspan = int.Parse(colspan);
                        }
                    }
                    //XAttribute rowSpanAtt = cellEle.Attribute("rowspan");
                    //if (rowSpanAtt != null)
                    //{
                    //    string rowspan = rowSpanAtt.Value;
                    //    if (rowspan != "")
                    //    {
                    //        cellLabel.Rowspan = int.Parse(rowspan);
                    //    }
                    //}

                    cellList.Add(cellLabel);
                }
                PdfPRow row = new iTextSharp.text.pdf.PdfPRow(cellList.ToArray<PdfPCell>());
                rowList.Add(row);
            }
            table.Rows.AddRange(rowList);
            //table.KeepTogether = true;
            table.SpacingBefore = 10;
            table.TotalWidth = 750;

            table.LockedWidth = true;
            Paragraph pTable = new Paragraph();
            pTable.Add(table);
            pdfDoc.Add(pTable);
        }
开发者ID:dewade2003,项目名称:DSJL,代码行数:81,代码来源:AbsExportPDF.cs

示例12: CreateReportTable

        private static PdfPTable CreateReportTable(IGrouping<GroupingByDate, Income> sales)
        {
            var dataTable = new PdfPTable(new float[] { 2, 1, 1.5f, 3.5f, 1 });
            dataTable.WidthPercentage = 100f;
            Font dateFont = FontFactory.GetFont("Arial", 11);
            // var date = sales.Key.Year + "-" +
            //     sales.Key.Month.ToString().PadLeft(2, '0') + "-" +
            //     sales.Key.Day.ToString().PadLeft(2, '0');

            var date = sales.First().Date.ToString("dd-MMM-yyyy");

            var dateParagraph = new Paragraph("Date: " + date, dateFont);
            var dateCell = new PdfPCell(dateParagraph);
            dateCell.Padding = 5;
            dateCell.Colspan = 5;
            dateCell.BackgroundColor = new BaseColor(243, 243, 243);
            dataTable.AddCell(dateCell);

            var headerFont = FontFactory.GetFont("Arial", 10, Font.BOLD);
            var productCell = new PdfPCell(new Paragraph("Product", headerFont));
            var quantityCell = new PdfPCell(new Paragraph("Quantity", headerFont));
            var unitPriceCell = new PdfPCell(new Paragraph("Unit Price", headerFont));
            var locationCell = new PdfPCell(new Paragraph("Location", headerFont));
            var sumCell = new PdfPCell(new Paragraph("Sum", headerFont));
            var headerCells = new PdfPCell[] { productCell, quantityCell, unitPriceCell, locationCell, sumCell };
            foreach (var cell in headerCells)
            {
                cell.BackgroundColor = new BaseColor(200, 200, 200);
                cell.Padding = 5;
            }
            var headerRow = new PdfPRow(headerCells);
            dataTable.Rows.Add(headerRow);

            var dataFont = FontFactory.GetFont("Arial", 10);
            decimal total = 0;
            foreach (var sale in sales)
            {
                var productDataCell = new PdfPCell(new Paragraph(sale.Product.Name, dataFont));
                var quantityDataCell = new PdfPCell(new Paragraph(sale.Quantity.ToString() + " " + sale.Product.Measure.Name, dataFont));
                var unitPriceDataCell = new PdfPCell(new Paragraph(sale.SalePrice.ToString(), dataFont));
                var locationDataCell = new PdfPCell(new Paragraph(sale.Supermarket.Name, dataFont));
                var sum = ((decimal)sale.Quantity * sale.SalePrice);
                var sumDataCell = new PdfPCell(new Paragraph(sum.ToString(), dataFont));
                var dataCells = new PdfPCell[] { productDataCell, quantityDataCell, unitPriceDataCell, locationDataCell, sumDataCell };

                foreach (var cell in dataCells)
                {
                    cell.Padding = 5;
                }
                var dataRow = new PdfPRow(dataCells);
                dataTable.Rows.Add(dataRow);
                total += sum;
            }

            Font totalSumFont = FontFactory.GetFont("Arial", 11, Font.BOLD);
            var footerTotal = new PdfPCell(new Paragraph("Total sum for " + date + ":", dataFont));
            footerTotal.Colspan = 4;
            footerTotal.HorizontalAlignment = Element.ALIGN_RIGHT;
            footerTotal.Padding = 5;
            dataTable.AddCell(footerTotal);
            var footerSum = new PdfPCell(new Paragraph(total.ToString(), totalSumFont));
            footerSum.Padding = 5;
            dataTable.AddCell(footerSum);

            return dataTable;
        }
开发者ID:Team-Sunflower-Sunbright,项目名称:DatabaseApps-Teamwork,代码行数:66,代码来源:PDFSalesReport.cs

示例13: WriteAttributes

        private void WriteAttributes(PdfPRow row) {
            if (row != null) {

            }
        }
开发者ID:,项目名称:,代码行数:5,代码来源:

示例14: SplitRow

 /**
 * Splits a row to newHeight.
 * The returned row is the remainder. It will return null if the newHeight
 * was so small that only an empty row would result.
 *
 * @param new_height the new height
 * @return the remainder row or null if the newHeight was so small that only
 * an empty row would result
 */
 public PdfPRow SplitRow(PdfPTable table, int rowIndex, float new_height)
 {
     // second part of the row
     PdfPCell[] newCells = new PdfPCell[cells.Length];
     float[] fixHs = new float[cells.Length];
     float[] minHs = new float[cells.Length];
     bool allEmpty = true;
     // loop over all the cells
     for (int k = 0; k < cells.Length; ++k) {
         float newHeight = new_height;
         PdfPCell cell = cells[k];
         if (cell == null) {
             int index = rowIndex;
             if (table.RowSpanAbove(index, k)) {
                 while (table.RowSpanAbove(--index, k)) {
                     newHeight += table.GetRow(index).MaxHeights;
                 }
                 PdfPRow row = table.GetRow(index);
                 if (row != null && row.GetCells()[k] != null) {
                     newCells[k] = new PdfPCell(row.GetCells()[k]);
                     newCells[k].Column = null;
                     newCells[k].Rowspan = row.GetCells()[k].Rowspan - rowIndex + index;
                     allEmpty = false;
                 }
             }
             continue;
         }
         fixHs[k] = cell.FixedHeight;
         minHs[k] = cell.MinimumHeight;
         Image img = cell.Image;
         PdfPCell newCell = new PdfPCell(cell);
         if (img != null) {
             if (newHeight > cell.EffectivePaddingBottom + cell.EffectivePaddingTop + 2) {
                 newCell.Phrase = null;
                 allEmpty = false;
             }
         }
         else {
             float y;
             ColumnText ct = ColumnText.Duplicate(cell.Column);
             float left = cell.Left + cell.EffectivePaddingLeft;
             float bottom = cell.Top + cell.EffectivePaddingBottom - newHeight;
             float right = cell.Right - cell.EffectivePaddingRight;
             float top = cell.Top - cell.EffectivePaddingTop;
             switch (cell.Rotation) {
                 case 90:
                 case 270:
                     y = SetColumn(ct, bottom, left, top, right);
                     break;
                 default:
                     y = SetColumn(ct, left, bottom + 0.00001f, cell.NoWrap ? RIGHT_LIMIT : right, top);
                     break;
             }
             int status;
             status = ct.Go(true);
             bool thisEmpty = (ct.YLine == y);
             if (thisEmpty) {
                 newCell.Column = ColumnText.Duplicate(cell.Column);
                 ct.FilledWidth = 0;
             }
             else if ((status & ColumnText.NO_MORE_TEXT) == 0) {
                 newCell.Column = ct;
                 ct.FilledWidth = 0;
             }
             else
                 newCell.Phrase = null;
             allEmpty = (allEmpty && thisEmpty);
         }
         newCells[k] = newCell;
         cell.FixedHeight = newHeight;
     }
     if (allEmpty) {
         for (int k = 0; k < cells.Length; ++k) {
             PdfPCell cell = cells[k];
             if (cell == null)
                 continue;
             if (fixHs[k] > 0)
                 cell.FixedHeight = fixHs[k];
             else
                 cell.MinimumHeight = minHs[k];
         }
         return null;
     }
     CalculateHeights();
     PdfPRow split = new PdfPRow(newCells);
     split.widths = (float[]) widths.Clone();
     return split;
 }
开发者ID:boecko,项目名称:iTextSharp,代码行数:97,代码来源:PdfPRow.cs

示例15: AddCell

 /** Adds a cell element.
 * @param cell the cell element
 */
 public void AddCell(PdfPCell cell)
 {
     PdfPCell ncell = new PdfPCell(cell);
     int colspan = ncell.Colspan;
     colspan = Math.Max(colspan, 1);
     colspan = Math.Min(colspan, currentRow.Length - currentRowIdx);
     ncell.Colspan = colspan;
     if (colspan != 1)
         isColspan = true;
     int rdir = ncell.RunDirection;
     if (rdir == PdfWriter.RUN_DIRECTION_DEFAULT)
         ncell.RunDirection = runDirection;
     currentRow[currentRowIdx] = ncell;
     currentRowIdx += colspan;
     if (currentRowIdx >= currentRow.Length) {
         if (runDirection == PdfWriter.RUN_DIRECTION_RTL) {
             PdfPCell[] rtlRow = new PdfPCell[absoluteWidths.Length];
             int rev = currentRow.Length;
             for (int k = 0; k < currentRow.Length; ++k) {
                 PdfPCell rcell = currentRow[k];
                 int cspan = rcell.Colspan;
                 rev -= cspan;
                 rtlRow[rev] = rcell;
                 k += cspan - 1;
             }
             currentRow = rtlRow;
         }
         PdfPRow row = new PdfPRow(currentRow);
         if (totalWidth > 0) {
             row.SetWidths(absoluteWidths);
             totalHeight += row.MaxHeights;
         }
         rows.Add(row);
         currentRow = new PdfPCell[absoluteWidths.Length];
         currentRowIdx = 0;
     }
 }
开发者ID:hjgode,项目名称:iTextSharpCF,代码行数:40,代码来源:PdfPTable.cs


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