コード例 #1
0
 /// <summary>
 /// Add a paragraph object containing the specified element to the PDF document.
 /// </summary>
 /// <param name="doc">Document to which to add the paragraph.</param>
 /// <param name="alignment">Alignment of the paragraph.</param>
 /// <param name="font">Font to assign to the paragraph.</param>
 /// <param name="content">Object that is the content of the paragraph.</param>
 private void AddParagraph(Document doc, int alignment, iTextSharp.text.Font font, iTextSharp.text.IElement content)
 {
     iTextSharp.text.Paragraph paragraph = new iTextSharp.text.Paragraph();
     paragraph.SetLeading(0f, 1.2f);
     paragraph.Alignment = alignment;
     paragraph.Font      = font;
     paragraph.Add(content);
     doc.Add(paragraph);
 }
コード例 #2
0
        public static iTS.Cell HtmlToCell(String Html)
        {
            iTS.Cell cell = new iTextSharp.text.Cell();

            Boolean Error = false;

            //                iTextSharp.text.html.simpleparser.StyleSheet styles =
            //new iTextSharp.text.html.simpleparser.StyleSheet();
            //                aaa
            //                styles.LoadTagStyle("ul", "indent", "10");
            //                styles.LoadTagStyle("ol", "indent", "10");

            Html = lm.Comol.Core.DomainModel.Helpers.Export.RtfHelper.HtmlCheckRtf(Html);
            System.Collections.ArrayList AL_Content = new System.Collections.ArrayList();

            try
            {
                AL_Content = iTextSharp.text.html.simpleparser.HTMLWorker.ParseToList(
                    new System.IO.StringReader(Html),
                    lm.Comol.Core.DomainModel.Helpers.Export.RtfHelper.GetStyles());
            }
            catch
            {
                Error = true;
            }


            if (Error)
            {
                Error = false;
                Html  = lm.Comol.Core.DomainModel.Helpers.Export.RtfHelper.RemoveHtmlTag(Html);
                try
                {
                    AL_Content = iTextSharp.text.html.simpleparser.HTMLWorker.ParseToList(
                        new System.IO.StringReader(Html),
                        lm.Comol.Core.DomainModel.Helpers.Export.RtfHelper.GetStyles());
                }
                catch
                {
                    Error = true;
                }
            }

            if (Error)
            {
                cell.AddElement(new iTS.Paragraph(Html));
            }
            else
            {
                for (int j = 0; j < AL_Content.Count; j++)
                {
                    try
                    {
                        iTS.IElement element = CheckconvertedElement((iTS.IElement)AL_Content[j]);
                        if (element != null)
                        {
                            cell.AddElement(element);
                        }
                    }
                    catch (Exception ex)
                    { }
                }
            }
            return(cell);
        }
コード例 #3
0
ファイル: PDFDoc.cs プロジェクト: Roopesht/PDFCreate
        public void AddParagraph(Document doc, int alignment, iTextSharp.text.Font font, iTextSharp.text.IElement content)
        {
            Paragraph paragraph = new Paragraph()
            {
                Alignment = alignment,
                Font      = font
            };

            paragraph.SetLeading(0f, 1.2f);
            paragraph.Add(content);
            doc.Add(paragraph);
        }
コード例 #4
0
 /// <summary>
 /// Controlla gli elementi convertiti ed effettua eventuali correzioni,
 /// es: OL/UL
 /// </summary>
 /// <param name="element">
 /// La lista di elementi convertiti.
 /// </param>
 /// <remarks>
 /// AGGIUNGERE controllo sulle liste,
 /// in RTF ad ogni LI aggiunge un LI vuoto...
 /// </remarks>
 protected static iTextSharp.text.IElement CheckconvertedElement(iTextSharp.text.IElement element)
 {
     return(element);
 }