2.2.4.46.16 Worksheet::DeleteSelection

Description

Deletes the current selection from a worksheet.Deletes the current selection from a worksheet.

Syntax

BOOL DeleteSelection( BOOL bUndo )

Parameters

bUndo
[input] Whether to support Undo (TRUE) or not (FALSE)

Return

FALSE if there is no selection, otherwise TRUE

Examples

EX1

// This example shows how to programmatically setup a 
// selection of alternate rows and delete those alternate
// rows in the active worksheet.
void del_alternate_rows(BOOL nUndo = 1)
{
	Worksheet wks = Project.ActiveLayer();
	
	int nRows = wks.GetNumRows();
	// generate array of row index to delete
	// alternate rows, so (0-offset) 1,3,5,7,..
	if(nRows > 0)
	{
		vector<int> nvAlternateRows;
		nvAlternateRows.Data(1, nRows-1, 2);
		wks.SetSelectedRange( nvAlternateRows );
		wks.DeleteSelection( nUndo );
	}
	else
		printf("empty worksheet, not enough rows to delete");
}

Remark

Deletes the current selection from a worksheet.

If the selection is in the data area, rows below the selection move up.

If the selection is in the label area, cell contents are cleared.

This command handles regions (multiple selection ranges)

WARNING! The range's data also be deleted.

See Also

Header to Include

origin.h