TextSelection.SmartFormat Method
Formats the selected lines of text based on the current language.
Namespace: EnvDTE
Assembly: EnvDTE (in EnvDTE.dll)
Syntax
'Declaration
Sub SmartFormat
void SmartFormat()
void SmartFormat()
abstract SmartFormat : unit -> unit
function SmartFormat()
Remarks
Re-indents or formats the text selection, including the lines the anchor and active ends are on, according to global settings for smart indenting. SmartFormat causes the selection to include the complete lines at the ends.
Examples
Sub SmartFormatExample()
' Before running this example, open a code document.
Dim objSel As TextSelection = DTE.ActiveDocument.Selection
' Select all code in open document.
objSel.SelectAll()
' Apply smart formatting rules for the language.
objSel.SmartFormat()
End Sub
.NET Framework Security
- Full trust for the immediate caller. This member cannot be used by partially trusted code. For more information, see Using Libraries from Partially Trusted Code.