iTextSharp.text.Font.SetStyle C# (CSharp) Метод

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

Sets the style using a String containing one of more of the following values: normal, bold, italic, underline, strike.
public SetStyle ( String style ) : void
style String A String representing a certain style.
Результат void
        public virtual void SetStyle(String style) {
            if (this.style == UNDEFINED) this.style = NORMAL;
            this.style |= GetStyleValue(style);
        }

Same methods

Font::SetStyle ( int style ) : void

Usage Example

Пример #1
0
        private static void addCell(PdfPTable table, string text, int rowspan, string fontStyle)
        {
            BaseFont bfTimes = BaseFont.CreateFont(BaseFont.HELVETICA, BaseFont.CP1252, false);

            iTextSharp.text.Font fuente = new iTextSharp.text.Font(bfTimes, 8, iTextSharp.text.Font.NORMAL, iTextSharp.text.BaseColor.BLACK);

            if (fontStyle.ToLower() == "n")
            {
                fuente.SetStyle(Font.NORMAL);
            }
            else if (fontStyle.ToLower() == "b")
            {
                fuente.SetStyle(Font.BOLD);
            }
            else if (fontStyle.ToLower() == "i")
            {
                fuente.SetStyle(Font.ITALIC);
            }

            PdfPCell cell = new PdfPCell(new Phrase(text, fuente));

            cell.BorderWidth         = 0;
            cell.Rowspan             = rowspan;
            cell.HorizontalAlignment = PdfPCell.ALIGN_LEFT;
            cell.VerticalAlignment   = PdfPCell.ALIGN_MIDDLE;
            table.AddCell(cell);
        }
All Usage Examples Of iTextSharp.text.Font::SetStyle