DataRange::SetColumnData

Description

Set data by column offset index.

Syntax

BOOL SetColumnData( vector & v, BOOL bUndo = FALSE, int index = 0 )


Parameters

v
[input]input data
bUndo
[input]TRUE if the information needed for succesful undo of this value setting should be
remembered on the undo stack.
index
[input]offset of the column into which the data should be put, from the top left corner
of the first range in this DataRange object, whose name is either empty or "X".

TRUE if success.

Examples

EX1

// For this example to run successfully, an Origin workbook should be the active
// window. The function will put 100 numbers into the rows starting with the 5th row
// of columns whose total number is specified by the first argument, starting with
// the 7th column.
void test_SetColumnData(int nCountColumnsToSet = 1, BOOL bUndoable = 0)
{
Worksheet wks = Project.ActiveLayer();
if (!wks)
{
out_str("Invalid active window!");
return;
}

DataRange dr;
// All the data will be added srarting from the 5th row
// in the 7th column:
dr.Add("", wks, 4, 6, 4, 6);

vector vv;
vv.Data(1,100);
for(int ii = 0; ii < nCountColumnsToSet; ii++)
{
if(!dr.SetColumnData(vv, bUndoable, ii))
out_str("Failed to set column data!");

vv+=5;
}
}


Remark

It sets the data by column offset index. It adds columns as needed. The data is put into one column only. The column is determined as the index'th offset from the top left corner of the first range in this DataRange object, whose name is either empty or "X". Columns are added to the worksheet as needed.