ITextDocumentFactoryService.CreateAndLoadTextDocument Method

Definition

Overloads

CreateAndLoadTextDocument(String, IContentType)

Creates an ITextDocument that opens and loads the contents of filePath into a new ITextBuffer.

CreateAndLoadTextDocument(String, IContentType, Boolean, Boolean)

Creates an ITextDocument that opens and loads the contents of filePath into a new ITextBuffer.

CreateAndLoadTextDocument(String, IContentType, Encoding, Boolean)

Creates an ITextDocument that opens and loads the contents of filePath into a new ITextBuffer.

CreateAndLoadTextDocument(String, IContentType)

Creates an ITextDocument that opens and loads the contents of filePath into a new ITextBuffer.

public:
 Microsoft::VisualStudio::Text::ITextDocument ^ CreateAndLoadTextDocument(System::String ^ filePath, Microsoft::VisualStudio::Utilities::IContentType ^ contentType);
public Microsoft.VisualStudio.Text.ITextDocument CreateAndLoadTextDocument (string filePath, Microsoft.VisualStudio.Utilities.IContentType contentType);
abstract member CreateAndLoadTextDocument : string * Microsoft.VisualStudio.Utilities.IContentType -> Microsoft.VisualStudio.Text.ITextDocument
Public Function CreateAndLoadTextDocument (filePath As String, contentType As IContentType) As ITextDocument

Parameters

filePath
String

The full path to the file to be loaded.

contentType
IContentType

The IContentType for the ITextBuffer.

Returns

An ITextDocument.

Exceptions

filePath or contentType is null.

Remarks

This method is equivalent to CreateAndLoadTextDocument(filePath, contentType, true, out unusedBoolean).

Large files will use compressed storage.

Applies to

CreateAndLoadTextDocument(String, IContentType, Boolean, Boolean)

Creates an ITextDocument that opens and loads the contents of filePath into a new ITextBuffer.

public:
 Microsoft::VisualStudio::Text::ITextDocument ^ CreateAndLoadTextDocument(System::String ^ filePath, Microsoft::VisualStudio::Utilities::IContentType ^ contentType, bool attemptUtf8Detection, [Runtime::InteropServices::Out] bool % characterSubstitutionsOccurred);
public Microsoft.VisualStudio.Text.ITextDocument CreateAndLoadTextDocument (string filePath, Microsoft.VisualStudio.Utilities.IContentType contentType, bool attemptUtf8Detection, out bool characterSubstitutionsOccurred);
abstract member CreateAndLoadTextDocument : string * Microsoft.VisualStudio.Utilities.IContentType * bool * bool -> Microsoft.VisualStudio.Text.ITextDocument
Public Function CreateAndLoadTextDocument (filePath As String, contentType As IContentType, attemptUtf8Detection As Boolean, ByRef characterSubstitutionsOccurred As Boolean) As ITextDocument

Parameters

filePath
String

The full path to the file to be loaded.

contentType
IContentType

The IContentType for the ITextBuffer.

attemptUtf8Detection
Boolean

Whether to attempt to load the document as a UTF-8 file.

characterSubstitutionsOccurred
Boolean

Set to true if some of the file bytes could not be directly translated using the given encoding.

Returns

An ITextDocument.

Exceptions

filePath or contentType is null.

Remarks

Large files will use compressed storage.

Applies to

CreateAndLoadTextDocument(String, IContentType, Encoding, Boolean)

Creates an ITextDocument that opens and loads the contents of filePath into a new ITextBuffer.

public:
 Microsoft::VisualStudio::Text::ITextDocument ^ CreateAndLoadTextDocument(System::String ^ filePath, Microsoft::VisualStudio::Utilities::IContentType ^ contentType, System::Text::Encoding ^ encoding, [Runtime::InteropServices::Out] bool % characterSubstitutionsOccurred);
public Microsoft.VisualStudio.Text.ITextDocument CreateAndLoadTextDocument (string filePath, Microsoft.VisualStudio.Utilities.IContentType contentType, System.Text.Encoding encoding, out bool characterSubstitutionsOccurred);
abstract member CreateAndLoadTextDocument : string * Microsoft.VisualStudio.Utilities.IContentType * System.Text.Encoding * bool -> Microsoft.VisualStudio.Text.ITextDocument
Public Function CreateAndLoadTextDocument (filePath As String, contentType As IContentType, encoding As Encoding, ByRef characterSubstitutionsOccurred As Boolean) As ITextDocument

Parameters

filePath
String

The full path to the file to be loaded.

contentType
IContentType

The IContentType for the ITextBuffer.

encoding
Encoding

The encoding to use. The decoder part of the Encoding object won't be used.

characterSubstitutionsOccurred
Boolean

Set to true if some of the file bytes could not be directly translated using the given encoding.

Returns

An ITextDocument.

Exceptions

filePath, contentType, or encoding is null.

Remarks

Large files will use compressed storage.

Applies to