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

C# text.Phrase类代码示例

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

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



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

示例1: CreateMovieInformation

 // ---------------------------------------------------------------------------    
 /**
  * Creates a Phrase containing information about a movie.
  * @param    movie    the movie for which you want to create a Paragraph
  */
 public Phrase CreateMovieInformation(Movie movie)
 {
     Phrase p = new Phrase();
     p.Font = FilmFonts.NORMAL;
     p.Add(new Phrase("Title: ", FilmFonts.BOLDITALIC));
     p.Add(PojoToElementFactory.GetMovieTitlePhrase(movie));
     p.Add(" ");
     if (!string.IsNullOrEmpty(movie.OriginalTitle))
     {
         p.Add(new Phrase("Original title: ", FilmFonts.BOLDITALIC));
         p.Add(PojoToElementFactory.GetOriginalTitlePhrase(movie));
         p.Add(" ");
     }
     p.Add(new Phrase("Country: ", FilmFonts.BOLDITALIC));
     foreach (Country country in movie.Countries)
     {
         p.Add(PojoToElementFactory.GetCountryPhrase(country));
         p.Add(" ");
     }
     p.Add(new Phrase("Director: ", FilmFonts.BOLDITALIC));
     foreach (Director director in movie.Directors)
     {
         p.Add(PojoToElementFactory.GetDirectorPhrase(director));
         p.Add(" ");
     }
     p.Add(new Chunk("Year: ", FilmFonts.BOLDITALIC));
     p.Add(new Chunk(movie.Year.ToString(), FilmFonts.NORMAL));
     p.Add(new Chunk(" Duration: ", FilmFonts.BOLDITALIC));
     p.Add(new Chunk(movie.Duration.ToString(), FilmFonts.NORMAL));
     p.Add(new Chunk(" minutes", FilmFonts.NORMAL));
     p.Add(new LineSeparator(0.3f, 100, null, Element.ALIGN_CENTER, -2));
     return p;
 }
开发者ID:kuujinbo,项目名称:iTextInAction2Ed,代码行数:38,代码来源:MovieColumns1.cs


示例2: OnEndPage

        //重写 关闭一个页面时
        public override void OnEndPage(PdfWriter writer, Document document)
        {
            try
            {
                Font font = new Font(basefont, defaultFontSize);
                Phrase head = new Phrase(header, font);
                PdfContentByte cb = writer.DirectContent;
               
                //页眉显示的位置
                ColumnText.ShowTextAligned(cb, Element.ALIGN_RIGHT, head,
                        document.Right - 10 + document.LeftMargin, document.Top + 10, 0);
                if (PAGE_NUMBER)
                {
                    Phrase footer = new Phrase("第 " + writer.PageNumber + " / " + "   "+" 頁", font);
                    cb = writer.DirectContent;
                    //tpl = cb.CreateTemplate(100, 100);
                    //模版 显示总共页数
                    cb.AddTemplate(tpl, document.Left / 2 + document.Right / 2 , document.Bottom - 10);//调节模版显示的位置
                    //页脚显示的位置
                    ColumnText.ShowTextAligned(cb, Element.ALIGN_RIGHT, footer,
                            document.Left / 2+document.Right/ 2+23, document.Bottom - 10, 0);
                    

                }
            }
            catch (Exception ex)
            {
                throw new Exception("HeaderAndFooterEvent-->OnEndPage-->" + ex.Message);
            }
        }
开发者ID:lxh2014,项目名称:gigade-net,代码行数:31,代码来源:HeaderAndFooterEvent.cs


示例3: 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


示例4: AddText

        /// <summary>
        /// <para>座標を指定してテキストを追加します。</para>
        /// <para>PDF では用紙左上が座標基準 (0, 0) である点に注意してください。</para>
        /// </summary>
        /// <param name="text">追加するテキスト</param>
        /// <param name="fontSize">フォントサイズ</param>
        /// <param name="x">X 座標</param>
        /// <param name="y">Y座標</param>
        public void AddText(string text, int fontSize, int x, int y)
        {
            // 左下の座標
            float llx = x;
            float lly = 0f;

            // 右上の座標
            float urx = this.Page.Width;
            float ury = y;

            var pcb = this.Writer.DirectContent;
            var ct = new ColumnText(pcb);
            var font = new Font(this.BaseFont, fontSize, Font.NORMAL);

            var phrase = new Phrase(text, font);

            ct.SetSimpleColumn(
                phrase,
                llx,
                lly,
                urx,
                ury,
                0,
                Element.ALIGN_LEFT | Element.ALIGN_TOP
                );

            // 以下を実行して反映する (消さないこと)
            ct.Go();
        }
开发者ID:pine,项目名称:KutDormitoryReport,代码行数:37,代码来源:PdfReport.cs


示例5: GetFormattedCell

        private static PDF.PdfPCell GetFormattedCell(TableCell cell)
        {
            PDF.PdfPCell formattedCell = new PDF.PdfPCell();

            Element[] cellElements = cell.SubElements;

            foreach (Element temp in cellElements)
            {
                switch (temp.GetElementType())
                {
                    //TODO: Add other enum values
                    case ElementType.Text:
                        IT.Phrase phrase = new IT.Phrase(TextFormatter.GetFormattedText((Text)temp));
                        formattedCell.AddElement(phrase);
                        break;

                    case ElementType.Paragraph:
                        formattedCell.AddElement(ParagraphFormatter.GetFormattedParagraph((Paragraph)temp));
                        break;

                    case ElementType.Table:
                        formattedCell.AddElement(TableFormatter.GetFormattedTable((Table)temp));
                        break;

                    case ElementType.Image:
                        formattedCell.AddElement(ImageFormatter.GetFormattedImage((Image)temp));
                        break;
                }

            }

            return formattedCell;
        }
开发者ID:amilasurendra,项目名称:pdf-generator,代码行数:33,代码来源:TableFormatter.cs


示例6: Go

        public void Go()
        {
            // GetClassOutputPath() implementation left out for brevity
            var outputFile = Helpers.IO.GetClassOutputPath(this);

            using (FileStream stream = new FileStream(
                outputFile, 
                FileMode.Create, 
                FileAccess.Write))
            {
                Random random = new Random();

                StreamUtil.AddToResourceSearch(("iTextAsian.dll"));
                string chunkText = " 你好世界 你好你好,";
                var font = new Font(BaseFont.CreateFont("STSong-Light", "UniGB-UCS2-H", BaseFont.NOT_EMBEDDED), 12);

                using (Document document = new Document())
                {
                    PdfWriter.GetInstance(document, stream);
                    document.Open();
                    Phrase phrase = new Phrase();
                    Chunk chunk = new Chunk("", font);
                    for (var i = 0; i < 1000; ++i)
                    {
                        var asterisk = new String('*', random.Next(1, 20));
                        chunk.Append(
                            string.Format("[{0}] {1} ", asterisk, chunkText) 
                        );
                    }
                    chunk.SetSplitCharacter(new CustomSplitCharacter());
                    phrase.Add(chunk);
                    document.Add(phrase);
                }
            }
        }
开发者ID:kuujinbo,项目名称:StackOverflow.iTextSharp,代码行数:35,代码来源:ChineseSetSplitCharacter.cs


示例7: Add

        public void Add(Athlete athete)
        {
            var data =
            new IT.Phrase(athete.Id.ToString() ,
                          IT.FontFactory.GetFont(IT.FontFactory.HELVETICA, SIZE_ROW, IT.Font.NORMAL));

              var cell = new IT.pdf.PdfPCell(data);
              cell.HorizontalAlignment = IT.Element.ALIGN_LEFT;
              cell.PaddingBottom = PAD_BOTTOM;
              table.AddCell(cell);

             data = new IT.Phrase(athete.Surname + " "  + athete.Name,
                              IT.FontFactory.GetFont(IT.FontFactory.HELVETICA, SIZE_ROW, IT.Font.NORMAL));
             cell = new IT.pdf.PdfPCell(data);
             cell.HorizontalAlignment = IT.Element.ALIGN_LEFT;
             cell.PaddingBottom = PAD_BOTTOM;
             table.AddCell(cell);

             data = new IT.Phrase(" ",
                              IT.FontFactory.GetFont(IT.FontFactory.HELVETICA, SIZE_TITLE, IT.Font.NORMAL));
             cell = new IT.pdf.PdfPCell(data);
             cell.HorizontalAlignment = IT.Element.ALIGN_LEFT;
             cell.PaddingBottom = PAD_BOTTOM;
             table.AddCell(cell);
        }
开发者ID:o3o,项目名称:LdgLite,代码行数:25,代码来源:ListBuilder.cs


示例8: Write

 // ---------------------------------------------------------------------------          
 public void Write(Stream stream)
 {
     // step 1
     using (Document document = new Document())
     {
         // step 2
         PdfWriter writer = PdfWriter.GetInstance(document, stream);
         // step 3
         document.Open();
         // step 4
         Phrase phrase;
         Chunk chunk;
         foreach (Movie movie in PojoFactory.GetMovies())
         {
             phrase = new Phrase(movie.MovieTitle);
             chunk = new Chunk("\u00a0");
             chunk.SetAnnotation(PdfAnnotation.CreateText(
               writer, null, movie.MovieTitle,
               string.Format(INFO, movie.Year, movie.Duration),
               false, "Comment"
             ));
             phrase.Add(chunk);
             document.Add(phrase);
             document.Add(PojoToElementFactory.GetDirectorList(movie));
             document.Add(PojoToElementFactory.GetCountryList(movie));
         }
     }
 }
开发者ID:kuujinbo,项目名称:iTextInAction2Ed,代码行数:29,代码来源:MovieAnnotations2.cs


示例9: TextLeadingTest

        public void TextLeadingTest() {
            String file = "phrases.pdf";

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

            Phrase p1 = new Phrase("first, leading of 150");
            p1.Leading = 150;
            document.Add(p1);
            document.Add(Chunk.NEWLINE);

            Phrase p2 = new Phrase("second, leading of 500");
            p2.Leading = 500;
            document.Add(p2);
            document.Add(Chunk.NEWLINE);

            Phrase p3 = new Phrase();
            p3.Add(new Chunk("third, leading of 20"));
            p3.Leading = 20;
            document.Add(p3);

            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,代码行数:31,代码来源:DocumentLayoutTest.cs


示例10: OnChapter

 /**
  * Initialize one of the headers, based on the chapter title;
  * reset the page number.
  * @see com.itextpdf.text.pdf.PdfPageEventHelper#onChapter(
  *      com.itextpdf.text.pdf.PdfWriter, com.itextpdf.text.Document, float,
  *      com.itextpdf.text.Paragraph)
  */
 public override void OnChapter(
   PdfWriter writer, Document document,
   float paragraphPosition, Paragraph title)
 {
     header[1] = new Phrase(title.Content);
     pagenumber = 1;
 }
开发者ID:kuujinbo,项目名称:iTextInAction2Ed,代码行数:14,代码来源:MovieHistory2.cs


示例11: Phrase

 /**
 * Copy constructor for <CODE>Phrase</CODE>.
 */
 public Phrase(Phrase phrase)
     : base()
 {
     this.AddAll(phrase);
     leading = phrase.Leading;
     font = phrase.Font;
     hyphenation = phrase.hyphenation;
 }
开发者ID:bmictech,项目名称:iTextSharp,代码行数:11,代码来源:Phrase.cs


示例12: SpecialInstructions

 private static IElement SpecialInstructions(string commentsOrSpecialInstructions)
 {
     var c = new Phrase("\nCOMMENTS OR SPECIAL INSTRUCTIONS:\n", ElementFactory.StandardFontBold);
     var c1 = ElementFactory.GetPhrase(commentsOrSpecialInstructions, ElementFactory.Fonts.Standard);
     var c2 = new Phrase("\n\n\n", ElementFactory.StandardFont);
     var p = new Paragraph { c, c1, c2 };
     return p;
 }
开发者ID:HardcoreSoftware,项目名称:iSecretary,代码行数:8,代码来源:ClientInfoFactory.cs


示例13: SetTable

        private void SetTable(string titleString, int year)
        {
            var ed =
               new IT.Phrase("Trofeo Luca De Gerone" + year.ToString() ,
                         IT.FontFactory.GetFont(IT.FontFactory.HELVETICA, SIZE_TITLE + 2, IT.Font.BOLD)
                         );

             var title =
               new IT.Phrase(titleString,
                         IT.FontFactory.GetFont(IT.FontFactory.HELVETICA, SIZE_TITLE, IT.Font.BOLD)
                         );
             //pett, nome ,  tempo
             float[] widths = {1f,6f,4f};
             table = new IT.pdf.PdfPTable(widths);
             table.HeaderRows = 2;
             table.DefaultCell.Border = IT.Rectangle.NO_BORDER;

             // edizione
             var cell = new IT.pdf.PdfPCell(ed);
             cell.HorizontalAlignment = IT.Element.ALIGN_CENTER;
             cell.Colspan = COLUMNS;
             cell.PaddingBottom = PAD_BOTTOM;
             table.AddCell(cell);

             // intesatazione
             cell = new IT.pdf.PdfPCell(title);
             cell.HorizontalAlignment = IT.Element.ALIGN_CENTER;
             cell.Colspan = COLUMNS;
             cell.PaddingBottom = PAD_BOTTOM;
             cell.GrayFill = 0.90F;
             table.AddCell(cell);

             // riga vuota
             //table.AddCell(GetEmptyRow());

             var data =
               new IT.Phrase("Pett.",
                         IT.FontFactory.GetFont(IT.FontFactory.HELVETICA, SIZE_ROW, IT.Font.BOLD));

             cell = new IT.pdf.PdfPCell(data);
             cell.HorizontalAlignment = IT.Element.ALIGN_LEFT;
             cell.PaddingBottom = PAD_BOTTOM;
             table.AddCell(cell);

             data = new IT.Phrase("Nome",
                         IT.FontFactory.GetFont(IT.FontFactory.HELVETICA, SIZE_ROW, IT.Font.BOLD));
             cell = new IT.pdf.PdfPCell(data);
             cell.HorizontalAlignment = IT.Element.ALIGN_LEFT;
             cell.PaddingBottom = PAD_BOTTOM;
             table.AddCell(cell);

             data = new IT.Phrase("Tempo",
                IT.FontFactory.GetFont(IT.FontFactory.HELVETICA, SIZE_ROW, IT.Font.BOLD));
             cell = new IT.pdf.PdfPCell(data);
             cell.HorizontalAlignment = IT.Element.ALIGN_RIGHT;
             cell.PaddingBottom = PAD_BOTTOM;
             table.AddCell(cell);
        }
开发者ID:o3o,项目名称:LdgLite,代码行数:58,代码来源:ListBuilder.cs


示例14: fillRow

 private void fillRow(PdfPTable table) {
     for (int j = 0; j < 3; j++) {
         Phrase phrase = new Phrase("value");
         PdfPCell cell = new PdfPCell(phrase);
         cell.HorizontalAlignment = Element.ALIGN_CENTER;
         cell.VerticalAlignment = Element.ALIGN_CENTER;
         table.AddCell(cell);
     }
 }
开发者ID:newlysoft,项目名称:itextsharp,代码行数:9,代码来源:TaggedPdfOnEndPageTest.cs


示例15: ClientAddress

 private static IElement ClientAddress(string clientAddress)
 {
     var p = new Phrase("\n\nTO:\n", ElementFactory.StandardFontBold);
     var p2 = new Phrase(clientAddress, ElementFactory.StandardFont);
     var x = new Paragraph() { Leading = 0, MultipliedLeading = 0.8f };
     x.Add(p);
     x.Add(p2);
     return x;
 }
开发者ID:HardcoreSoftware,项目名称:iSecretary,代码行数:9,代码来源:ClientInfoFactory.cs


示例16: button1_Click

        private void button1_Click(object sender, EventArgs e)
        {
            try
            {
                // собираем информацию обо всех блюдах
                string mail = "Перечень блюд\n";
                bludoBindingSource.MoveFirst();
                kafeDataSet.BludoRow r = (kafeDataSet.BludoRow)((DataRowView)bludoBindingSource.Current).Row;
                int i = 0;

                // формируем PDF файл с описанием блюд
                var doc = new Document();
                string docPath = Application.StartupPath + @"\Предложение.pdf";
                PdfWriter.GetInstance(doc, new FileStream(docPath, FileMode.Create));
                doc.Open();
                // заголовок
                string fg = Path.Combine(Environment.GetFolderPath(Environment.SpecialFolder.Fonts), "ARIAL.TTF");

                BaseFont baseFont = BaseFont.CreateFont(fg, BaseFont.IDENTITY_H, BaseFont.NOT_EMBEDDED);
                iTextSharp.text.Phrase j = new Phrase("Перечень блюд", new iTextSharp.text.Font(baseFont, 14,
                              iTextSharp.text.Font.BOLD, new BaseColor(Color.Black)));
                Paragraph a1 = new Paragraph(j);
                a1.Add(Environment.NewLine);
                a1.Add(Environment.NewLine);
                a1.Add(Environment.NewLine);
                a1.Alignment = Element.ALIGN_CENTER;
                a1.SpacingAfter = 5;
                doc.Add(a1);
                while (i < bludoBindingSource.List.Count)
                {
                    r = (kafeDataSet.BludoRow)((DataRowView)bludoBindingSource.Current).Row;
                    mail += "Блюдо '" + r.Nazvanie + "': " + r.Opisanie + "\n\n";
                    j = new Phrase("Блюдо '" + r.Nazvanie + "'\n" + r.Opisanie + "\n\n", new iTextSharp.text.Font(baseFont, 12,
                  iTextSharp.text.Font.BOLD, new BaseColor(Color.Black)));
                    a1 = new Paragraph(j);
                    a1.Add(Environment.NewLine);
                    a1.Add(Environment.NewLine);
                    a1.Alignment = Element.ALIGN_LEFT;
                    a1.SpacingAfter = 5;
                    doc.Add(a1);

                    bludoBindingSource.MoveNext();
                    i++;
                }
                doc.Close();

                button2.Enabled = true;
                button4.Enabled = true;
                System.Windows.Forms.MessageBox.Show("Предложение было сформировано", "Информация", MessageBoxButtons.OK);
            }
            catch (Exception e1)
            {
                System.Windows.Forms.MessageBox.Show(e1.Message);
            }
        }
开发者ID:natasha95,项目名称:Kursovik2014,代码行数:55,代码来源:pochta_form.cs


示例17: GetTable

        private IT.pdf.PdfPTable GetTable(int year)
        {
            var ed =
               new IT.Phrase("Trofeo Luca De Gerone " + year.ToString() ,
                         IT.FontFactory.GetFont(IT.FontFactory.HELVETICA, SIZE_TITLE + 2, IT.Font.BOLD)
                         );

             //pett, nome ,  firma
             float[] widths = {1f,6f,6f, 4f};
             IT.pdf.PdfPTable table = new IT.pdf.PdfPTable(widths);
             table.HeaderRows = 2;
             table.DefaultCell.Border = IT.Rectangle.NO_BORDER;

             // edizione
             var cell = new IT.pdf.PdfPCell(ed);
             cell.HorizontalAlignment = IT.Element.ALIGN_CENTER;
             cell.Colspan = COLUMNS;
             cell.PaddingBottom = PAD_BOTTOM;
             table.AddCell(cell);

             // riga vuota
             //table.AddCell(GetEmptyRow());

             var data =
               new IT.Phrase("Pett.",
                         IT.FontFactory.GetFont(IT.FontFactory.HELVETICA, SIZE_ROW, IT.Font.BOLD));

             cell = new IT.pdf.PdfPCell(data);
             cell.HorizontalAlignment = IT.Element.ALIGN_LEFT;
             cell.PaddingBottom = PAD_BOTTOM;
             table.AddCell(cell);

             data = new IT.Phrase("Cognome",
                         IT.FontFactory.GetFont(IT.FontFactory.HELVETICA, SIZE_ROW, IT.Font.BOLD));
             cell = new IT.pdf.PdfPCell(data);
             cell.HorizontalAlignment = IT.Element.ALIGN_LEFT;
             cell.PaddingBottom = PAD_BOTTOM;
             table.AddCell(cell);

             data = new IT.Phrase("Nome",
                         IT.FontFactory.GetFont(IT.FontFactory.HELVETICA, SIZE_ROW, IT.Font.BOLD));
             cell = new IT.pdf.PdfPCell(data);
             cell.HorizontalAlignment = IT.Element.ALIGN_LEFT;
             cell.PaddingBottom = PAD_BOTTOM;
             table.AddCell(cell);

             data = new IT.Phrase("Firma di un genitore",
                IT.FontFactory.GetFont(IT.FontFactory.HELVETICA, SIZE_ROW, IT.Font.BOLD));
             cell = new IT.pdf.PdfPCell(data);
             cell.HorizontalAlignment = IT.Element.ALIGN_RIGHT;
             cell.PaddingBottom = PAD_BOTTOM;
             table.AddCell(cell);
             return table;
        }
开发者ID:o3o,项目名称:LdgLite,代码行数:54,代码来源:ModuleBuilder.cs


示例18: ParaCommonInfoAllBold

 public static Paragraph ParaCommonInfoAllBold(string field, string value)
 {
     Paragraph pr = new Paragraph();
     Phrase phr = new Phrase();
     Chunk chk1 = new Chunk(field, FontConfig.BoldFont);
     Chunk chk2 = new Chunk(value, FontConfig.BoldFont);
     phr.Add(chk1);
     phr.Add(chk2);
     pr.Add(phr);
     return pr;
 }
开发者ID:psautomationteam,项目名称:manufacturingmanager,代码行数:11,代码来源:FormatConfig.cs


示例19: CreatePdf

 public static void CreatePdf(string fileName)
 {
     Document document = new Document();
     FileStream stream = new FileStream(fileName, FileMode.OpenOrCreate);
     PdfWriter writer = PdfWriter.GetInstance(document, stream);
     document.Open();
     writer.CompressionLevel = 0;
     Phrase hello = new Phrase("Hello World");
     PdfContentByte canvas = writer.DirectContentUnder;
     ColumnText.ShowTextAligned(canvas, Element.ALIGN_LEFT, hello, 36, 788, 0);
     document.Close();
 }
开发者ID:deepanshgupta,项目名称:iTextSharp_Examples,代码行数:12,代码来源:HelloWorldColumn.cs


示例20: AddRow

        public void AddRow(PdfPTable t, string fname, string lname, string phone, int pid)
        {
            var bc = new Barcode39();
            bc.X = 1.2f;
            bc.Font = null;
            bc.Code = pid.ToString();
            var img = bc.CreateImageWithBarcode(dc, null, null);
            var p1 = new Phrase();
            p1.Add(new Chunk(img, 0, 0));
            p1.Add(new Phrase("\n\n" + fname + " " + lname + " (" + pid + ")", smallfont));
            var c = new PdfPCell(p1);
            c.HorizontalAlignment = PdfPCell.ALIGN_CENTER;
            c.VerticalAlignment = PdfPCell.ALIGN_MIDDLE;
            c.Border = PdfPCell.NO_BORDER;
            c.FixedHeight = H * 72f;

            var t2 = new PdfPTable(2);
            t2.WidthPercentage = 100f;
            t2.DefaultCell.Border = PdfPCell.NO_BORDER;

            var cc = new PdfPCell(new Phrase(fname, font));
            cc.Border = PdfPCell.NO_BORDER;
            cc.Colspan = 2;
            t2.AddCell(cc);

            cc = new PdfPCell(new Phrase(lname, font));
            cc.Border = PdfPCell.NO_BORDER;
            cc.Colspan = 2;
            t2.AddCell(cc);

            var pcell = new PdfPCell(new Phrase(pid.ToString(), smallfont));
            pcell.Border = PdfPCell.NO_BORDER;
            pcell.HorizontalAlignment = Element.ALIGN_LEFT;
            t2.AddCell(pcell);

            pcell = new PdfPCell(new Phrase(phone.FmtFone(), smallfont));
            pcell.Border = PdfPCell.NO_BORDER;
            pcell.HorizontalAlignment = Element.ALIGN_RIGHT;
            t2.AddCell(pcell);

            var cell = new PdfPCell(t2);
            cell.VerticalAlignment = PdfPCell.ALIGN_MIDDLE;
            cell.PaddingLeft = 8f;
            cell.PaddingRight = 8f;
            cell.Border = PdfPCell.NO_BORDER;
            cell.FixedHeight = H * 72f;

            t.AddCell(c);
            t.AddCell("");
            t.AddCell(cell);
            t.AddCell("");
            t.AddCell(cell);
        }
开发者ID:rossspoon,项目名称:bvcms,代码行数:53,代码来源:BarCodeLabelsResult.cs



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


鲜花

握手

雷人

路过

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

请发表评论

全部评论

专题导读
上一篇:
C# text.Rectangle类代码示例发布时间:2022-05-26
下一篇:
C# text.Paragraph类代码示例发布时间: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