Class DocumentVisitor
이름 공간 : Aspose.Note 모임: Aspose.Note.dll (25.4.0)
지정된 노드에 뿌리가있는 지하 나무를 통해 이테레이션을위한 추상 클래스.
public abstract class DocumentVisitor
Inheritance
상속 회원들
object.GetType() , object.MemberwiseClone() , object.ToString() , object.Equals(object?) , object.Equals(object?, object?) , object.ReferenceEquals(object?, object?) , object.GetHashCode()
Examples
방문자를 사용하여 문서의 콘텐츠에 액세스하는 방법을 보여줍니다.
public static void Run()
{
// The path to the documents directory.
string dataDir = RunExamples.GetDataDir_LoadingAndSaving();
// Open the document we want to convert.
Document doc = new Document(dataDir + "Aspose.one");
// Create an object that inherits from the DocumentVisitor class.
MyOneNoteToTxtWriter myConverter = new MyOneNoteToTxtWriter();
// This is the well known Visitor pattern. Get the model to accept a visitor.
// The model will iterate through itself by calling the corresponding methods
// on the visitor object (this is called visiting).
//
// Note that every node in the object model has the Accept method so the visiting
// can be executed not only for the whole document, but for any node in the document.
doc.Accept(myConverter);
// Once the visiting is complete, we can retrieve the result of the operation,
// that in this example, has accumulated in the visitor.
Console.WriteLine(myConverter.GetText());
Console.WriteLine(myConverter.NodeCount);
}
/// <summary>
/// Simple implementation of saving a document in the plain text format. Implemented as a Visitor.
/// </summary>
public class MyOneNoteToTxtWriter : DocumentVisitor
{
public MyOneNoteToTxtWriter()
{
nodecount = 0;
mIsSkipText = false;
mBuilder = new StringBuilder();
}
/// <summary>
/// Gets the plain text of the document that was accumulated by the visitor.
/// </summary>
public string GetText()
{
return mBuilder.ToString();
}
/// <summary>
/// Adds text to the current output. Honors the enabled/disabled output flag.
/// </summary>
private void AppendText(string text)
{
if (!mIsSkipText)
{
mBuilder.AppendLine(text);
}
}
/// <summary>
/// Called when a RichText node is encountered in the document.
/// </summary>
public override void VisitRichTextStart(RichText run)
{
++nodecount;
AppendText(run.Text);
}
/// <summary>
/// Called when a Document node is encountered in the document.
/// </summary>
public override void VisitDocumentStart(Document document)
{
++nodecount;
}
/// <summary>
/// Called when a Page node is encountered in the document.
/// </summary>
public override void VisitPageStart(Page page)
{
++nodecount;
this.AppendText($"*** Page '{page.Title?.TitleText?.Text ?? "(no title)"}' ***");
}
/// <summary>
/// Called when processing of a Page node is finished.
/// </summary>
public override void VisitPageEnd(Page page)
{
this.AppendText(string.Empty);
}
/// <summary>
/// Called when a Title node is encountered in the document.
/// </summary>
public override void VisitTitleStart(Title title)
{
++nodecount;
}
/// <summary>
/// Called when a Image node is encountered in the document.
/// </summary>
public override void VisitImageStart(Image image)
{
++nodecount;
}
/// <summary>
/// Called when a OutlineGroup node is encountered in the document.
/// </summary>
public override void VisitOutlineGroupStart(OutlineGroup outlineGroup)
{
++nodecount;
}
/// <summary>
/// Called when a Outline node is encountered in the document.
/// </summary>
public override void VisitOutlineStart(Outline outline)
{
++nodecount;
}
/// <summary>
/// Called when a OutlineElement node is encountered in the document.
/// </summary>
public override void VisitOutlineElementStart(OutlineElement outlineElement)
{
++nodecount;
}
/// <summary>
/// Gets the total count of nodes by the Visitor
/// </summary>
public Int32 NodeCount
{
get { return this.nodecount; }
}
private readonly StringBuilder mBuilder;
private bool mIsSkipText;
private Int32 nodecount;
}
Constructors
DocumentVisitor()
protected DocumentVisitor()
Methods
VisitAttachedFileEnd(AttachedFile)
Aspose.Note.AttachedFile 노드를 방문하십시오.
public virtual void VisitAttachedFileEnd(AttachedFile attachedFile)
Parameters
attachedFile
AttachedFile
WL31_.AttachedFile 노드에 해당되는 글 1건
VisitAttachedFileStart(AttachedFile)
Aspose.Note.AttachedFile 노드를 방문하기 시작합니다.
public virtual void VisitAttachedFileStart(AttachedFile attachedFile)
Parameters
attachedFile
AttachedFile
WL31_.AttachedFile 노드에 해당되는 글 1건
VisitDocumentEnd(Document)
WL31.Document 노드를 방문하기 시작합니다.
public virtual void VisitDocumentEnd(Document document)
Parameters
document
Document
_WL31 _ 문서 노드.
VisitDocumentStart(Document)
WL31.Document 노드를 방문하기 시작합니다.
public virtual void VisitDocumentStart(Document document)
Parameters
document
Document
_WL31 _ 문서 노드.
VisitImageEnd(Image)
WL31.Image 노드를 방문하기 시작합니다.
public virtual void VisitImageEnd(Image image)
Parameters
image
Image
_WL31 _ 이미지 노드
VisitImageStart(Image)
WL31.Image 노드를 방문하기 시작합니다.
public virtual void VisitImageStart(Image image)
Parameters
image
Image
_WL31 _ 이미지 노드
VisitInkDrawingEnd(InkDrawing)
WL31_.InkDrawing 노드를 방문하기 시작합니다.
public virtual void VisitInkDrawingEnd(InkDrawing inkDrawing)
Parameters
inkDrawing
InkDrawing
WL31.InkDrawing 노드에 해당되는 글 1건
VisitInkDrawingStart(InkDrawing)
WL31_.InkDrawing 노드를 방문하기 시작합니다.
public virtual void VisitInkDrawingStart(InkDrawing inkDrawing)
Parameters
inkDrawing
InkDrawing
WL31.InkDrawing 노드에 해당되는 글 1건
VisitInkParagraphEnd(InkParagraph)
WL31_.InkParagraph 노드를 방문하기 시작합니다.
public virtual void VisitInkParagraphEnd(InkParagraph inkParagraph)
Parameters
inkParagraph
InkParagraph
WL31_.InkParagraph 노드에 해당되는 글 1건
VisitInkParagraphStart(InkParagraph)
시작하여 Aspose.Note.InkParagraph 노드를 방문합니다.
public virtual void VisitInkParagraphStart(InkParagraph inkParagraph)
Parameters
inkParagraph
InkParagraph
WL31_.InkParagraph 노드에 해당되는 글 1건
VisitInkWordEnd(InkWord)
WL31.InkWord 노드를 방문하기 시작합니다.
public virtual void VisitInkWordEnd(InkWord inkWord)
Parameters
inkWord
InkWord
WL31.InkWord 노드에 해당되는 글 1건
VisitInkWordStart(InkWord)
WL31.InkWord 노드를 방문하기 시작합니다.
public virtual void VisitInkWordStart(InkWord inkWord)
Parameters
inkWord
InkWord
WL31.InkWord 노드에 해당되는 글 1건
VisitLoopEnd(Loop)
WL31.Loop 노드를 방문하기 시작합니다.
public virtual void VisitLoopEnd(Loop loop)
Parameters
loop
Loop
_WL31 _.Loop 노드에 대한 자세한 내용
VisitLoopStart(Loop)
WL31.Loop 노드를 방문하기 시작합니다.
public virtual void VisitLoopStart(Loop loop)
Parameters
loop
Loop
_WL31 _.Loop 노드에 대한 자세한 내용
VisitOutlineElementEnd(OutlineElement)
WL31_.OutlineElement 노드를 방문하십시오.
public virtual void VisitOutlineElementEnd(OutlineElement outlineElement)
Parameters
outlineElement
OutlineElement
WL31_.OutlineElement 노드에 해당되는 글 1건
VisitOutlineElementStart(OutlineElement)
WL31_.OutlineElement 노드를 방문하기 시작합니다.
public virtual void VisitOutlineElementStart(OutlineElement outlineElement)
Parameters
outlineElement
OutlineElement
WL31_.OutlineElement 노드에 해당되는 글 1건
VisitOutlineEnd(Outline)
WL31_.Outline 노드를 방문하기 시작합니다.
public virtual void VisitOutlineEnd(Outline outline)
Parameters
outline
Outline
_WL31 _ 오트라인 노드
VisitOutlineGroupEnd(OutlineGroup)
WL31_.OutlineGroup 노드를 방문하십시오.
public virtual void VisitOutlineGroupEnd(OutlineGroup outlineGroup)
Parameters
outlineGroup
OutlineGroup
WL31_.OutlineGroup 노드에 해당되는 글 1건
VisitOutlineGroupStart(OutlineGroup)
WL31_.OutlineGroup 노드를 방문하기 시작합니다.
public virtual void VisitOutlineGroupStart(OutlineGroup outlineGroup)
Parameters
outlineGroup
OutlineGroup
WL31_.OutlineGroup 노드에 해당되는 글 1건
VisitOutlineStart(Outline)
WL31_.Outline 노드를 방문하기 시작합니다.
public virtual void VisitOutlineStart(Outline outline)
Parameters
outline
Outline
_WL31 _ 오트라인 노드
VisitPageEnd(Page)
WL31.Page 노드를 방문하기 시작합니다.
public virtual void VisitPageEnd(Page page)
Parameters
page
Page
_WL31 _ 페이지 노드
VisitPageStart(Page)
WL31.Page 노드를 방문하기 시작합니다.
public virtual void VisitPageStart(Page page)
Parameters
page
Page
_WL31 _ 페이지 노드
VisitRichTextEnd(RichText)
WL31_.RichText 노드를 방문하기 시작합니다.
public virtual void VisitRichTextEnd(RichText richText)
Parameters
richText
RichText
WL31.RichText 노드에 해당되는 글 1건
VisitRichTextStart(RichText)
WL31_.RichText 노드를 방문하기 시작합니다.
public virtual void VisitRichTextStart(RichText richText)
Parameters
richText
RichText
WL31.RichText 노드에 해당되는 글 1건
VisitTableCellEnd(TableCell)
WL31_.TableCell 노드를 방문하기 시작합니다.
public virtual void VisitTableCellEnd(TableCell tableCell)
Parameters
tableCell
TableCell
WL31.TableCell 노드에 해당되는 글 1건
VisitTableCellStart(TableCell)
WL31_.TableCell 노드를 방문하기 시작합니다.
public virtual void VisitTableCellStart(TableCell tableCell)
Parameters
tableCell
TableCell
WL31.TableCell 노드에 해당되는 글 1건
VisitTableEnd(Table)
WL31. 테이블 노드를 방문하기 시작합니다.
public virtual void VisitTableEnd(Table table)
Parameters
table
Table
_WL31 _ 테이블 노드
VisitTableRowEnd(TableRow)
WL31_.TableRow 노드를 방문하기 시작합니다.
public virtual void VisitTableRowEnd(TableRow tableRow)
Parameters
tableRow
TableRow
WL31.TableRow 노드에 해당되는 글 1건
VisitTableRowStart(TableRow)
WL31_.TableRow 노드를 방문하기 시작합니다.
public virtual void VisitTableRowStart(TableRow tableRow)
Parameters
tableRow
TableRow
WL31.TableRow 노드에 해당되는 글 1건
VisitTableStart(Table)
WL31. 테이블 노드를 방문하기 시작합니다.
public virtual void VisitTableStart(Table table)
Parameters
table
Table
_WL31 _ 테이블 노드
VisitTitleEnd(Title)
WL31.Title 노드를 방문하기 시작합니다.
public virtual void VisitTitleEnd(Title title)
Parameters
title
Title
_WL31 _. 타이틀 노드
VisitTitleStart(Title)
WL31.Title 노드를 방문하기 시작합니다.
public virtual void VisitTitleStart(Title title)
Parameters
title
Title
_WL31 _. 타이틀 노드