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


C# Paragraph.AddLine方法代码示例

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


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

示例1: ExecuteResult

        public override void ExecuteResult(ControllerContext context)
        {
            var Response = context.HttpContext.Response;
            Response.ContentType = "application/pdf";
            Response.AddHeader("content-disposition", "filename=foo.pdf");

            dt = Util.Now;

            doc = new Document(PageSize.LETTER.Rotate(), 36, 36, 64, 64);
            var w = PdfWriter.GetInstance(doc, Response.OutputStream);

            var roles = DbUtil.Db.CurrentRoles();
            var i = (from o in DbUtil.Db.Organizations
                     where o.LimitToRole == null || roles.Contains(o.LimitToRole)
                     where o.OrganizationId == orgid
                     select new
                     {
                         o.OrganizationName,
                         o.LeaderName,
                         o.FirstMeetingDate
                     }).SingleOrDefault();

            w.PageEvent = new HeadFoot
            {
                HeaderText = "Recent Attendee Report: {0} - {1} ({2})".Fmt(
                    i.OrganizationName, i.LeaderName, i.FirstMeetingDate.HasValue ? "since " + i.FirstMeetingDate.FormatDate() : "no First Meeting Date set"),
                FooterText = "Recent Attendee Report"
            };
            doc.Open();

            var q = Attendees(orgid.Value);

            if (!orgid.HasValue || i == null || q.Count() == 0)
                doc.Add(new Phrase("no data"));
            else
            {
                var mt = new PdfPTable(1);
                mt.SetNoPadding();
                mt.HeaderRows = 1;

                float[] widths = new float[] { 4f, 6f, 7f, 2.6f, 2f, 3f };
                var t = new PdfPTable(widths);
                t.DefaultCell.Border = PdfPCell.NO_BORDER;
                t.DefaultCell.VerticalAlignment = PdfPCell.ALIGN_TOP;
                t.DefaultCell.SetLeading(2.0f, 1f);
                t.WidthPercentage = 100;

                t.AddHeader("Name", boldfont);
                t.AddHeader("Address", boldfont);
                t.AddHeader("Phone/Email", boldfont);
                t.AddHeader("Last Att.", boldfont);
                t.AddHeader("Birthday", boldfont);
                t.AddHeader("Status", boldfont);
                mt.AddCell(t);

                var color = BaseColor.BLACK;
                bool? v = null;

                foreach (var p in q)
                {
                    if (color == BaseColor.WHITE)
                        color = new GrayColor(240);
                    else
                        color = BaseColor.WHITE;

                    t = new PdfPTable(widths);
                    t.SetNoBorder();
                    t.DefaultCell.VerticalAlignment = Element.ALIGN_TOP;
                    t.DefaultCell.BackgroundColor = color;

                    if (v != p.visitor)
                        t.Add("             ------ {0} ------".Fmt(p.visitor == true ? "Guests and Previous Members" : "Members"), 6, bigboldfont);
                    v = p.visitor;

                    t.Add(p.Name, font);

                    var ph = new Paragraph();
                    ph.AddLine(p.Address, font);
                    ph.AddLine(p.Address2, font);
                    ph.AddLine(p.CSZ, font);
                    t.AddCell(ph);

                    ph = new Paragraph();
                    ph.AddLine(p.HomePhone.FmtFone("H"), font);
                    ph.AddLine(p.CellPhone.FmtFone("C"), font);
                    ph.AddLine(p.Email, font);
                    t.AddCell(ph);

                    t.Add(p.LastAttend.FormatDate(), font);
                    t.Add(p.Birthday, font);
                    t.Add(p.AttendType, font);
                    t.CompleteRow();

                    t.Add("", font);
                    t.Add(p.AttendStr, 4, monofont);
                    t.AddRight("{0:n1}{1}".Fmt(p.AttendPct, p.AttendPct.HasValue ? "%" : ""), font);

                    mt.AddCell(t);
                }
                doc.Add(mt);
//.........这里部分代码省略.........
开发者ID:hkouns,项目名称:bvcms,代码行数:101,代码来源:PastAttendeeResult.cs

示例2: ExecuteResult

        public override void ExecuteResult(ControllerContext context)
        {
            var Response = context.HttpContext.Response;
            Response.ContentType = "application/pdf";
            Response.AddHeader("content-disposition", "filename=foo.pdf");

            dt = Util.Now;

            doc = new Document(PageSize.LETTER.Rotate(), 36, 36, 64, 64);
            var w = PdfWriter.GetInstance(doc, Response.OutputStream);

            var i = (from m in DbUtil.Db.Meetings
                     where m.MeetingId == mtgid
                     select new
                     {
                         m.Organization.OrganizationName,
                         m.Organization.LeaderName,
                         m.MeetingDate
                     }).SingleOrDefault();

            w.PageEvent = new HeadFoot
            {
                HeaderText = $"Guests/Absents Report: {i.OrganizationName} - {i.LeaderName} {i.MeetingDate:g}",
                FooterText = "Guests/Absents Report"
            };
            doc.Open();

            var q = VisitsAbsents(mtgid.Value);

            if (!mtgid.HasValue || i == null || !q.Any())
                doc.Add(new Paragraph("no data"));
            else
            {
                var mt = new PdfPTable(1);
                mt.SetNoPadding();
                mt.HeaderRows = 1;

                float[] widths = {4f, 6f, 7f, 2.6f, 2f, 3f};
                var t = new PdfPTable(widths);
                t.DefaultCell.Border = Rectangle.NO_BORDER;
                t.DefaultCell.VerticalAlignment = Element.ALIGN_TOP;
                t.DefaultCell.SetLeading(2.0f, 1f);
                t.WidthPercentage = 100;

                t.AddHeader("Name", boldfont);
                t.AddHeader("Address", boldfont);
                t.AddHeader("Phone/Email", boldfont);
                t.AddHeader("Last Att.", boldfont);
                t.AddHeader("Birthday", boldfont);
                t.AddHeader("Guest/Member", boldfont);
                mt.AddCell(t);

                var color = BaseColor.BLACK;
                bool? v = null;
                foreach (var p in q)
                {
                    if (color == BaseColor.WHITE)
                        color = new GrayColor(240);
                    else
                        color = BaseColor.WHITE;

                    t = new PdfPTable(widths);
                    t.SetNoBorder();
                    t.DefaultCell.VerticalAlignment = Element.ALIGN_TOP;
                    t.DefaultCell.BackgroundColor = color;

                    if (v != p.visitor)
                        t.Add($"             ------ {(p.visitor ? "Guests" : "Absentees")} ------", 6, bigboldfont);
                    v = p.visitor;

                    t.Add(p.Name, font);

                    var ph = new Paragraph();
                    ph.AddLine(p.Address, font);
                    ph.AddLine(p.Address2, font);
                    ph.AddLine(p.CSZ, font);
                    t.AddCell(ph);

                    ph = new Paragraph();
                    ph.AddLine(p.HomePhone.FmtFone("H"), font);
                    ph.AddLine(p.CellPhone.FmtFone("C"), font);
                    ph.AddLine(p.Email, font);
                    t.AddCell(ph);

                    t.Add(p.LastAttend.FormatDate(), font);
                    t.Add(p.Birthday, font);
                    t.Add(p.Status, font);
                    t.CompleteRow();

                    if (p.Status == null || !p.Status.StartsWith("Visit"))
                    {
                        t.Add("", font);
                        t.Add($"{p.AttendStr}           {p.AttendPct:n1}{(p.AttendPct.HasValue ? "%" : "")}", 5, monofont);
                    }

                    mt.AddCell(t);
                }
                doc.Add(mt);
            }
            doc.Close();
//.........这里部分代码省略.........
开发者ID:stevesloka,项目名称:bvcms,代码行数:101,代码来源:VisitsAbsentsResult.cs

示例3: ExecuteResult

        public override void ExecuteResult(ControllerContext context)
        {
            var Response = context.HttpContext.Response;
            Response.ContentType = "application/pdf";
            Response.AddHeader("content-disposition", "filename=foo.pdf");

            dt = Util.Now;

            doc = new Document(PageSize.LETTER, 36, 36, 36, 36);
            var w = PdfWriter.GetInstance(doc, Response.OutputStream);
            w.PageEvent = pageEvents;
            doc.Open();
            dc = w.DirectContent;
            ct = new ColumnText(dc);

            if (!qid.HasValue)
                doc.Add(new Phrase("no data"));
            else
            {
                pageEvents.StartPageSet("Outreach/Inreach Report: {0:d}".Fmt(dt));
                IQueryable<ProspectInfo> q = GetProspectInfo(AlphaSort);
                if (!q.Any())
                    doc.Add(new Phrase("no data"));
                else
                    foreach (var p in q)
                    {
                        doc.NewPage();
                        var t = new PdfPTable(new float[] { 62f, 61f, 67f });
                        t.SetNoPadding();
                        var t1 = new PdfPTable(1);
                        t1.SetNoBorder();
                        var t2 = new PdfPTable(new float[] { 30f, 31f });
                        t2.SetNoBorder();
                        var t3 = new PdfPTable(new float[] { 27f, 40f });
                        t3.SetNoBorder();

                        var ph = new Paragraph();
                        ph.Add(new Chunk(p.Name, bfont));
                        ph.Add(new Chunk(" ({0})".Fmt(p.PeopleId), smallfont));
                        t1.AddCell(ph);
                        ph = new Paragraph();
                        ph.AddLine(p.Address, font);
                        ph.AddLine(p.Address2, font);
                        ph.AddLine(p.CityStateZip, font);
                        ph.Add("\n");
                        ph.AddLine(p.HomePhone.FmtFone("H"), font);
                        ph.AddLine(p.CellPhone.FmtFone("C"), font);
                        ph.AddLine(p.EMail, font);
                        t1.AddCell(ph);
                        t.AddCell(t1);

                        t2.Add("Position in Family:", font);
                        t2.Add(p.PositionInFamily, font);
                        t2.Add("Gender:", font);
                        t2.Add(p.Gender, font);
                        t2.Add("Marital Status:", font);
                        t2.Add(p.MaritalStatus, font);
                        t2.Add("", font);
                        t2.CompleteRow();

                        if (p.ChristAsSavior.HasValue())
                            t2.Add(p.ChristAsSavior, 2, font);
                        if (p.InfoBecomeAChristian.HasValue())
                            t2.Add(p.InfoBecomeAChristian, 2, font);
                        if (p.InterestedInJoining.HasValue())
                            t2.Add(p.InterestedInJoining, 2, font);
                        if (p.PleaseVisit.HasValue())
                            t2.Add(p.PleaseVisit, 2, font);

                        t.AddCell(t2);

                        t3.Add("Member Status:", font);
                        t3.Add(p.MemberStatus, font);
                        t3.Add("Origin:", font);
                        t3.Add(p.Origin, font);
                        t3.Add("Age:", font);
                        t3.Add(p.Age, font);
                        t3.Add("Comments:", 2, font);
                        t3.Add(p.Comment, 2, font);

                        t.AddCell(t3);
                        doc.Add(t);

                        if (p.Family.Count() > 0)
                        {
                            t = new PdfPTable(5);
                            t.SetNoBorder();
                            t.AddRow("Family Summary", bfont);
                            t.AddHeader("Name", bfont);
                            t.AddHeader("Age", bfont);
                            t.AddHeader("Cell Phone", bfont);
                            t.AddHeader("Position in Family", bfont);
                            t.AddHeader("Member Status", bfont);
                            foreach (var fm in p.Family)
                            {
                                t.Add(fm.Name, font);
                                t.Add(fm.Age.ToString(), font);
                                t.Add(fm.CellPhone.FmtFone(), font);
                                t.Add(fm.PositionInFamily, font);
                                t.Add(fm.MemberStatus, font);
//.........这里部分代码省略.........
开发者ID:rossspoon,项目名称:bvcms,代码行数:101,代码来源:ProspectResult.cs

示例4: ExecuteResult

        public override void ExecuteResult(ControllerContext context)
        {
            var ctl = new MailingController { UseTitles = titles ?? false, UseMailFlags = useMailFlags ?? false };
            var Response = context.HttpContext.Response;

            IEnumerable<MailingController.MailingInfo> q = null;
            switch (format)
            {
                case "Individual":
                    q = ctl.FetchIndividualList(sort, id);
                    break;
                case "GroupAddress":
                    q = ctl.GroupByAddress(id);
                    break;
                case "Family":
                case "FamilyMembers":
                    q = ctl.FetchFamilyList(sort, id);
                    break;
                case "ParentsOf":
                    q = ctl.FetchParentsOfList(sort, id);
                    break;
                case "CouplesEither":
                    q = ctl.FetchCouplesEitherList(sort, id);
                    break;
                case "CouplesBoth":
                    q = ctl.FetchCouplesBothList(sort, id);
                    break;
                default:
                    Response.Write("unknown format");
                    return;
            }
            if (!q.Any())
            {
                Response.Write("no data found");
                return;
            }
            Response.ContentType = "application/pdf";
            Response.AddHeader("content-disposition", "filename=foo.pdf");

            var document = new Document(PageSize.LETTER);
            document.SetMargins(50f, 36f, 32f, 36f);
            var w = PdfWriter.GetInstance(document, Response.OutputStream);
            document.Open();
            dc = w.DirectContent;

            var cols = new float[] { W, W, W - 25f };
            var t = new PdfPTable(cols);
            t.SetTotalWidth(cols);
            t.HorizontalAlignment = Element.ALIGN_CENTER;
            t.LockedWidth = true;
            t.DefaultCell.Border = PdfPCell.NO_BORDER;
            t.DefaultCell.FixedHeight = H;
            t.DefaultCell.VerticalAlignment = PdfPCell.ALIGN_MIDDLE;
            t.DefaultCell.PaddingLeft = 8f;
            t.DefaultCell.PaddingRight = 8f;
            t.DefaultCell.SetLeading(2.0f, 1f);

            if (skip > 0)
            {
                var blankCell = new PdfPCell(t.DefaultCell);

                for (int iX = 0; iX < skip; iX++)
                {
                    t.AddCell(blankCell);
                }
            }

            foreach (var m in q)
            {
                var c = new PdfPCell(t.DefaultCell);
                var ph = new Paragraph();
                if (format == "GroupAddress")
                    ph.AddLine(m.LabelName + " " + m.LastName, font);
                else
                    ph.AddLine(m.LabelName, font);
                ph.AddLine(m.Address, font);
                ph.AddLine(m.Address2, font);
                ph.AddLine(m.CityStateZip, font);
                c.AddElement(ph);
                if (usephone)
                {
                    var phone = Util.PickFirst(m.CellPhone.FmtFone("C "), m.HomePhone.FmtFone("H "));
                    var p = new Paragraph();
                    c.PaddingRight = 7f;
                    p.Alignment = Element.ALIGN_RIGHT;
                    p.Add(new Chunk(phone, smfont));
                    p.ExtraParagraphSpace = 0f;
                    c.AddElement(p);
                }
                t.AddCell(c);
            }
            t.CompleteRow();
            document.Add(t);

            document.Close();
        }
开发者ID:vs06,项目名称:bvcms,代码行数:96,代码来源:AveryAddressResult.cs


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