Class DocumentVisitor

Class DocumentVisitor

Tên không gian: Aspose.Note Tổng hợp: Aspose.Note.dll (25.4.0)

Lớp trừu tượng cho iterating thông qua tầng hầm với rễ ở nút được chỉ định.

public abstract class DocumentVisitor
   {
      public abstract void Visit(Document document);
      public void Visit(Table table)
      {
      }
      public void Visit(Cell cell)
      {
      }
      public void Visit(Row row)
      {
      }
      public void Visit(Section section)
      {
      }
      public void Visit(Paragraph paragraph)
      {
      }
      public void Visit(Run run)
      {
      }
   }

Inheritance

object DocumentVisitor

Thành viên thừa kế

object.GetType() , object.MemberwiseClone() , object.ToString() , object.Equals(object?) , object.Equals(object?, object?) , object.ReferenceEquals(object?, object?) , object.GetHashCode()

Examples

Hiển thị cách truy cập nội dung của một tài liệu bằng cách sử dụng khách.

public static void Run()
{
    string dataDir = RunExamples.GetDataDir_LoadingAndSaving();
    Document doc = new Document(dataDir + "Aspose.one");
    MyOneNoteToTxtWriter myConverter = new MyOneNoteToTxtWriter();
    doc.Accept(myConverter);
    Console.WriteLine(myConverter.GetText());
    Console.WriteLine(myConverter.NodeCount);
}
public class MyOneNoteToTxtWriter : DocumentVisitor
{
    public MyOneNoteToTxtWriter()
    {
        nodecount = 0;
        mIsSkipText = false;
        mBuilder = new StringBuilder();
    }
    public string GetText()
    {
        return mBuilder.ToString();
    }
    private void AppendText(string text)
    {
        if (!mIsSkipText)
        {
            mBuilder.AppendLine(text);
        }
    }
    public override void VisitRichTextStart(RichText run)
    {
        ++nodecount;
        AppendText(run.Text);
    }
    public override void VisitDocumentStart(Document document)
    {
        ++nodecount;
    }
    public override void VisitPageStart(Page page)
    {
        ++nodecount;
        AppendText($"*** Page '{page.Title?.TitleText?.Text ?? "(no title)"}' ***");
    }
    public override void VisitPageEnd(Page page)
    {
        AppendText(string.Empty);
    }
    public override void VisitTitleStart(Title title)
    {
        ++nodecount;
    }
    public override void VisitImageStart(Image image)
    {
        ++nodecount;
    }
    public override void VisitOutlineGroupStart(OutlineGroup outlineGroup)
    {
        ++nodecount;
    }
    public override void VisitOutlineStart(Outline outline)
    {
        ++nodecount;
    }
    public override void VisitOutlineElementStart(OutlineElement outlineElement)
    {
        ++nodecount;
    }
    public Int32 NodeCount
    {
        get { return this.nodecount; }
    }
    private readonly StringBuilder mBuilder;
    private bool mIsSkipText;
    private int nodecount;
}

Constructors

Tài liệuVisitor()

protected DocumentVisitor()
   {
   }

Methods

Kết quả tìm kiếm (AttachedFile)

Kết thúc để truy cập Aspose.Note.AttachedFile nút.

public virtual void VisitAttachedFileEnd(Aspose.Words.AttachedFile attachedFile)
   {
   }

Parameters

attachedFile AttachedFile

Các Aspose.Note.AttachedFile nút.

Truy cậpAttachedFileStart(Addit)

Bắt đầu để truy cập Aspose.Note.AttachedFile nút.

public virtual void VisitAttachedFileStart(Aspose.Words.AttachedFile attachedFile)
   {
   }

Parameters

attachedFile AttachedFile

Các Aspose.Note.AttachedFile nút.

VisitDocumentEnd (Nhạc Chuông)

Kết thúc để truy cập Aspose.Note.Document node.

public virtual void VisitDocumentEnd(Aspose.Words.Document document)
   {
   }

Parameters

document Document

Các Aspose.Note.Document node.

VisitDocumentStart (Nhạc Chuông)

Bắt đầu để truy cập Aspose.Note.Document node.

public override void VisitDocumentStart(Document document)
   {
   }

Parameters

document Document

Các Aspose.Note.Document node.

VisitImageEnd (Ảnh minh họa)

Kết thúc để truy cập Aspose.Note.Image node.

public virtual void VisitImageEnd(Aspose.Words.Image image)
   {
   }

Parameters

image Image

Các Aspose.Note.Image node.

VisitImageStart (Ảnh minh họa)

Bắt đầu để truy cập Aspose.Note.Image node.

public virtual void VisitImageStart(Aspose.Words.CheckBox image)
   {
   }

Parameters

image Image

Các Aspose.Note.Image node.

Hướng dẫn cài đặt (InkDrawing)

Kết thúc để truy cập Aspose.Note.InkDrawing nút.

public virtual void VisitInkDrawingEnd(InkDrawing inkDrawing)
   {
   }

Parameters

inkDrawing InkDrawing

Các Aspose.Note.InkDrawing nút.

Hướng dẫn cài đặt (InkDrawing)

Bắt đầu để truy cập Aspose.Note.InkDrawing nút.

public virtual void VisitInkDrawingStart(Aspose.Words.CheckBox inkDrawing)
   {
   }

Parameters

inkDrawing InkDrawing

Các Aspose.Note.InkDrawing nút.

Thảo luận (InkParagraph)

Kết thúc để truy cập vào nút Aspose.Note.InkParagraph.

public virtual void VisitInkParagraphEnd(InkParagraph inkParagraph)
   {
   }

Parameters

inkParagraph InkParagraph

Các Aspose.Note.InkParagraph nút.

Hướng dẫn cài đặt (InkParagraph)

Bắt đầu để truy cập Aspose.Note.InkParagraph nút.

public virtual void VisitInkParagraphStart(InkParagraph inkParagraph)
   {
   }

Parameters

inkParagraph InkParagraph

Các Aspose.Note.InkParagraph nút.

Kết quả tìm kiếm (InkWord)

Kết thúc để truy cập Aspose.Note.InkWord nút.

public virtual void VisitInkWordEnd(InkWord inkWord)
   {
   }

Parameters

inkWord InkWord

Đánh giá về Aspose.Note.InkWord

Hướng dẫn cài đặt (InkWord)

Bắt đầu để truy cập Aspose.Note.InkWord nút.

public virtual void VisitInkWordStart(InkWord inkWord)
   {
   }

Parameters

inkWord InkWord

Đánh giá về Aspose.Note.InkWord

Lời bài hát: Loop (Loop)

Kết thúc để truy cập Aspose.Note.Loop node.

public virtual void VisitLoopEnd(Loop loop)
   {
   }

Parameters

loop Loop

Các Aspose.Note.Loop nút.

Khởi nghiệp (Loop)

Bắt đầu để truy cập Aspose.Note.Loop nút.

public virtual void VisitLoopStart(Loop loop)
   {
   }

Parameters

loop Loop

Các Aspose.Note.Loop nút.

Nhãn hiệu: VisitOutlineElementEnd

Kết thúc để truy cập Aspose.Note.OutlineElement nút.

public virtual void VisitOutlineElementEnd(OutlineElement outlineElement)
   {
   }

Parameters

outlineElement OutlineElement

Các Aspose.Note.OutlineElement nút.

Hướng dẫn cài đặt Outline Element (OutlineElement)

Bắt đầu để truy cập Aspose.Note.OutlineElement nút.

public virtual void VisitOutlineElementStart(Aspose.Words.OutlineElement outlineElement)
   {
   }

Parameters

outlineElement OutlineElement

Các Aspose.Note.OutlineElement nút.

Hướng dẫn sử dụng Outline (Outline)

Kết thúc để truy cập Aspose.Note.Outline nút.

public virtual void VisitOutlineEnd(Aspose.Words.Outline outline)
   {
   }

Parameters

outline Outline

Các Aspose.Note.Outline nút.

Đánh giá về OutlineGroup (Outline)

Kết thúc để truy cập Aspose.Note.OutlineGroup nút.

public virtual void VisitOutlineGroupEnd(Aspose.Words.OutlineGroup outlineGroup)
   {
   }

Parameters

outlineGroup OutlineGroup

Các Aspose.Note.OutlineGroup nút.

Hướng dẫn cài đặt OutlineGroupStart

Bắt đầu để truy cập Aspose.Note.OutlineGroup nút.

public virtual void VisitOutlineGroupStart(Aspose.Words.OutlineGroup outlineGroup)
   {
   }

Parameters

outlineGroup OutlineGroup

Các Aspose.Note.OutlineGroup nút.

Hướng dẫn cài đặt Outline (Outline)

Bắt đầu để truy cập Aspose.Note.Outline nút.

public virtual void VisitOutlineStart(Aspose.Words.CheckBox outline)
   {
   }

Parameters

outline Outline

Các Aspose.Note.Outline nút.

Vị trí (Page End)

Kết thúc để truy cập Aspose.Note.Page node.

public override void VisitPageEnd(Aspose.Words.DocumentObject o, Aspose.Words.Page page)
   {
   }

Parameters

page Page

Các Aspose.Note.Page nút.

Khởi nghiệp (Page)

Bắt đầu để truy cập Aspose.Note.Page node.

public virtual void VisitPageStart(Page page)
   {
   }

Parameters

page Page

Các Aspose.Note.Page nút.

Trang chủ (RichText)

Kết thúc để truy cập Aspose.Note.RichText nút.

public virtual void VisitRichTextEnd(Aspose.Words.RichText richText)
   {
   }

Parameters

richText RichText

Các Aspose.Note.RichText nút.

Hướng dẫn cài đặt (RichText)

Bắt đầu để truy cập Aspose.Note.RichText nút.

public virtual void VisitRichTextStart(Aspose.Words.RichText richText)
   {
   }

Parameters

richText RichText

Các Aspose.Note.RichText nút.

Bảng xếp hạng (TableCell)

Kết thúc để truy cập Aspose.Note.TableCell nút.

public virtual void VisitTableCellEnd(TableCell tableCell)
   {
   }

Parameters

tableCell TableCell

Đánh giá về Aspose.Note.TableCell

Hướng dẫn cài đặt (TableCell)

Bắt đầu để truy cập Aspose.Note.TableCell nút.

public virtual void VisitTableCellStart(TableCell tableCell)
   {
   }

Parameters

tableCell TableCell

Đánh giá về Aspose.Note.TableCell

Lời bài hát: VisitTableEnd

Kết thúc để truy cập vào Aspose.Note.Table node.

public virtual void VisitTableEnd(Table table)
   {
   }

Parameters

table Table

Các Aspose.Note.Nút bảng.

Bảng xếp hạng (TableRow)

Kết thúc để truy cập Aspose.Note.TableRow nút.

public virtual void VisitTableRowEnd(TableRow tableRow)
   {
   }

Parameters

tableRow TableRow

Các nút Aspose.Note.TableRow.

Hướng dẫn cài đặt (TableRow)

Bắt đầu để truy cập Aspose.Note.TableRow nút.

public virtual void VisitTableRowStart(TableRow tableRow)
   {
   }

Parameters

tableRow TableRow

Các nút Aspose.Note.TableRow.

Lời bài hát: VisitTableStart

Bắt đầu để truy cập Aspose.Note.Table node.

public virtual void VisitTableStart(Table table)
   {
   }

Parameters

table Table

Các Aspose.Note.Nút bảng.

Danh sách (Title End)

Kết thúc để truy cập Aspose.Note.Title node.

public virtual void VisitTitleEnd(Aspose.Words.Title title)
   {
   }

Parameters

title Title

Đánh giá về ASPOSE.Note.Title

Đánh giá (Title)

Bắt đầu bằng cách truy cập Aspose.Note.Title node.

public virtual void VisitTitleStart(Title title)
   {
   }

Parameters

title Title

Đánh giá về ASPOSE.Note.Title

 Tiếng Việt