Compartilhar via


TextSelection.Unindent(Int32) Method

Definition

Removes indents from the text selection by the number of indentation levels given.

void Unindent(int Count = 1);
[System.Runtime.InteropServices.DispId(34)]
public void Unindent (int Count = 1);
[<System.Runtime.InteropServices.DispId(34)>]
abstract member Unindent : int -> unit
Public Sub Unindent (Optional Count As Integer = 1)

Parameters

Count
Int32

Optional. The number of display indent levels to remove from each line in the text selection. The default is 1.

Attributes

Examples

Sub UnIndentExample()  
   ' Before running this example, open a text document.  
   Dim objSel As TextSelection = DTE.ActiveDocument.Selection  
   ' Go to first line in document and indent it.  
   objSel.GotoLine(1, False)  
   objSel.Indent(2)  
   MsgBox("Indented two places, now unindenting one place...")  
   objSel.Unindent(1)  
End Sub  

Remarks

Unindent removes indents in the text selection by the number of display columns indicated by the global setting for one indentation level. Unindent does not do smart formatting or remove indents for lines based on the context of the code. Tabs and characters are deleted and inserted as necessary to remove one indentation level, according to the current global settings for tab and indent level size.

Unindent behaves differently depending on whether the text selection is continuous or columnar. If it is continuous, indents are removed from all lines partially or completely within the selection at the first column. If it is a columnar selection, indents are removed from the text selection at the left edge of the selection.

If the value of Count is negative, then Unindent performs like the Indent method.

Unindent fails if the value of Count is greater than or equal to 10,000.

Applies to