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


C# Phrase.Clear方法代码示例

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


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

示例1: SystemUtilization

 public PdfPTable SystemUtilization(String path, ViewModels.PollReportViewModel model)
 {
     PdfPTable table = new PdfPTable(4);
     table.WidthPercentage = 100;
     int[] width = new int[] { 1,1,1,2 };
     table.SetWidths(width);
     Phrase phrase = new Phrase("Username", font);
     BaseColor basecolor = new BaseColor(232, 238, 244);
     table.AddCell(new PdfPCell(new PdfPCell(new Phrase(phrase)) { BackgroundColor = basecolor }));
     phrase.Clear();
     phrase.Add("Access Privileges");
     table.AddCell(new PdfPCell(new PdfPCell(new Phrase(phrase)) { BackgroundColor = basecolor }));
     phrase.Clear();
     phrase.Add("Date Created");
     table.AddCell(new PdfPCell(new PdfPCell(new Phrase(phrase)) { BackgroundColor = basecolor }));
     phrase.Clear();
     phrase.Add("Notifications");
     table.AddCell(new PdfPCell(new PdfPCell(new Phrase(phrase)) { BackgroundColor = basecolor }));
     foreach (var user in model.userList)
     {
         phrase.Clear();
         phrase.Add(user.UserName);
         table.AddCell(new Phrase(phrase));
         phrase.Clear();
         foreach (var role in user.Roles)
         {
             phrase.Add(role.RoleName + "\n");
         }
         table.AddCell(new Phrase(phrase));
         phrase.Clear();
         phrase.Add(user.CreationDate.ToString());
         table.AddCell(new Phrase(phrase));
         phrase.Clear();
         if (user.Roles.Contains(new dbPoll_Application.Models.Role("Poll Administrator")) && user.AccountExpiryDate<= DateTime.Now.AddDays(30))
         {
             phrase.Add("This account expires in " + (user.AccountExpiryDate - DateTime.Now).Days + " days.");
         }
         else phrase.Add("");
         table.AddCell(new Phrase(phrase));
     }
     return table;
 }
开发者ID:thebinarysearchtree,项目名称:dbPoll,代码行数:42,代码来源:CodeFile1.cs

示例2: SessionParticipation

 public PdfPTable SessionParticipation(String path,ViewModels.PollReportViewModel model)
 {
     PdfPTable table = new PdfPTable(4);
     table.WidthPercentage = 100;
     int[] width = new int[] { 10, 5, 5, 10 };
     table.SetWidths(width);
     Phrase phrase = new Phrase("Participant", font);
     BaseColor basecolor = new BaseColor(232, 238, 244);
     table.AddCell(new PdfPCell(new PdfPCell(new Phrase(phrase)) { BackgroundColor = basecolor }));
     phrase.Clear();
     phrase.Add("Attended");
     table.AddCell(new PdfPCell(new PdfPCell(new Phrase(phrase)) { BackgroundColor = basecolor }));
     phrase.Clear();
     phrase.Add("Participated (%)");
     table.AddCell(new PdfPCell(new PdfPCell(new Phrase(phrase)) { BackgroundColor = basecolor }));
     phrase.Clear();
     phrase.Add("Points Accumulated");
     table.AddCell(new PdfPCell(new PdfPCell(new Phrase(phrase)) { BackgroundColor = basecolor }));
     foreach (var participant in model.participants)
     {
         phrase.Clear();
         phrase.Add(participant.firstName +" " + participant.lastName);
         table.AddCell(new Phrase(phrase));
         phrase.Clear();
         phrase.Add(participant.attended.ToString());
         table.AddCell(new Phrase(phrase));
         phrase.Clear();
         phrase.Add(model.participated(participant));
         table.AddCell(new Phrase(phrase));
         phrase.Clear();
         phrase.Add(model.points(participant));
         table.AddCell(new Phrase(phrase));
     }
     return table;
 }
开发者ID:thebinarysearchtree,项目名称:dbPoll,代码行数:35,代码来源:CodeFile1.cs

示例3: QuestionReport

        public PdfPTable QuestionReport(String path, ViewModels.PollReportViewModel model,String entity)
        {
            if (model.selectedEntities.Count == 0)
            {
                PdfPTable table = new PdfPTable(4);
                int[] width = new int[4] { 2, 15, 12, 6 };
                table.WidthPercentage = 100;
                table.SetWidths(width);
                Phrase phrase = new Phrase("#", font);
                BaseColor basecolor = new BaseColor(232, 238, 244);
                BaseColor heading = new BaseColor(232, 238, 0);
                heading.Darker();
                heading.Darker();
                if (entity != null)
                {
                    PdfPCell entityline = new PdfPCell(new Phrase("Entity: " + entity, font));
                    entityline.BackgroundColor = heading;
                    entityline.Colspan = 4;
                    table.AddCell(entityline);
                }
                if (model.tick != null)
                {
                    String line;
                    if (model.include) line = "Include ";
                    else line = "Exclude ";
                    line += model.field.name + ", Values: ";
                    foreach (string i in model.tick) line += i + ", ";
                    line = line.Remove(line.Length - 2);
                    PdfPCell demo = new PdfPCell(new Phrase(line + entity, font));
                    demo.BackgroundColor = heading;
                    demo.Colspan = 4;
                    table.AddCell(demo);
                }
                table.AddCell(new PdfPCell(new PdfPCell(new Phrase(phrase)) { BackgroundColor = basecolor }));
                phrase.Clear();
                phrase.Add("Question");
                table.AddCell(new PdfPCell(new PdfPCell(new Phrase(phrase)) { BackgroundColor = basecolor }));
                phrase.Clear();
                phrase.Add("Answers");
                table.AddCell(new PdfPCell(new PdfPCell(new Phrase(phrase)) { BackgroundColor = basecolor }));
                phrase.Clear();
                phrase.Add("Number of Responses");
                table.AddCell(new PdfPCell(new PdfPCell(new Phrase(phrase)) { BackgroundColor = basecolor }));
                foreach (var question in model.questions)
                {
                    if (question.deletionTime == null)
                    {
                        phrase.Clear();
                        phrase.Add(question.questionNumber.ToString());
                        table.AddCell(new Phrase(phrase));
                        phrase.Clear();
                        phrase.Add(question.question);
                        table.AddCell(new Phrase(phrase));
                        PdfPTable options = new PdfPTable(2);
                        options.SetWidths(new int[2] { 4, 2 });
                        foreach (var answer in model.responses[question])
                        {
                            phrase.Clear();
                            phrase.Add(answer.Key);
                            options.AddCell(new Phrase(phrase));
                            phrase.Clear();
                            phrase.Add(answer.Value.ToString());
                            options.AddCell(new Phrase(phrase));
                        }

                        PdfPCell full = new PdfPCell(options);
                        full.Colspan = 2;
                        table.AddCell(full);
                    }
                }
                return table;
            }
            else
            {
                PdfPTable table = new PdfPTable(3 + model.selectedEntities.Count);
                table.WidthPercentage = 100;
                List<int> widthList = new List<int>();
                widthList.Add(2);
                widthList.Add(15);
                widthList.Add(12);
                widthList.Add(6);
                for (int i = 0; i < model.selectedEntities.Count-1; i++)
                {
                    widthList.Add(6);
                }
                table.SetWidths(widthList.ToArray());
                Phrase phrase = new Phrase("#", font);
                BaseColor basecolor = new BaseColor(232, 238, 244);
                BaseColor heading = new BaseColor(232, 238, 0);
                heading.Darker();
                heading.Darker();
                if (model.selectedEntities.Count > 0)
                {
                    Phrase entities = new Phrase("", new Font(FontFactory.GetFont("Verdana", 14)));
                    int i = 0;
                    if (model.selectedEntities.Count == 1) entities.Add("Entity: ");
                    else entities.Add("Entities: ");
                    foreach (Models.Entity ent in model.selectedEntities)
                    {
                        if (i == model.selectedEntities.Count - 1) entities.Add(ent.name);
//.........这里部分代码省略.........
开发者ID:thebinarysearchtree,项目名称:dbPoll,代码行数:101,代码来源:CodeFile1.cs

示例4: SessionHistory

 public PdfPTable SessionHistory(IList<Models.Poll> polls, String locations)
 {
     var userRepository = new UserRepository(NHibernateHelper.GetCurrentSession());
     string[] location = locations.Split('|');
     PdfPTable table = new PdfPTable(8);
     table.WidthPercentage = 100;
     int[] width = new int[] { 3,8,6,14,6,6,8,8 };
     table.SetWidths(width);
     Phrase phrase = new Phrase("Poll #", font);
     BaseColor basecolor = new BaseColor(232, 238, 244);
     table.AddCell(new PdfPCell(new PdfPCell(new Phrase(phrase)) { BackgroundColor = basecolor }));
     phrase.Clear();
     phrase.Add("Poll Name");
     table.AddCell(new PdfPCell(new PdfPCell(new Phrase(phrase)) { BackgroundColor = basecolor }));
     phrase.Clear();
     phrase.Add("Attendance");
     table.AddCell(new PdfPCell(new PdfPCell(new Phrase(phrase)) { BackgroundColor = basecolor }));
     phrase.Clear();
     phrase.Add("Location");
     table.AddCell(new PdfPCell(new PdfPCell(new Phrase(phrase)) { BackgroundColor = basecolor }));
     phrase.Clear();
     phrase.Add("Opening Time");
     table.AddCell(new PdfPCell(new PdfPCell(new Phrase(phrase)) { BackgroundColor = basecolor }));
     phrase.Clear();
     phrase.Add("Closing Time");
     table.AddCell(new PdfPCell(new PdfPCell(new Phrase(phrase)) { BackgroundColor = basecolor }));
     phrase.Clear();
     phrase.Add("Poll Masters");
     table.AddCell(new PdfPCell(new PdfPCell(new Phrase(phrase)) { BackgroundColor = basecolor }));
     phrase.Clear();
     phrase.Add("Poll Creators");
     table.AddCell(new PdfPCell(new PdfPCell(new Phrase(phrase)) { BackgroundColor = basecolor }));
     var i = 0;
     foreach (var poll in polls)
     {
         phrase.Clear();
         phrase.Add(poll.pollID.ToString());
         table.AddCell(new Phrase(phrase));
         phrase.Clear();
         phrase.Add(poll.name);
         table.AddCell(new Phrase(phrase));
         phrase.Clear();
         int attendance = 0;
         foreach (var participant in poll.participants)
         {
             if (participant.attended)
             {
                 attendance += 1;
             }
         }
         phrase.Add(attendance.ToString());
         table.AddCell(new Phrase(phrase));
         phrase.Clear();
         phrase.Add(location[i]);
         table.AddCell(new Phrase(phrase));
         phrase.Clear();
         if (poll.pollStart.HasValue) phrase.Add(poll.pollStart.Value.ToString());
         else phrase.Add("");
         table.AddCell(new Phrase(phrase));
         phrase.Clear();
         phrase.Add(poll.pollClose.ToString());
         table.AddCell(new Phrase(phrase));
         phrase.Clear();
         PdfPCell masters = new PdfPCell();
         foreach (Models.User master in poll.pollMasters) masters.AddElement(new Paragraph(master.FirstName + " " + master.LastName, font));
         table.AddCell(masters);
         PdfPCell creators = new PdfPCell();
         creators.BorderWidthLeft = 0;
         creators.BorderWidthTop = 0;
         foreach (Models.User creator in userRepository.GetCreatorsOfPoll(poll)) creators.AddElement(new Paragraph(creator.FirstName + " " + creator.LastName, font));
         table.AddCell(creators);
         i++;
     }
     return table;
 }
开发者ID:thebinarysearchtree,项目名称:dbPoll,代码行数:75,代码来源:CodeFile1.cs

示例5: createReport

        /*createReport()
        * Generates a .pdf document of the report based on the items selected. It requires that all fields have an item
        * selected or text entered. Once completed, it'll place the document on the user's Desktop. The following does
        * require the iTextSharp extension.
        */
        private void createReport()
        {
            try
            {
                //The following makes sure that all items are entered.
                if (clientName == null)
                {
                    MessageBox.Show("Client Name Cannot Be Empty", "Empty");
                }
                else if (clientStatus == null)
                {
                    MessageBox.Show("Client Status Cannot Be Empty", "Empty");
                }
                else if (clientPOC == null)
                {
                    MessageBox.Show("Client POC Cannot Be Empty", "Empty");
                }
                else if (clientArcVersion == null)
                {
                    MessageBox.Show("Client Arc Version Cannot Be Empty", "Empty");
                }
                else if (issuesTextBox.Text == "")
                {
                    MessageBox.Show("Open Issues Cannot Be Empty", "Empty");
                }
                else if (oppTextBox.Text == "")
                {
                    MessageBox.Show("Opportunities Cannot Be Empty", "Empty");
                }
                else if (summaryTextBox.Text == "")
                {
                    MessageBox.Show("Summary Cannot Be Empty", "Empty");
                }
                else
                {
                    //CSets the file path to the user's desktop
                    var desktopFolder = Environment.GetFolderPath(Environment.SpecialFolder.DesktopDirectory);
                    filename = Path.Combine(desktopFolder, reportAuthor + "_" + clientName + ".pdf");
                    var fullFileName = filename;
                    FileStream fileStream = new FileStream(fullFileName, FileMode.Create, FileAccess.Write, FileShare.None);
                    Document doc = new Document();
                    PdfWriter writer = PdfWriter.GetInstance(doc, fileStream);
                    doc.Open();

                    Chunk glue = new Chunk(new VerticalPositionMark());

                    Paragraph header = new Paragraph("Client Tune Up Report - " + reportAuthor, FontFactory.GetFont(FontFactory.TIMES_BOLD, 16));
                    header.Alignment = Element.ALIGN_CENTER;
                    doc.Add(header);

                    doc.Add(Chunk.NEWLINE);

                    Phrase clientPhrase = new Phrase();
                    clientPhrase.Add(new Chunk("Client: ", FontFactory.GetFont(FontFactory.TIMES_BOLD, 14)));
                    clientPhrase.Add(new Chunk(clientName, FontFactory.GetFont(FontFactory.TIMES, 12)));
                    Paragraph clientP = new Paragraph(clientPhrase);
                    doc.Add(clientP);

                    doc.Add(Chunk.NEWLINE);

                    Phrase pocPhrase = new Phrase();
                    pocPhrase.Add(new Chunk("Client POC: ", FontFactory.GetFont(FontFactory.TIMES_BOLD, 14)));
                    pocPhrase.Add(new Chunk(clientPOC, FontFactory.GetFont(FontFactory.TIMES, 12)));
                    Paragraph pocP = new Paragraph(pocPhrase);
                    doc.Add(pocP);

                    doc.Add(Chunk.NEWLINE);

                    Phrase datePhrase = new Phrase();
                    datePhrase.Add(new Chunk("Date: ", FontFactory.GetFont(FontFactory.TIMES_BOLD, 14)));
                    datePhrase.Add(new Chunk(reportDate, FontFactory.GetFont(FontFactory.TIMES, 12)));
                    Paragraph dateP = new Paragraph(datePhrase);
                    doc.Add(dateP);

                    doc.Add(Chunk.NEWLINE);

                    Phrase softPhrase = new Phrase();
                    softPhrase.Add(new Chunk("Software: ", FontFactory.GetFont(FontFactory.TIMES_BOLD, 14)));
                    Paragraph softP = new Paragraph(softPhrase);
                    doc.Add(softP);
                    softPhrase.Clear();
                    for (int i = 0; i < assetData.RowCount - 1; i++)
                    {
                        for (int j = 0; j < assetData.ColumnCount; j++)
                        {
                            softPhrase.Add(new Chunk(assetData.Rows[i].Cells[j].Value.ToString(), FontFactory.GetFont(FontFactory.TIMES, 12)));
                            softPhrase.Add(new Chunk("    "));
                        }
                        softP = new Paragraph(softPhrase);
                        doc.Add(softP);
                        softPhrase.Clear();
                    }

                    doc.Add(Chunk.NEWLINE);

//.........这里部分代码省略.........
开发者ID:BradMB90,项目名称:Bradley-Butts-Code-Exampes,代码行数:101,代码来源:tuneUpGen.cs


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