This documentation is archived and is not being maintained.

TextSelection.PadToColumn Method

Fills the current line in the buffer with empty characters (white space) to the given column.

Namespace: EnvDTE
Assembly: EnvDTE (in envdte.dll)

void PadToColumn (
	[InAttribute] int Column
void PadToColumn (
	/** @attribute InAttribute() */ int Column
function PadToColumn (
	Column : int



Required. The number of columns to pad, starting at one.

PadToColumn inserts tabs and spaces, according to global settings, from the selection's display column to the specified display column. If the active end of the selection already lies beyond the specified column, PadToColumn does nothing. For TextSelection.PadToColumn, the selection immediately follows the inserted white space and is collapsed.

public void PadToColumnExample(DTE2 dte)
    // Create a new text file.
    dte.ItemOperations.NewFile(@"General\Text File", "", 

    // Create an EditPoint at the start of the new file.
    TextDocument doc = 
    EditPoint point = doc.StartPoint.CreateEditPoint();

    // Insert 10 lines of text.
    for (int i = 0; i < 10; i++)
        point.Insert("This is a test.\n");


    // Indent text to column 10.
    for (int i = 0; i < 10; i++)