EditPoint.SmartFormat(TextPoint) Method
Definition
Important
Some information relates to prerelease product that may be substantially modified before it’s released. Microsoft makes no warranties, express or implied, with respect to the information provided here.
Formats the specified range of text based on the current language.
public:
void SmartFormat(EnvDTE::TextPoint ^ Point);
public:
void SmartFormat(EnvDTE::TextPoint ^ Point);
void SmartFormat(EnvDTE::TextPoint const & Point);
[System.Runtime.InteropServices.DispId(163)]
public void SmartFormat (EnvDTE.TextPoint Point);
[<System.Runtime.InteropServices.DispId(163)>]
abstract member SmartFormat : EnvDTE.TextPoint -> unit
Public Sub SmartFormat (Point As TextPoint)
Parameters
- Attributes
Examples
Sub SmartFormatExample()
Dim objTextDoc As TextDocument
Dim objMovePt As EditPoint
Dim objEditPt As EditPoint, iCtr As Integer
' Create a new text file.
DTE.ItemOperations.NewFile("General\Text File")
' Get a handle to the new document and create an EditPoint.
objTextDoc = DTE.ActiveDocument.Object("TextDocument")
objMovePt = objTextDoc.EndPoint.CreateEditPoint
objEditPt = objTextDoc.StartPoint.CreateEditPoint
' Insert ten lines of text.
For iCtr = 1 To 10
objEditPt.Insert("This is a test." & Chr(13))
Next iCtr
objEditPt.StartOfDocument()
objMovePt.EndOfDocument()
objEditPt.SmartFormat(objMovePt)
End Sub
Remarks
Smart formatting is autoformatting of code done by the particular language. The edit point and Point
are the boundaries for smart formatting. You can select smart formatting options separately for each language under the Text Editor node in the Options dialog box on the Tools menu.
The reformatting includes the lines containing the endpoints and adheres to global settings for smart formatting style (vsSmartFormatOptions).