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


C# DocumentObject.GetType方法代碼示例

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


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

示例1: RenderElement

    void RenderElement(DocumentObject docObj)
    {
      string typeName = docObj.GetType().Name;
      switch (typeName)
      {
        case "Text":
          if (IsBlank(docObj))
            RenderBlank();
          else if (IsSoftHyphen(docObj))
            RenderSoftHyphen();
          else
            RenderText((Text)docObj);
          break;

        case "Character":
          RenderCharacter((Character)docObj);
          break;

        case "DateField":
          RenderDateField((DateField)docObj);
          break;

        case "InfoField":
          RenderInfoField((InfoField)docObj);
          break;

        case "NumPagesField":
          RenderNumPagesField((NumPagesField)docObj);
          break;

        case "PageField":
          RenderPageField((PageField)docObj);
          break;

        case "SectionField":
          RenderSectionField((SectionField)docObj);
          break;

        case "SectionPagesField":
          RenderSectionPagesField((SectionPagesField)docObj);
          break;

        case "BookmarkField":
          RenderBookmarkField();
          break;

        case "PageRefField":
          RenderPageRefField((PageRefField)docObj);
          break;

        case "Image":
          RenderImage((Image)docObj);
          break;
        //        default:
        //          throw new NotImplementedException(typeName + " is coming soon...");
      }
    }
開發者ID:DavidS,項目名稱:MigraDoc,代碼行數:57,代碼來源:ParagraphRenderer.cs

示例2: ParentAlreadySet

 public static string ParentAlreadySet(DocumentObject value, DocumentObject docObject)
 {
     return String.Format("Value of type '{0}' must be cloned before set into '{1}'.",
     value.GetType().ToString(), docObject.GetType().ToString());
 }
開發者ID:dankennedy,項目名稱:MigraDoc,代碼行數:5,代碼來源:DomSR.cs

示例3: FormatElement

    /// <summary>
    /// Processes the elements when formatting.
    /// </summary>
    /// <param name="docObj"></param>
    /// <returns></returns>
    FormatResult FormatElement(DocumentObject docObj)
    {
      switch (docObj.GetType().Name)
      {
        case "Text":
          if (IsBlank(docObj))
            return FormatBlank();
          else if (IsSoftHyphen(docObj))
            return FormatSoftHyphen();
          else
            return FormatText((Text)docObj);

        case "Character":
          return FormatCharacter((Character)docObj);

        case "DateField":
          return FormatDateField((DateField)docObj);

        case "InfoField":
          return FormatInfoField((InfoField)docObj);

        case "NumPagesField":
          return FormatNumPagesField((NumPagesField)docObj);

        case "PageField":
          return FormatPageField((PageField)docObj);

        case "SectionField":
          return FormatSectionField((SectionField)docObj);

        case "SectionPagesField":
          return FormatSectionPagesField((SectionPagesField)docObj);

        case "BookmarkField":
          return FormatBookmarkField((BookmarkField)docObj);

        case "PageRefField":
          return FormatPageRefField((PageRefField)docObj);

        case "Image":
          return FormatImage((Image)docObj);

        default:
          return FormatResult.Continue;
      }
    }
開發者ID:DavidS,項目名稱:MigraDoc,代碼行數:51,代碼來源:ParagraphRenderer.cs

示例4: CreateRenderer

    /// <summary>
    /// Dynamically creates a renderer for the given document object.
    /// </summary>
    internal static RendererBase CreateRenderer(DocumentObject domObj, RtfDocumentRenderer docRenderer)
    {
      switch (domObj.GetType().Name)
      {
        case "Style":
          return new StyleRenderer(domObj, docRenderer);

        case "ParagraphFormat":
          return new ParagraphFormatRenderer(domObj, docRenderer);

        case "Font":
          return new FontRenderer(domObj, docRenderer);

        case "Borders":
          return new BordersRenderer(domObj, docRenderer);

        case "Border":
          return new BorderRenderer(domObj, docRenderer);

        case "TabStops":
          return new TabStopsRenderer(domObj, docRenderer);

        case "TabStop":
          return new TabStopRenderer(domObj, docRenderer);

        case "Section":
          return new SectionRenderer(domObj, docRenderer);

        case "PageSetup":
          return new PageSetupRenderer(domObj, docRenderer);

        case "Paragraph":
          return new ParagraphRenderer(domObj, docRenderer);

        case "Text":
          return new TextRenderer(domObj, docRenderer);

        case "FormattedText":
          return new FormattedTextRenderer(domObj, docRenderer);

        case "Character":
          return new CharacterRenderer(domObj, docRenderer);
        //Fields start
        case "BookmarkField":
          return new BookmarkFieldRenderer(domObj, docRenderer);

        case "PageField":
          return new PageFieldRenderer(domObj, docRenderer);

        case "PageRefField":
          return new PageRefFieldRenderer(domObj, docRenderer);

        case "NumPagesField":
          return new NumPagesFieldRenderer(domObj, docRenderer);

        case "SectionField":
          return new SectionFieldRenderer(domObj, docRenderer);

        case "SectionPagesField":
          return new SectionPagesFieldRenderer(domObj, docRenderer);

        case "InfoField":
          return new InfoFieldRenderer(domObj, docRenderer);

        case "DateField":
          return new DateFieldRenderer(domObj, docRenderer);
        //Fields end
        case "Hyperlink":
          return new HyperlinkRenderer(domObj, docRenderer);

        case "Footnote":
          return new FootnoteRenderer(domObj, docRenderer);

        case "ListInfo":
          return new ListInfoRenderer(domObj, docRenderer);

        case "Image":
          return new ImageRenderer(domObj, docRenderer);

        case "TextFrame":
          return new TextFrameRenderer(domObj, docRenderer);

        case "Chart":
          return new ChartRenderer(domObj, docRenderer);

        case "HeadersFooters":
          return new HeadersFootersRenderer(domObj, docRenderer);

        case "HeaderFooter":
          return new HeaderFooterRenderer(domObj, docRenderer);

        case "PageBreak":
          return new PageBreakRenderer(domObj, docRenderer);
        //Table
        case "Table":
          return new TableRenderer(domObj, docRenderer);

//.........這裏部分代碼省略.........
開發者ID:GorelH,項目名稱:PdfSharp,代碼行數:101,代碼來源:RendererFactory.cs


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