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


C# List.SetListSymbol方法代码示例

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


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

示例1: Write

        public void Write(string outputPath, FlowDocument doc)
        {
            Document pdfDoc = new Document(PageSize.A4, 50, 50, 50, 50);
            Font textFont = new Font(baseFont, DEFAULT_FONTSIZE, Font.NORMAL, BaseColor.BLACK);
            Font headingFont = new Font(baseFont, DEFAULT_HEADINGSIZE, Font.BOLD, BaseColor.BLACK);
            using (FileStream stream = new FileStream(outputPath, FileMode.Create))
            {
                PdfWriter writer = PdfWriter.GetInstance(pdfDoc, stream);
                pdfDoc.Open();
                foreach (Block i in doc.Blocks) {
                    if (i is System.Windows.Documents.Paragraph)
                    {
                        TextRange range = new TextRange(i.ContentStart, i.ContentEnd);
                        Console.WriteLine(i.Tag);
                        switch (i.Tag as string)
                        {
                            case "Paragraph": iTextSharp.text.Paragraph par = new iTextSharp.text.Paragraph(range.Text, textFont);
                                par.Alignment = Element.ALIGN_JUSTIFIED;
                                              pdfDoc.Add(par);
                                              break;
                            case "Heading": iTextSharp.text.Paragraph head = new iTextSharp.text.Paragraph(range.Text, headingFont);
                                              head.Alignment = Element.ALIGN_CENTER;
                                              head.SpacingAfter = 10;
                                              pdfDoc.Add(head);
                                              break;
                            default:          iTextSharp.text.Paragraph def = new iTextSharp.text.Paragraph(range.Text, textFont);
                                              def.Alignment = Element.ALIGN_JUSTIFIED;
                                              pdfDoc.Add(def);
                                              break;

                        }
                    }
                    else if (i is System.Windows.Documents.List)
                    {
                        iTextSharp.text.List list = new iTextSharp.text.List(iTextSharp.text.List.UNORDERED, 10f);
                        list.SetListSymbol("\u2022");
                        list.IndentationLeft = 15f;
                        foreach (var li in (i as System.Windows.Documents.List).ListItems)
                        {
                            iTextSharp.text.ListItem listitem = new iTextSharp.text.ListItem();
                            TextRange range = new TextRange(li.Blocks.ElementAt(0).ContentStart, li.Blocks.ElementAt(0).ContentEnd);
                            string text = range.Text.Substring(1);
                            iTextSharp.text.Paragraph par = new iTextSharp.text.Paragraph(text, textFont);
                            listitem.SpacingAfter = 10;
                            listitem.Add(par);
                            list.Add(listitem);
                        }
                        pdfDoc.Add(list);
                    }

               }
                if (pdfDoc.PageNumber == 0)
                {
                    iTextSharp.text.Paragraph par = new iTextSharp.text.Paragraph(" ");
                    par.Alignment = Element.ALIGN_JUSTIFIED;
                    pdfDoc.Add(par);
                }
               pdfDoc.Close();
            }
        }
开发者ID:drdaemos,项目名称:ODTCONVERTvs10,代码行数:60,代码来源:PDFWriter.cs

示例2: CreateList

 public List CreateList(String tag, ChainedProperties chain) {
     List list;
     if (Util.EqualsIgnoreCase(HtmlTags.UL, tag)) {
         list = new List(List.UNORDERED);
         list.SetListSymbol("\u2022 ");
     }
     else {
         list = new List(List.ORDERED);
     }
     try{
         list.IndentationLeft = float.Parse(chain[HtmlTags.INDENT], CultureInfo.InvariantCulture);
     }catch  {
         list.Autoindent = true;
     }
     return list;
 }
开发者ID:Gianluigi,项目名称:dssnet,代码行数:16,代码来源:ElementFactory.cs

示例3: MainExample


//.........这里部分代码省略.........
            Image jpg3 = Image.GetInstance ("images.jpg");
            Image jpg4 = Image.GetInstance ("images.jpg");

            jpg1.ScalePercent (scalePercent);
            jpg1.RotationDegrees = 0;

            jpg2.ScalePercent (scalePercent);
            jpg2.RotationDegrees = -90;

            jpg3.ScalePercent (scalePercent);
            jpg3.RotationDegrees = -180;

            jpg4.ScalePercent (scalePercent);
            jpg4.RotationDegrees = -270;

            par.Add (new Chunk (jpg1, 0, 0, true));
            par.Add (new Chunk (jpg2, 0, 0, true));
            par.Add (new Chunk (jpg3, 0, 0, true));
            par.Add (new Chunk (jpg4, 0, 0, true));

            doc.Add (par);

            //Page break
            doc.Add (new Paragraph("Before page break."));
            doc.Add (Chunk.NEXTPAGE);
            doc.Add (new Paragraph("After page break."));

            //List with 'None' marker style:
            par = new Paragraph();
            par.SpacingBefore = spacingAfter;
            par.Add ("List with 'None' marker style:");
            doc.Add(par);
            List list = new List (List.UNORDERED, symbolIndent);
            list.SetListSymbol ("");
            list.IndentationLeft = indentationLeft;
            list.Add ("Item1");
            list.Add ("Item2");
            list.Add ("Item3");
            doc.Add (list);

            //List with 'Disc' marker style:
            par = new Paragraph();
            par.SpacingBefore = spacingAfter;
            par.Add ("List with 'Disc' marker style:");
            doc.Add(par);
            list = new List (List.UNORDERED, symbolIndent);
            list.SetListSymbol (symbolDisk);
            list.IndentationLeft = indentationLeft;
            list.Add ("Item1");
            list.Add ("Item2");
            list.Add ("Item3");
            doc.Add (list);

            //List with 'Box' marker style:
            //Not working...
            par = new Paragraph();
            par.SpacingBefore = spacingAfter;
            par.Add ("List with 'Box' marker style:");
            doc.Add(par);
            list = new List (List.UNORDERED, symbolIndent);
            list.SetListSymbol (symbolBox);
            list.IndentationLeft = indentationLeft;
            list.Add ("Item1");
            list.Add ("Item2");
            list.Add ("Item3");
            doc.Add (list);
开发者ID:sunriselink,项目名称:TestPDF,代码行数:67,代码来源:Program.cs

示例4: StartElement


//.........这里部分代码省略.........
                    }
                    if (!skip)
                        document.Add(img);
                    cprops.RemoveChain(tag);
                }
                else {
                    cprops.RemoveChain(tag);
                    if (currentParagraph == null)
                        currentParagraph = FactoryProperties.CreateParagraph(cprops);
                    currentParagraph.Add(new Chunk(img, 0, 0));
                }
                return;
            }

            EndElement("p");
            if (tag.Equals("h1") || tag.Equals("h2") || tag.Equals("h3") || tag.Equals("h4") || tag.Equals("h5") || tag.Equals("h6")) {
                if (!h.ContainsKey(ElementTags.SIZE)) {
                    int v = 7 - int.Parse(tag.Substring(1));
                    h[ElementTags.SIZE] = v.ToString();
                }
                cprops.AddToChain(tag, h);
                return;
            }
            if (tag.Equals(HtmlTags.UNORDEREDLIST)) {
                if (pendingLI)
                    EndElement(HtmlTags.LISTITEM);
                skipText = true;
                cprops.AddToChain(tag, h);
                List list = new List(false);
                try{
                    list.IndentationLeft = float.Parse(cprops["indent"], System.Globalization.NumberFormatInfo.InvariantInfo);
                }catch {
                    list.Autoindent = true;
                }
                list.SetListSymbol("\u2022");
                stack.Push(list);
                return;
            }
            if (tag.Equals(HtmlTags.ORDEREDLIST)) {
                if (pendingLI)
                    EndElement(HtmlTags.LISTITEM);
                skipText = true;
                cprops.AddToChain(tag, h);
                List list = new List(true);
                try{
                    list.IndentationLeft = float.Parse(cprops["indent"], System.Globalization.NumberFormatInfo.InvariantInfo);
                }catch {
                    list.Autoindent = true;
                }
                stack.Push(list);
                return;
            }
            if (tag.Equals(HtmlTags.LISTITEM)) {
                if (pendingLI)
                    EndElement(HtmlTags.LISTITEM);
                skipText = false;
                pendingLI = true;
                cprops.AddToChain(tag, h);
                stack.Push(FactoryProperties.CreateListItem(cprops));
                return;
            }
            if (tag.Equals(HtmlTags.DIV) || tag.Equals(HtmlTags.BODY) || tag.Equals("p")) {
                cprops.AddToChain(tag, h);
                return;
            }
            if (tag.Equals(HtmlTags.PRE)) {
                if (!h.ContainsKey(ElementTags.FACE)) {
                    h[ElementTags.FACE] = "Courier";
                }
                cprops.AddToChain(tag, h);
                isPRE = true;
                return;
            }
            if (tag.Equals("tr")) {
                if (pendingTR)
                    EndElement("tr");
                skipText = true;
                pendingTR = true;
                cprops.AddToChain("tr", h);
                return;
            }
            if (tag.Equals("td") || tag.Equals("th")) {
                if (pendingTD)
                    EndElement(tag);
                skipText = false;
                pendingTD = true;
                cprops.AddToChain("td", h);
                stack.Push(new IncCell(tag, cprops));
                return;
            }
            if (tag.Equals("table")) {
                cprops.AddToChain("table", h);
                IncTable table = new IncTable(h);
                stack.Push(table);
                tableState.Push(new bool[]{pendingTR, pendingTD});
                pendingTR = pendingTD = false;
                skipText = true;
                return;
            }
        }
开发者ID:nicecai,项目名称:iTextSharp-4.1.6,代码行数:101,代码来源:HTMLWorker.cs

示例5: AddAssumptions

        private void AddAssumptions(Project project, Document document)
        {
            if (project.Assumptions == null || project.Assumptions.Count < 1)
                return;

            var element = new Paragraph("Assumptions", TitleFont());
            element.SpacingBefore = 5f;
            document.Add(element);

            var list = new List(false, false, 10);
            list.SetListSymbol("\u2022");
            list.IndentationLeft = 10f;

            foreach (var assumption in project.Assumptions)
            {
                var item = new ListItem(assumption);
                list.Add(item);
            }

            document.Add(list);
        }
开发者ID:modulexcite,项目名称:Estimatorx,代码行数:21,代码来源:DocumentCreator.cs

示例6: BuildListObject

        private List BuildListObject(List<HtmlElement> elements, string listType, PdfPCell pCell = null)
        {
            var docObjs = new Stack<HtmlElement>();
            var lt = listType == "ol" ? List.ORDERED : List.UNORDERED;

            // remove the ol objects
            elements.RemoveAll(a => a.Value == listType);

            var list = new iTextSharp.text.List(lt);
            if (lt == List.UNORDERED) list.SetListSymbol("\u2022");
            list.IndentationLeft = 10f;

            foreach (var a in elements)
            {
                var obj = HandleTag(docObjs, a, pCell);
                if (obj != null)
                {
                    list.Add(new ListItem(obj));
                }
            }

            if (pCell != null) pCell.AddElement(list);

            return list;
        }
开发者ID:ucdavis,项目名称:Dogbert,代码行数:25,代码来源:PdfService.cs

示例7: StartElement


//.........这里部分代码省略.........
                    bool skip = false;
                    if (interfaceProps != null) {
                        i = (IImg)interfaceProps["img_interface"];
                        if (i != null)
                            skip = i.Process(img, h, cprops, document);
                    }
                    if (!skip)
                        document.Add(img);
                    cprops.RemoveChain(tag);
                }
                else {
                    cprops.RemoveChain(tag);
                    if (currentParagraph == null)
                        currentParagraph = FactoryProperties.CreateParagraph(cprops);
                    currentParagraph.Add(new Chunk(img, 0, 0));
                }
                return;
            }

            EndElement("p");
            if (tag.Equals("h1") || tag.Equals("h2") || tag.Equals("h3") || tag.Equals("h4") || tag.Equals("h5") || tag.Equals("h6")) {
                if (!h.ContainsKey("size")) {
                    int v = 7 - int.Parse(tag.Substring(1));
                    h["size"] = v.ToString();
                }
                cprops.AddToChain(tag, h);
                return;
            }
            if (tag.Equals("ul")) {
                if (pendingLI)
                    EndElement("li");
                skipText = true;
                cprops.AddToChain(tag, h);
                List list = new List(false, 10);
                list.SetListSymbol("\u2022");
                stack.Push(list);
                return;
            }
            if (tag.Equals("ol")) {
                if (pendingLI)
                    EndElement("li");
                skipText = true;
                cprops.AddToChain(tag, h);
                List list = new List(true, 10);
                stack.Push(list);
                return;
            }
            if (tag.Equals("li")) {
                if (pendingLI)
                    EndElement("li");
                skipText = false;
                pendingLI = true;
                cprops.AddToChain(tag, h);
                stack.Push(FactoryProperties.CreateListItem(cprops));
                return;
            }
            if (tag.Equals("div") || tag.Equals("body")) {
                cprops.AddToChain(tag, h);
                return;
            }
            if (tag.Equals("pre")) {
                if (!h.ContainsKey("face")) {
                    h["face"] = "Courier";
                }
                cprops.AddToChain(tag, h);
                isPRE = true;
                return;
            }
            if (tag.Equals("p")) {
                cprops.AddToChain(tag, h);
                currentParagraph = FactoryProperties.CreateParagraph(h);
                return;
            }
            if (tag.Equals("tr")) {
                if (pendingTR)
                    EndElement("tr");
                skipText = true;
                pendingTR = true;
                cprops.AddToChain("tr", h);
                return;
            }
            if (tag.Equals("td") || tag.Equals("th")) {
                if (pendingTD)
                    EndElement(tag);
                skipText = false;
                pendingTD = true;
                cprops.AddToChain("td", h);
                stack.Push(new IncCell(tag, cprops));
                return;
            }
            if (tag.Equals("table")) {
                cprops.AddToChain("table", h);
                IncTable table = new IncTable(h);
                stack.Push(table);
                tableState.Push(new bool[]{pendingTR, pendingTD});
                pendingTR = pendingTD = false;
                skipText = true;
                return;
            }
        }
开发者ID:hjgode,项目名称:iTextSharpCF,代码行数:101,代码来源:HTMLWorker.cs

示例8: CreatePDFFile


//.........这里部分代码省略.........
                   WHERE INSTA_MST_SOLUTION_DETAILS.PARAGRAPH_HEADER_ID = INSTA_MST_PARAGRAPH_HEADER.PARAGRAPH_HEADER_ID
                     AND INSTA_MST_SOLUTION_DETAILS.SOLUTION_ID=" + Convert.ToString(ViewState["SOLUTION_ID"]) + @"
                   ORDER BY INSTA_MST_PARAGRAPH_HEADER.SORT_ORDER,
                            INSTA_MST_SOLUTION_DETAILS.SOLUTION_DETAIL_ID";

        reader = objHelper.gExecuteReader(CommandType.Text, strSql);
        while (reader.Read())
        {
            if (strParaName != Convert.ToString(reader["PARAGRAPH_DESCRIPTION"]))
            {
                // intYaxis += 5;
                para = new Paragraph();
                //  ct.SetSimpleColumn(285, document.Top - intYaxis, 500, 100);
                para.Add(new Chunk(Convert.ToString(reader["PARAGRAPH_DESCRIPTION"]) + ": ", SubbodyFont1));
                ct.AddText(para);
                ct.Go();

                // intYaxis += 10;
            }

            //if (Convert.ToInt32(Convert.ToString(reader["SOLUTION_DETAILS_BULLET_FLAG"])) > 0)
            //{
            //    strDynamicHTML += "<li style=\"font-family: Arial, Helvetica, sans-serif;font-size: 12px;\" >" + Convert.ToString(reader["SOLUTION_DETAILS"]) + "</li> ";
            //}
            //else
            //{
            para = new Paragraph();
            //  ct.SetSimpleColumn(285, document.Top - intYaxis, 550, 600);
            para.Add(new Chunk(Convert.ToString(reader["SOLUTION_DETAILS"]), SubbodyFont));
            ct.AddText(para);
            ct.Go();

            // intYaxis += 10;
            //}

            strParaName = Convert.ToString(reader["PARAGRAPH_DESCRIPTION"]);

        }
        reader.Close();

        //ADD PRODUCT FEATURES
        //------------------------------------------------------------------------
        if (intProdFeatureFlag > 0)
        {
            divProductFeature.Visible = true;
            //---------------------------------------------------------
            //intYaxis = 100;
            para = new Paragraph();
            ct.SetSimpleColumn(55, 440, 500, 100);
            para.Add(new Chunk(lblProductName.Text + " Features", subTitleFont));
            ct.AddText(para);
            ct.Go();
            //---------------------------------------------------------
            iTextSharp.text.List listFeature = new iTextSharp.text.List(List.UNORDERED, 10f);
            listFeature.SetListSymbol("\u2022");
            listFeature.IndentationLeft = 1f;
            //---------------------------------------------------------
            strSql = @"SELECT FEATURE_DESCRIPTION,
                              SORT_ORDER,
                              PRODUCT_FEATURE_BULLET_FLAG
                       FROM   INSTA_MST_PRODUCT_FEATURE,
                              INSTA_MST_SETUP
                       WHERE  PRODUCT_ID = " + intProductId + @"
                       ORDER BY SORT_ORDER ";

            reader = objHelper.gExecuteReader(CommandType.Text, strSql);
            while (reader.Read())
            {
                if (Convert.ToInt32(Convert.ToString(reader["PRODUCT_FEATURE_BULLET_FLAG"])) > 0)
                {
                    listFeature.Add(new iTextSharp.text.ListItem(Convert.ToString(reader["FEATURE_DESCRIPTION"]), SubbodyFont));
                }
                else
                {
                    listFeature.Add(new iTextSharp.text.ListItem(Convert.ToString(reader["FEATURE_DESCRIPTION"]), SubbodyFont));
                }
            }
            reader.Close();

            //------------------------------------
            para = new Paragraph();
            ct.SetSimpleColumn(55, 420, 260, 100);
            para.Add(listFeature);

            ct.AddElement(para);
            ct.Go();

            int i = listFeature.Size;

        }

        //-------------------------------------------------------------------------

        document.Close();

        Response.ContentType = "application/pdf";
        Response.AddHeader("Content-Disposition", string.Format("attachment;filename=Receipt-{0}.pdf", lblProductName.Text + lblHeadSolutionName.Text));
        Response.BinaryWrite(output.ToArray());
        Response.End();
    }
开发者ID:shreykejriwal,项目名称:insta,代码行数:101,代码来源:ProductSearch.aspx.cs

示例9: CreatePDF


//.........这里部分代码省略.........

                        //-----------------------------------------------------------------------------
                        //-- ADDING SHIPPING DETAILS
                        //-----------------------------------------------------------------------------
                        intYaxis = ct.YLine -30 ;

                        if (intShippingDisflg > 0 && intShippingDays > 0)
                        {
                            para = new Paragraph();
                            ct.SetSimpleColumn(intXaxis, document.Top - intYaxis, 550, 100);
                            //ct.SetSimpleColumn(intXaxis, ct.YLine+50, 550, 100);

                            para.Add(new Chunk("Shipping :", subTitleFont));
                            ct.AddElement(para);
                            ct.Go();
                            //-------------------------
                            intYaxis += 10;

                            para = new Paragraph();
                            ct.SetSimpleColumn(intXaxis, document.Top - intYaxis, 550, 100);
                            para.Add(new Chunk("Minimum days required to ship : " + intShippingDays, SubbodyFont));
                            ct.AddElement(para);
                            ct.Go();

                        }

                        if (Convert.ToDouble(strPrice) > 0)
                        {
                            intYaxis += 15;
                            para = new Paragraph();
                            ct.SetSimpleColumn(intXaxis, document.Top - intYaxis, 550, 100);
                            para.Add(new Chunk("Price : ", SubbodyFont));
                            para.Add(new Chunk(strCurrSymbol + " " + strPrice, SubbodyFont));
                            ct.AddElement(para);
                            ct.Go();

                        }

                        //ADD PRODUCT FEATURES
                        //------------------------------------------------------------------------
                        if (intProdFeatureFlag > 0)
                        {
                            //---------------------------------------------------------
                            //intYaxis = 100;
                            para = new Paragraph();
                            ct.SetSimpleColumn(40, 440, 500, 100);
                            para.Add(new Chunk(strProductName + " Features", subTitleFont));
                            ct.AddElement(para);
                            ct.Go();
                            //---------------------------------------------------------
                            iTextSharp.text.List listFeature = new iTextSharp.text.List(List.UNORDERED, 10f);
                            listFeature.SetListSymbol("\u2022");
                            listFeature.IndentationLeft = 1f;
                            //---------------------------------------------------------
                            strSql = @"SELECT FEATURE_DESCRIPTION,
                                              SORT_ORDER,
                                              PRODUCT_FEATURE_BULLET_FLAG
                                       FROM   INSTA_MST_PRODUCT_FEATURE,
                                              INSTA_MST_SETUP
                                       WHERE  PRODUCT_ID = " + intProductId + @"
                                       ORDER BY SORT_ORDER ";

                            reader = objHelper.gExecuteReader(CommandType.Text, strSql);
                            while (reader.Read())
                            {
                                if (Convert.ToInt32(Convert.ToString(reader["PRODUCT_FEATURE_BULLET_FLAG"])) > 0)
                                {
                                    listFeature.Add(new iTextSharp.text.ListItem(Convert.ToString(reader["FEATURE_DESCRIPTION"]), SubbodyFont));
                                }
                                else
                                {
                                    listFeature.Add(new iTextSharp.text.ListItem(Convert.ToString(reader["FEATURE_DESCRIPTION"]), SubbodyFont));
                                }
                            }
                            reader.Close();

                            //------------------------------------
                            para = new Paragraph();
                            ct.SetSimpleColumn(40, 420, 260, 100);
                            para.Add(listFeature);

                            ct.AddElement(para);
                            ct.Go();

                            int i = listFeature.Size;

                        }

                        //-------------------------------------------------------------------------
                        document.Close();

                        HttpContext.Current.Response.ContentType = "application/pdf";
                        HttpContext.Current.Response.AddHeader("Content-Disposition", string.Format("attachment;filename={0}.pdf", strProductName + strSolName));
                        HttpContext.Current.Response.BinaryWrite(output.ToArray());
                        HttpContext.Current.Response.End();
                    }
                }

            }
        }
开发者ID:shreykejriwal,项目名称:insta,代码行数:101,代码来源:Global.cs

示例10: btn_createPDF_Click

        private void btn_createPDF_Click(object sender, EventArgs e)
        {
            Document doc = new Document(iTextSharp.text.PageSize.A4);
            string pdfFileName = "Test.pdf";
            PdfWriter wri = PdfWriter.GetInstance(doc,new FileStream(pdfFileName,FileMode.Create));
            doc.Open(); // Open Document to write

            // add image
            iTextSharp.text.Image JPEG = iTextSharp.text.Image.GetInstance("Basic_logo.jpg");

            // resize image
            //JPEG.ScalePercent(50f);
            JPEG.ScaleToFit(150f,150f);
            JPEG.Border = iTextSharp.text.Rectangle.BOX;
            JPEG.BorderColor = iTextSharp.text.BaseColor.YELLOW;
            JPEG.BorderWidth = 1f;
            // location of image
            JPEG.SetAbsolutePosition(doc.PageSize.Width -32f-212f,doc.PageSize.Height - 36f);
            doc.Add(JPEG);

            // write some content
            Paragraph paragraph = new Paragraph("This is my first line using Paragraph.\n Hello world!");
            // add the above created text using different class object to our PDF document
            doc.Add(paragraph);

            //--- 編號為羅馬編號
            RomanList romanlist = new RomanList(true,15);   // true:lowwer case, 50: 編號後的間距
            romanlist.IndentationLeft = 30f;
            romanlist.Add("One");
            romanlist.Add("two");
            romanlist.Add("Three");
            romanlist.Add("Four");
            romanlist.Add("Five");

            //doc.Add(romanlist);

            List list = new List(List.ORDERED,40f);
            list.SetListSymbol("\u2022");
            list.IndentationLeft = 40f;  // 向左移

            list.Add("One");
            list.Add("Two");
            list.Add("Three");
            list.Add("Roman List");
            list.Add(romanlist);        // list in list
            list.Add("Four");
            list.Add("Five");

            doc.Add(list);

            paragraph = new Paragraph("\n");

            doc.Add(paragraph);
            //PdfPTable table = new PdfPTable(3);
            ////--- table header
            //PdfPCell cell = new PdfPCell(new Phrase("Header spanning 3 columns", new iTextSharp.text.Font(iTextSharp.text.Font.NORMAL,20f,iTextSharp.text.Font.NORMAL,iTextSharp.text.BaseColor.YELLOW)));
            //cell.BackgroundColor = new iTextSharp.text.BaseColor(0,150,0);  // RGB
            //cell.Colspan = 3;   // header size expand to 3 column
            //cell.HorizontalAlignment = 1; // 0 = Left, 1 = Centre, 2 = Right
            //table.AddCell(cell);
            ////---

            //table.AddCell("Col 1 Row 1");
            //table.AddCell("Col 2 Row 1");
            //table.AddCell("Col 3 Row 1");

            //table.AddCell("Col 1 Row 2");
            //table.AddCell("Col 2 Row 2");
            //table.AddCell("Col 3 Row 2");
            //doc.Add(table);

            PdfPTable table = new PdfPTable(dataGridView1.Columns.Count);

            // add the headers from the DGV to the table
            for (int i = 0; i < dataGridView1.Columns.Count; i++)
            {
                table.AddCell(new Phrase(dataGridView1.Columns[i].HeaderText));
            }

            // Flag the firt row as a header
            table.HeaderRows = 1;

            // add the actual rows from the DGV to the table
            for (int j = 0; j < dataGridView1.Rows.Count; j++)
            {
                for (int k = 0; k < dataGridView1.Columns.Count; k++)
                {
                    if (dataGridView1[k,j].Value != null)
                    {
                        table.AddCell(new Phrase(dataGridView1[k,j].Value.ToString()));
                    }
                }
            }

            doc.Add(table);

            // add chart to pdf
            var chartimage = new MemoryStream();
            chart1.SaveImage(chartimage, ChartImageFormat.Tiff);
            iTextSharp.text.Image Chart_image = iTextSharp.text.Image.GetInstance(chartimage.GetBuffer());
//.........这里部分代码省略.........
开发者ID:teana0953,项目名称:SQLiteTutor,代码行数:101,代码来源:Form2.cs

示例11: AddList

        private float AddList(string[] chunks, iTextSharp.text.Font font, float spacingBefore, float spacingAfter, float spacingBetween, int alignment, float lineHightMultiplier, string listSymbol, int padding, float indentationLeft, Document doc)
        {
            int count = 0;
            float height = 0;
            float fontSize = font.Size * lineHightMultiplier;
            var paragraph = new Paragraph();

            var list = new List(List.UNORDERED);
            list.SetListSymbol(listSymbol.PadRight(padding));
            list.IndentationLeft = indentationLeft;

            foreach (string item in chunks)
            {
                if (string.IsNullOrEmpty(item)) continue;
                var chunk = new Chunk(item, font);
                chunk.setLineHeight(font.Size * lineHightMultiplier);
                var listItem = new ListItem(chunk);
                listItem.SpacingBefore = spacingBetween;
                list.Add(listItem);
                count++;
            }

            if (count > 0)
            {
                paragraph.Add(list);
                paragraph.Alignment = alignment;
                paragraph.SpacingBefore = spacingBefore;
                paragraph.SpacingAfter = spacingAfter;
                doc.Add(paragraph);
                height = spacingBefore + spacingAfter + count * (fontSize + spacingBetween) - spacingBetween;
            }

            return height;
        }
开发者ID:tsigdel-idc,项目名称:oracle-paas-2015,代码行数:34,代码来源:PdfReport.cs

示例12: AddPageWithBulletList

        /// <summary>
        /// Add a page that includes a bullet list.
        /// </summary>
        /// <param name="doc"></param>
        private void AddPageWithBulletList(iTextSharp.text.Document doc)
        {
            // Add a new page to the document
            doc.NewPage();

            // The header at the top of the page is an anchor linked to by the table of contents.
            iTextSharp.text.Anchor contentsAnchor = new iTextSharp.text.Anchor("RESEARCH\n\n", _largeFont);
            contentsAnchor.Name = "research";

            // Add the header anchor to the page
            this.AddParagraph(doc, iTextSharp.text.Element.ALIGN_CENTER, _largeFont, contentsAnchor);

            // Create an unordered bullet list.  The 10f argument separates the bullet from the text by 10 points
            iTextSharp.text.List list = new iTextSharp.text.List(iTextSharp.text.List.UNORDERED, 10f);
            list.SetListSymbol("\u2022");   // Set the bullet symbol (without this a hypen starts each list item)
            list.IndentationLeft = 20f;     // Indent the list 20 points
            list.Add(new ListItem("Lift, thrust, drag, and gravity are the four forces that act on a plane.", _standardFont));
            list.Add(new ListItem("A plane should be light to help fight against gravity's pull to the ground.", _standardFont));
            list.Add(new ListItem("Gravity will have less effect on a plane built from the lightest materials available.", _standardFont));
            list.Add(new ListItem("In order to fly well, airplanes must be stable.", _standardFont));
            list.Add(new ListItem("A plane that is unstable will either pitch up into a stall, or nose-dive.", _standardFont));
            doc.Add(list);  // Add the list to the page

            // Add some white space and another heading
            this.AddParagraph(doc, iTextSharp.text.Element.ALIGN_CENTER, _largeFont, new Chunk("\n\n\n"));
            this.AddParagraph(doc, iTextSharp.text.Element.ALIGN_CENTER, _largeFont, new Chunk("HYPOTHESIS\n\n"));

            // Add some final text to the page
            this.AddParagraph(doc, iTextSharp.text.Element.ALIGN_LEFT, _standardFont, new Chunk("Given five paper airplanes made out of newspaper, printer paper, construction paper, paper towel, and posterboard, the airplane made out of printer paper will fly the furthest."));
        }
开发者ID:JosefinaAiyar,项目名称:iTextSharpTester,代码行数:34,代码来源:PDFCreator.cs

示例13: NestedListAtTheEndOfAnotherNestedList

    public void NestedListAtTheEndOfAnotherNestedList() {
        String pdfFile = "nestedListAtTheEndOfAnotherNestedList.pdf";
        // step 1
        Document document = new Document();
        // step 2
        PdfWriter.GetInstance(document, File.Create(DEST_FOLDER + pdfFile));
        // step 3
        document.Open();
        // step 4
        PdfPTable table = new PdfPTable(1);
        PdfPCell cell = new PdfPCell();
        cell.BackgroundColor = BaseColor.ORANGE;

        RomanList romanlist = new RomanList(true, 20);
        romanlist.IndentationLeft = 10f;
        romanlist.Add("One");
        romanlist.Add("Two");
        romanlist.Add("Three");

        RomanList romanlist2 = new RomanList(true, 20);
        romanlist2.IndentationLeft = 10f;
        romanlist2.Add("One");
        romanlist2.Add("Two");
        romanlist2.Add("Three");

        romanlist.Add(romanlist2);
        //romanlist.add("Four");

        List list = new List(List.ORDERED, 20f);
        list.SetListSymbol("\u2022");
        list.IndentationLeft = 20f;
        list.Add("One");
        list.Add("Two");
        list.Add("Three");
        list.Add("Four");
        list.Add("Roman List");
        list.Add(romanlist);

        list.Add("Five");
        list.Add("Six");

        cell.AddElement(list);
        table.AddCell(cell);
        document.Add(table);
        // step 5
        document.Close();

        CompareTool compareTool = new CompareTool();
        String error = compareTool.CompareByContent(DEST_FOLDER + pdfFile, SOURCE_FOLDER + pdfFile, DEST_FOLDER, "diff_");
        if (error != null) {
            Assert.Fail(error);
        }
    }
开发者ID:Niladri24dutta,项目名称:itextsharp,代码行数:53,代码来源:NestedListInColumnTextTest.cs


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