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


C# Paragraph.Add方法代码示例

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


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

示例1: GetElement

        public static IElement GetElement(this HeaderBase hb)
        {
            Paragraph p = new Paragraph();

            Font f = TextSharpFonts.SectionHeaderFont;

            if (hb is TitleHeader)
            {
                f = TextSharpFonts.TitleHeaderFont;
                p.Add(new Phrase(hb.Header, f));
                p.Alignment = Element.ALIGN_CENTER;
                p.Leading = f.Size * 2f;
                p.SpacingAfter = f.Size * 1.5f;
            }

            if (hb is SectionHeader)
            {
                p.Add(new Phrase(hb.Header, f));
                p.Leading = f.Size * 1.5f;
            }

            if (hb is ItemHeader)
            {
                p.Add(new Phrase(hb.Header, TextSharpFonts.ItemHeaderFont));
            }

            return p;
        }
开发者ID:rrhartjr,项目名称:Demo.Report,代码行数:28,代码来源:TextSharpPdfDocumentRenderer.cs

示例2: OnEndPage

        //override the OnPageEnd event handler to add our footer
        public override void OnEndPage(PdfWriter writer, Document doc)
        {
            //I use a PdfPtable with 2 columns to position my footer where I want it
            PdfPTable footerTbl = new PdfPTable(2);

            //set the width of the table to be the same as the document
            footerTbl.TotalWidth = doc.PageSize.Width;

            //Center the table on the page
            footerTbl.HorizontalAlignment = Element.ALIGN_CENTER;

            //Create a paragraph that contains the footer text
            Paragraph para;// = new Paragraph("", Fuentes.footer);
            DateTime time = DateTime.Now;              // Use current time
            string format = "dd/MM/yyyy";    // Use this format
            para = new Paragraph(time.ToString(format), Fuentes.Footer);

            //add a carriage return
            para.Add(Environment.NewLine);
            para.Add("");

            //create a cell instance to hold the text
            PdfPCell cell = new PdfPCell(para);

            //set cell border to 0
            cell.Border = 0;

            //add some padding to bring away from the edge
            cell.PaddingLeft = 10;

            //add cell to table
            footerTbl.AddCell(cell);

            //Creo el contenido de la 2da celda
            int pageN = writer.PageNumber;
            //DateTime time = DateTime.Now;              // Use current time
            //string format = "dd/MM/yyyy";    // Use this format
            //para = new Paragraph(time.ToString(format), Fuentes.footer);

            //para.Add(Environment.NewLine);
            para = new Paragraph(pageN.ToString(), Fuentes.Footer);

            //create new instance of cell to hold the text
            cell = new PdfPCell(para);

            //align the text to the right of the cell
            cell.HorizontalAlignment = Element.ALIGN_RIGHT;
            //set border to 0
            cell.Border = 0;

            // add some padding to take away from the edge of the page
            cell.PaddingRight = 10;

            //add the cell to the table
            footerTbl.AddCell(cell);

            //write the rows out to the PDF output stream.
            footerTbl.WriteSelectedRows(0, -1, 0, (doc.BottomMargin + 10), writer.DirectContent);
        }
开发者ID:danilozacyac,项目名称:MateriasSGACatalog,代码行数:60,代码来源:HeaderFooter.cs

示例3: Write

        // ===========================================================================
        public void Write(Stream stream)
        {
            var SQL =
      @"SELECT DISTINCT mc.country_id, c.country, count(*) AS c 
FROM film_country c, film_movie_country mc 
  WHERE c.id = mc.country_id
GROUP BY mc.country_id, country ORDER BY c DESC";
            // step 1
            using (Document document = new Document())
            {
                // step 2
                PdfWriter.GetInstance(document, stream);
                // step 3
                document.Open();
                // step 4
                using (var c = AdoDB.Provider.CreateConnection())
                {
                    c.ConnectionString = AdoDB.CS;
                    using (DbCommand cmd = c.CreateCommand())
                    {
                        cmd.CommandText = SQL;
                        c.Open();
                        using (var r = cmd.ExecuteReader())
                        {
                            while (r.Read())
                            {
                                Paragraph country = new Paragraph();
                                // the name of the country will be a destination
                                Anchor dest = new Anchor(
                                  r["country"].ToString(), FilmFonts.BOLD
                                );
                                dest.Name = r["country_id"].ToString();
                                country.Add(dest);
                                country.Add(string.Format(": {0} movies", r["c"].ToString()));
                                document.Add(country);
                                // loop over the movies
                                foreach (Movie movie in
                                    PojoFactory.GetMovies(r["country_id"].ToString()))
                                {
                                    // the movie title will be an external link
                                    Anchor imdb = new Anchor(movie.MovieTitle);
                                    imdb.Reference = string.Format(
                                      "http://www.imdb.com/title/tt{0}/", movie.Imdb
                                    );
                                    document.Add(imdb);
                                    document.Add(Chunk.NEWLINE);
                                }
                                document.NewPage();
                            }
                            // Create an internal link to the first page
                            Anchor toUS = new Anchor("Go back to the first page.");
                            toUS.Reference = "#US";
                            document.Add(toUS);
                        }
                    }
                }
            }
        }
开发者ID:kuujinbo,项目名称:iTextInAction2Ed,代码行数:59,代码来源:MovieLinks1.cs

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

示例5: CreateYearAndDuration

// ---------------------------------------------------------------------------    
    /**
     * Creates a Paragraph containing information about the year
     * and the duration of a movie.
     * @param    movie    the movie for which you want to create a Paragraph
     */
    public Paragraph CreateYearAndDuration(Movie movie) {
      Paragraph info = new Paragraph();
      info.Font = FilmFonts.NORMAL;
      info.Add(new Chunk("Year: ", FilmFonts.BOLDITALIC));
      info.Add(new Chunk(movie.Year.ToString(), FilmFonts.NORMAL));
      info.Add(new Chunk(" Duration: ", FilmFonts.BOLDITALIC));
      info.Add(new Chunk(movie.Duration.ToString(), FilmFonts.NORMAL));
      info.Add(new Chunk(" minutes", FilmFonts.NORMAL));
      return info;
    }    
开发者ID:,项目名称:,代码行数:16,代码来源:

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

示例7: btnPrint_Click

        private void btnPrint_Click(object sender, EventArgs e)
        {
            // Create a Document object
            var document = new Document(PageSize.A4, 50, 50, 25, 25);

            string file = "Choo.pdf";
            // Create a new PdfWriter object, specifying the output stream
            var output = new MemoryStream();
            //var writer = PdfWriter.GetInstance(document, output);
            var writer = PdfWriter.GetInstance(document, new FileStream(file, FileMode.Create));

            // Open the Document for writing
            document.Open();

            var titleFont = FontFactory.GetFont("Arial", 18);
            var subTitleFont = FontFactory.GetFont("Arial", 14);
            var boldTableFont = FontFactory.GetFont("Arial", 12);
            var endingMessageFont = FontFactory.GetFont("Arial", 10);
            var bodyFont = FontFactory.GetFont("Arial", 12);

            //document.Add(new Paragraph("Northwind Traders Receipt", titleFont);
            Paragraph tit = new Paragraph();
            Chunk c1 = new Chunk("  Ingresos Diarios \n", titleFont);
            Chunk c2 = new Chunk("Ciclo Escolar 2012 - 2013 \n");
            Chunk c3 = new Chunk("Dia consultado : 25/01/2013");
            tit.Add(c1);
            tit.Add(c2);
            tit.Add(c3);
            tit.IndentationLeft = 200f;
            document.Add(tit);

            PdfContentByte cb = writer.DirectContent;
            cb.MoveTo(50, document.PageSize.Height / 2);
            cb.LineTo(document.PageSize.Width - 50, document.PageSize.Height / 2);
            cb.Stroke();

            var orderInfoTable = new PdfPTable(2);
            orderInfoTable.HorizontalAlignment = 0;
            orderInfoTable.SpacingBefore = 10;
            orderInfoTable.SpacingAfter = 10;
            orderInfoTable.DefaultCell.Border = 0;
            orderInfoTable.SetWidths(new int[] { 1, 4 });

            orderInfoTable.AddCell(new Phrase("Order:", boldTableFont));
            orderInfoTable.AddCell("textorder");
            orderInfoTable.AddCell(new Phrase("Price:", boldTableFont));
            orderInfoTable.AddCell(Convert.ToDecimal(444444).ToString("c"));

            document.Add(orderInfoTable);
            document.Close();
            System.Diagnostics.Process.Start(file);
        }
开发者ID:sergio-ccz,项目名称:CMMM,代码行数:52,代码来源:frmReportCreation.cs

示例8: GetCompanyNameAndSlogan

 public static PdfPCell GetCompanyNameAndSlogan(InvoiceEntity invoiceEntity, CompanyInformationEntity companyInformationEntity)
 {
     var p = new Paragraph { Alignment = Element.ALIGN_TOP };
     p.Add(ElementFactory.GetParagraph(companyInformationEntity.Name, ElementFactory.Fonts.Large));
     p.Add(ElementFactory.GetParagraph(companyInformationEntity.Slogan, ElementFactory.Fonts.Standard));
     var c = new PdfPCell(p)
         {
             VerticalAlignment = Element.ALIGN_TOP,
             FixedHeight = 50f,
             PaddingTop = 0,
             BorderColor = BaseColor.WHITE
         };
     return c;
 }
开发者ID:HardcoreSoftware,项目名称:iSecretary,代码行数:14,代码来源:HeaderFactory.cs

示例9: Assemble

        private void Assemble()
        {
            //headers
            document.Add(makeHeader("DISCUSSION SUPPORT SYSTEM"));
            document.Add(makeHeader("Discussion report"));

            InsertLine();

            //subject
            document.Add(makeHeader(discussion.Subject, true));

            InsertLine();

            //background
            Paragraph p = new Paragraph();
            ///p.Add(TextRefsAggregater.PlainifyRichText(discussion.Background));
            p.Add(new Chunk("\n"));
            document.Add(p);

            InsertLine();

            //sources
            backgroundSources();
            document.NewPage();

            //agreement blocks
            List<ArgPoint> agreed = new List<ArgPoint>();
            List<ArgPoint> disagreed = new List<ArgPoint>();
            List<ArgPoint> unsolved = new List<ArgPoint>();
            addBlockOfAgreement("Agreed", agreed);
            addBlockOfAgreement("Disagreed", disagreed);
            addBlockOfAgreement("Unsolved", unsolved);
        }
开发者ID:gdlprj,项目名称:duscusys,代码行数:33,代码来源:ReportGenerator.cs

示例10: Write

 // ===========================================================================
 public void Write(Stream stream)
 {
     // step 1
     using (Document document = new Document())
     {
         // step 2
         PdfWriter.GetInstance(document, stream);
         document.SetPageSize(PageSize.A5);
         document.SetMargins(36, 72, 108, 180);
         document.SetMarginMirroring(true);
         // step 3
         document.Open();
         // step 4
         document.Add(new Paragraph(
           "The left margin of this odd page is 36pt (0.5 inch); " +
           "the right margin 72pt (1 inch); " +
           "the top margin 108pt (1.5 inch); " +
           "the bottom margin 180pt (2.5 inch).")
         );
         Paragraph paragraph = new Paragraph();
         paragraph.Alignment = Element.ALIGN_JUSTIFIED;
         for (int i = 0; i < 20; i++)
         {
             paragraph.Add("Hello World! Hello People! " +
             "Hello Sky! Hello Sun! Hello Moon! Hello Stars!"
             );
         }
         document.Add(paragraph);
         document.Add(new Paragraph(
           "The right margin of this even page is 36pt (0.5 inch); " +
           "the left margin 72pt (1 inch).")
         );
     }
 }
开发者ID:kuujinbo,项目名称:iTextInAction2Ed,代码行数:35,代码来源:HelloWorldMirroredMargins.cs

示例11: CreateParagraph

// ---------------------------------------------------------------------------
    /**
     * Creates a paragraph with some text about a movie with River Phoenix,
     * and a poster of the corresponding movie.
     * @param text the text about the movie
     * @param imdb the IMDB code referring to the poster
     */
    public Paragraph CreateParagraph(String text, String imdb) {
      Paragraph p = new Paragraph(text);
      Image img = Image.GetInstance(Path.Combine(RESOURCE, imdb + ".jpg"));
      img.ScaleToFit(1000, 72);
      img.RotationDegrees = -30;
      p.Add(new Chunk(img, 0, -15, true));
      return p;
    }
开发者ID:,项目名称:,代码行数:15,代码来源:

示例12: SetAnchor

 private static void SetAnchor(ISPage iSPage, Chapter chapter, Dictionary<string, int> pageMap)
 {
     Anchor anchorTarget = new Anchor(iSPage.RoomId);
     anchorTarget.Name = iSPage.RoomId;
     Paragraph targetParagraph = new Paragraph();
     targetParagraph.Add(anchorTarget);
     chapter.Add(targetParagraph);
 }
开发者ID:aaams,项目名称:infinite-story-download,代码行数:8,代码来源:PdfChapterHelper.cs

示例13: AddParagraph

 public static void AddParagraph(Document doc, int alignment, iTextSharp.text.Font font, iTextSharp.text.IElement content)
 {
     Paragraph paragraph = new Paragraph();
     paragraph.SetLeading(0f, 1.2f);
     paragraph.Alignment = alignment;
     paragraph.Font = font;
     paragraph.Add(content);
     doc.Add(paragraph);
 }
开发者ID:TeamMojito,项目名称:SupermarketsDatabaseClient,代码行数:9,代码来源:PdfReportert.cs

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

示例15: Write

// ---------------------------------------------------------------------------
    public void Write(Stream stream) {
      // step 1
      using (Document document = new Document()) {
        // step 2
        PdfWriter writer = PdfWriter.GetInstance(document, stream);
        writer.PageEvent = new AnnotationHelper();
        // step 3
        document.Open();
        // step 4
        Paragraph p = new Paragraph();
        Chunk chunk;
        Chunk tab = new Chunk(new VerticalPositionMark());
        for (int i = 0; i < ICONS.Length; i++) {
          chunk = new Chunk(ICONS[i]);
          chunk.SetGenericTag(ICONS[i]);
          p.Add(chunk);
          p.Add(tab);
        }        
        document.Add(p); 
      }
    }
开发者ID:,项目名称:,代码行数:22,代码来源:


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