Condividi tramite


ITextDocument Interface

Represents a document in the file system that persists an ITextBuffer.

Namespace:  Microsoft.VisualStudio.Text
Assembly:  Microsoft.VisualStudio.Text.Data (in Microsoft.VisualStudio.Text.Data.dll)

Syntax

'Dichiarazione
Public Interface ITextDocument _
    Inherits IDisposable
public interface ITextDocument : IDisposable
public interface class ITextDocument : IDisposable
type ITextDocument =  
    interface
        interface IDisposable
    end
public interface ITextDocument extends IDisposable

The ITextDocument type exposes the following members.

Properties

  Name Description
Public property Encoding Gets or sets the encoding of the document when saved to disk.
Public property FilePath The name and path of the file.
Public property IsDirty Determines whether the ITextBuffer is dirty.
Public property IsReloading Determines whether the Reload method is executing.
Public property LastContentModifiedTime Gets the last DateTime a change was made to the contents of the ITextBuffer.
Public property LastSavedTime Gets the last DateTime the file was saved. This time exactly matches the last file written time on the file system.
Public property TextBuffer Gets the ITextBuffer containing the document. This value is always non-null.

Top

Methods

  Name Description
Public method Dispose Performs application-defined tasks associated with freeing, releasing, or resetting unmanaged resources. (Inherited from IDisposable.)
Public method Reload() Reloads the contents of FilePath into a TextBuffer.
Public method Reload(EditOptions) Reloads the contents of FilePath into TextBuffer, using the given EditOptions.
Public method Rename Rename the document to the given new file path.
Public method Save Saves the contents of the TextBuffer to the FilePath.
Public method SaveAs(String, Boolean) Saves the contents of the TextBuffer to the specified file path.
Public method SaveAs(String, Boolean, IContentType) Saves the contents of the TextBuffer to the specified file path.
Public method SaveAs(String, Boolean, Boolean) Saves the contents of the TextBuffer to the specified file path.
Public method SaveAs(String, Boolean, Boolean, IContentType) Saves the contents of the TextBuffer to the specified file path.
Public method SaveCopy(String, Boolean) Saves the contents of the TextBuffer to the given filePath.
Public method SaveCopy(String, Boolean, Boolean) Saves the contents of the TextBuffer to the specified file path.
Public method SetEncoderFallback Change the encoder fallback of Encoding.
Public method UpdateDirtyState Updates the IsDirty and LastContentModifiedTime properties.

Top

Events

  Name Description
Public event DirtyStateChanged Occurs when the value of IsDirty changes.
Public event EncodingChanged Occurs when the Encoding property changes.
Public event FileActionOccurred Occurs when the document has been loaded from or saved to disk.

Top

See Also

Reference

Microsoft.VisualStudio.Text Namespace