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


C# IElement.IsContent方法代码示例

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


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

示例1: Add

 // methods implementing the IDocListener interface
 /// <summary>
 /// Adds an Element to the Document.
 /// </summary>
 /// <param name="element">the Element to add</param>
 /// <returns>true if the element was added, false if not</returns>
 public virtual bool Add(IElement element)
 {
     if (close) {
         throw new DocumentException("The document has been closed. You can't add any Elements.");
     }
     if (!open && element.IsContent()) {
         throw new DocumentException("The document is not open yet; you can only add Meta information.");
     }
     bool success = false;
     if (element is ChapterAutoNumber) {
         chapternumber = ((ChapterAutoNumber)element).SetAutomaticNumber(chapternumber);
     }
     foreach (IDocListener listener in listeners) {
         success |= listener.Add(element);
     }
     if (element is ILargeElement) {
         ILargeElement e = (ILargeElement)element;
         if (!e.ElementComplete)
             e.FlushContent();
     }
     return success;
 }
开发者ID:o3o,项目名称:itextsharpml,代码行数:28,代码来源:Document.cs

示例2: Add

        // methods implementing the IDocListener interface

        /// <summary>
        /// Adds an Element to the Document.
        /// </summary>
        /// <param name="element">the Element to add</param>
        /// <returns>true if the element was added, false if not</returns>
        public virtual bool Add(IElement element) {
            if (close) {
                throw new DocumentException(MessageLocalization.GetComposedMessage("the.document.has.been.closed.you.can.t.add.any.elements"));
            }
            if (!open && element.IsContent()) {
                throw new DocumentException(MessageLocalization.GetComposedMessage("the.document.is.not.open.yet.you.can.only.add.meta.information"));
            }
            bool success = false;
            if (element is ChapterAutoNumber) {
        	    chapternumber = ((ChapterAutoNumber)element).SetAutomaticNumber(chapternumber);
            }
            foreach (IDocListener listener in listeners) {
                success |= listener.Add(element);
            }
		    if (element is ILargeElement) {
			    ILargeElement e = (ILargeElement)element;
			    if (!e.ElementComplete)
				    e.FlushContent();
		    }
            return success;
        }
开发者ID:joshaxey,项目名称:Simple-PDFMerge,代码行数:28,代码来源:Document.cs

示例3: Add

     /**
      * Signals that an <CODE>Element</CODE> was added to the <CODE>Document</CODE>.
      *
      * @return  <CODE>true</CODE> if the element was added, <CODE>false</CODE> if not.
      * @throws  DocumentException when a document isn't open yet, or has been closed
      */
 
     public override bool Add(IElement element) {
         if (pause) {
             return false;
         }
         if (open && !element.IsContent()) {
             throw new DocumentException("The document is open; you can only add Elements with content.");
         }
         switch (element.Type) {
             case Element.HEADER:
                 try {
                     Header h = (Header) element;
                     if (HtmlTags.STYLESHEET.Equals(h.Name)) {
                         WriteLink(h);
                     }
                     else if (HtmlTags.JAVASCRIPT.Equals(h.Name)) {
                         WriteJavaScript(h);
                     }
                     else {
                         WriteHeader(h);
                     }
                 }
                 catch (InvalidCastException) {
                 }
                 return true;
             case Element.SUBJECT:
             case Element.KEYWORDS:
             case Element.AUTHOR:
                 Meta meta = (Meta) element;
                 WriteHeader(meta);
                 return true;
             case Element.TITLE:
                 AddTabs(2);
                 WriteStart(HtmlTags.TITLE);
                 os.WriteByte(GT);
                 AddTabs(3);
                 Write(HtmlEncoder.Encode(((Meta)element).Content));
                 AddTabs(2);
                 WriteEnd(HtmlTags.TITLE);
                 return true;
             case Element.CREATOR:
                 WriteComment("Creator: " + HtmlEncoder.Encode(((Meta)element).Content));
                 return true;
             case Element.PRODUCER:
                 WriteComment("Producer: " + HtmlEncoder.Encode(((Meta)element).Content));
                 return true;
             case Element.CREATIONDATE:
                 WriteComment("Creationdate: " + HtmlEncoder.Encode(((Meta)element).Content));
                 return true;
             case Element.MARKED:
             	if (element is MarkedSection) {
             		MarkedSection ms = (MarkedSection)element;
             		AddTabs(1);
                     WriteStart(HtmlTags.DIV);
                     WriteMarkupAttributes(ms.MarkupAttributes);
                     os.WriteByte(GT);
             		MarkedObject mo = ((MarkedSection)element).Title;
             		if (mo != null) {
                         markup = mo.MarkupAttributes;
             			mo.Process(this);
             		}
             		ms.Process(this);
                     WriteEnd(HtmlTags.DIV);
                     return true;
             	}
             	else {
             		MarkedObject mo = (MarkedObject) element;
             		markup = mo.MarkupAttributes;
                 	return mo.Process(this);
             	}
             default:
                 Write(element, 2);
                 return true;
         }
     }
开发者ID:nicecai,项目名称:iTextSharp-4.1.6,代码行数:81,代码来源:HtmlWriter.cs


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