當前位置: 首頁>>代碼示例>>C#>>正文


C# Paragraph.Trim方法代碼示例

本文整理匯總了C#中iTextSharp.text.Paragraph.Trim方法的典型用法代碼示例。如果您正苦於以下問題:C# Paragraph.Trim方法的具體用法?C# Paragraph.Trim怎麽用?C# Paragraph.Trim使用的例子?那麽, 這裏精選的方法代碼示例或許可以為您提供幫助。您也可以進一步了解該方法所在iTextSharp.text.Paragraph的用法示例。


在下文中一共展示了Paragraph.Trim方法的2個代碼示例,這些例子默認根據受歡迎程度排序。您可以為喜歡或者感覺有用的代碼點讚,您的評價將有助於係統推薦出更棒的C#代碼示例。

示例1: ProcessChunkItems

 protected void ProcessChunkItems(IList<IElement> chunks, HtmlCell cell) {
     Paragraph p = new Paragraph();
     p.MultipliedLeading = 1.2f;
     p.AddAll(chunks);
     p.Alignment = cell.HorizontalAlignment;
     if (p.Trim()) {
         cell.AddElement(p);
     }
     chunks.Clear();    
 }
開發者ID:newlysoft,項目名稱:itextsharp,代碼行數:10,代碼來源:TableData.cs

示例2: CurrentContentToParagraph

        /**
         * Adds currentContent list to a paragraph element. If addNewLines is true a
         * Paragraph object is returned, else a NoNewLineParagraph object is
         * returned.
         *
         * @param currentContent IList<IElement> of the current elements to be added.
         * @param addNewLines bool to declare which paragraph element should be
         *            returned, true if new line should be added or not.
         * @param applyCSS true if CSS should be applied on the paragraph
         * @param tag the relevant tag
         * @return a List with paragraphs
         */

        public virtual IList<IElement> CurrentContentToParagraph(IList<IElement> currentContent,
                                                                 bool addNewLines, bool applyCSS, Tag tag,
                                                                 IWorkerContext ctx)
        {
            try
            {
                IList<IElement> list = new List<IElement>();
                if (currentContent.Count > 0)
                {
                    if (addNewLines)
                    {
                        Paragraph p = new Paragraph(float.NaN);
                        p.MultipliedLeading = 1.2f;
                        foreach (IElement e in currentContent) {
                            if (e is LineSeparator) {
                                try {
                                    HtmlPipelineContext htmlPipelineContext = GetHtmlPipelineContext(ctx);
                                    Chunk newLine = (Chunk)GetCssAppliers().Apply(new Chunk(Chunk.NEWLINE), tag, htmlPipelineContext);
                                    p.Add(newLine);
                                } catch (NoCustomContextException exc) {
                                    throw new RuntimeWorkerException(LocaleMessages.GetInstance().GetMessage(LocaleMessages.NO_CUSTOM_CONTEXT), exc);
                                }
                            }
                            p.Add(e);
                        }
                        if (p.Trim()) {
                            if (applyCSS)
                            {
                                p = (Paragraph) GetCssAppliers().Apply(p, tag, GetHtmlPipelineContext(ctx));
                            }
                            list.Add(p);
                        }
                    } else {
                        NoNewLineParagraph p = new NoNewLineParagraph(float.NaN);
                        p.MultipliedLeading = 1.2f;
                        foreach (IElement e in currentContent) {
                            p.Add(e);
                        }
                        p = (NoNewLineParagraph) GetCssAppliers().Apply(p, tag, GetHtmlPipelineContext(ctx));
                        list.Add(p);
                    }
                }
                return list;
            } catch (NoCustomContextException e) {
                throw new RuntimeWorkerException(
                    LocaleMessages.GetInstance().GetMessage(LocaleMessages.NO_CUSTOM_CONTEXT), e);
            }
        }
開發者ID:,項目名稱:,代碼行數:61,代碼來源:


注:本文中的iTextSharp.text.Paragraph.Trim方法示例由純淨天空整理自Github/MSDocs等開源代碼及文檔管理平台,相關代碼片段篩選自各路編程大神貢獻的開源項目,源碼版權歸原作者所有,傳播和使用請參考對應項目的License;未經允許,請勿轉載。