SetCell Method (Document Object)

Sets the text on the specified cell in a CSV mode.

[JavaScript]

document.SetCell( yLine, iColumn, str, flags );

[VBScript]

document.SetCell( yLine, iColumn, str, flags )

Parameters

yLine

Specifies a line number of the text to set.

iColumn

Specifies the index of the column of the text you want to set.

str

Specifies the string to set.

flags

Specifies one of the following values.

eeAutoQuote

Checks whether the string contains delimiters, newlines, or quotes, and escape those characters and add quotes if necessary.

eeDontQuote

Don't do the above process.

eeAlwaysQuote

Always add quotes.

Examples

The following example inserts an empty column on the left side of the third column, and combines the first and second columns and set as third column. A CSV document must be active before this macro is run.

[JavaScript]

document.InsertColumn( 3 );
nLines = document.GetLines() - 1;
for( y = 1; y <= nLines; y++ ) {
s1 = document.GetCell( y, 1, eeCellIncludeNone );
s2 = document.GetCell( y, 2, eeCellIncludeNone );
s3 = s1 + " " + s2;
document.SetCell( y, 3, s3, eeAutoQuote );
}

[VBScript]

document.InsertColumn 3
nLines = document.GetLines() - 1
For y = 1 To nLines
s1 = document.GetCell( y, 1, eeCellIncludeNone )
s2 = document.GetCell( y, 2, eeCellIncludeNone )
s3 = s1 + " " + s2
document.SetCell y, 3, s3, eeAutoQuote
Next

Version

Supported on EmEditor Professional Version 16.7 or later.