当前位置: 首页>>代码示例>>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;未经允许,请勿转载。