iTextSharp.text.pdf.PdfPCell.HasMinimumHeight C# (CSharp) Метод

HasMinimumHeight() публичный Метод

public HasMinimumHeight ( ) : bool
Результат bool
        public bool HasMinimumHeight()
        {
            return MinimumHeight > 0;
        }

Usage Example

        /*
         * Requiere: N/A
         * Modifica: Exporta el grid de vista previa a un PDF y abre una nueva pestaña en el browser que la previsualiza. Si el usuario lo desea puede descargar el documento desde ahi.
         * Retorna: N/A.
         */
        protected void exportarToPdf()
        {
            string nombreReporte = "Reporte Doroteos.pdf";

            iTextSharp.text.Document doc = new iTextSharp.text.Document(iTextSharp.text.PageSize.LETTER);
            if (preGrid.Rows[0].Cells.Count > 4)
                doc.SetPageSize(iTextSharp.text.PageSize.LETTER.Rotate());

            var output = new System.IO.FileStream(Server.MapPath(nombreReporte), System.IO.FileMode.Create);
            var writer = PdfWriter.GetInstance(doc, output);
            doc.Open();

            iTextSharp.text.Rectangle page = doc.PageSize;
            PdfPTable head = new PdfPTable(1);
            head.TotalWidth = page.Width;
            Phrase phrase = new Phrase("Reporte generado el: " + DateTime.UtcNow.ToString("yyyy-MM-dd HH:mm:ss") + " GMT", new iTextSharp.text.Font(iTextSharp.text.Font.COURIER, 8));
            PdfPCell c = new PdfPCell(phrase);
            c.Border = iTextSharp.text.Rectangle.NO_BORDER;
            c.VerticalAlignment = Element.ALIGN_TOP;
            c.HorizontalAlignment = Element.ALIGN_CENTER;
            head.AddCell(c);
            doc.Add(head);
            doc.AddCreationDate();
            iTextSharp.text.Font boldFont = new iTextSharp.text.Font(iTextSharp.text.Font.TIMES_ROMAN, 24, iTextSharp.text.Font.BOLD);
            iTextSharp.text.Font boldFontHeader = new iTextSharp.text.Font(iTextSharp.text.Font.TIMES_ROMAN, 14, iTextSharp.text.Font.BOLD);
            doc.Add(new iTextSharp.text.Paragraph("Reporte de proyectos", boldFont));
            doc.Add(new iTextSharp.text.Paragraph(" ", boldFont));

            BaseFont fieldFontRoman = BaseFont.CreateFont(@"C:\Windows\Fonts\arial.ttf", BaseFont.IDENTITY_H, BaseFont.EMBEDDED);
            iTextSharp.text.Font normalCell = new iTextSharp.text.Font(fieldFontRoman, 11, iTextSharp.text.Font.NORMAL);
            iTextSharp.text.Font ff = new iTextSharp.text.Font(fieldFontRoman, 13, iTextSharp.text.Font.BOLD);

            /*Se agregan datos de proyecto, en caso de ser seleccionado*/

            PdfPTable table = new PdfPTable(preGrid.Rows[0].Cells.Count);

            for (int i = 0; i < preGrid.Rows[0].Cells.Count; i++)
            {
                Phrase p = new Phrase(HttpUtility.HtmlDecode(preGrid.HeaderRow.Cells[i].Text), ff);
                PdfPCell cell = new PdfPCell(p);
                float level = 0.80F;
                GrayColor gray = new GrayColor(level);
                cell.BackgroundColor = gray;

                bool tiene = cell.HasMinimumHeight();
                //Phrase p = new Phrase(quitarTildes(preGrid.HeaderRow.Cells[i].Text), ff);
                table.AddCell(cell);
            }

            foreach (GridViewRow row in preGrid.Rows)
            {
                for (int i = 0; i < preGrid.Rows[0].Cells.Count; i++)
                {

                    Phrase p = new Phrase(HttpUtility.HtmlDecode(row.Cells[i].Text), normalCell);
                    //Phrase p = new Phrase(quitarTildes(row.Cells[i].Text), normalCell);
                    PdfPCell cell = new PdfPCell(p);
                    cell.PaddingBottom = 7.0F;
                    cell.PaddingTop = 7.0F;
                    table.AddCell(cell);
                }

            }

            doc.Add(table);

            //Se cierra documento
            doc.Close();

            Page.ClientScript.RegisterStartupScript(this.GetType(), "OpenWindow", "window.open('" + nombreReporte + "','_newtab');", true);
        }