Spread 8.0 Documentation
SetText Method
Support Options
ActiveX Reference > ActiveX Methods > SetText Method

Glossary Item Box

SetText Method


See Also    DLL    Example

Applies To

fpSpread control

Description

Sets the contents of the specified cell.

Syntax

C++

void CSpreadSheet::SetText (long Col, long Row, const VARIANT& Var);

Visual Basic

fpSpread.SetText(ByVal Col As Long, ByVal Row As Long, ByVal Var As Variant)

Parameters

The following parameters are available:

Parameter Description
Col Column number of cell to contain data
Row Row number of cell to contain data
Var Text being assigned to cell

Remarks

Use this method as a concise way to set data. You can also set data in cells using the Clip, ClipValue, Text, and Value properties, and the SetFloat and SetInteger methods. Because the method accepts a variant data type, the SetText method lets you provide data for cells as different data types. For more information about using these properties and methods, see Adding Data.

This method is called for the current sheet setting unless you first set the Sheet property to specify the sheet with which you want to work.

The following table explains the data format to use when setting data using the SetText method. Values in quotation marks (" ") are string values.

Cell Type Sample Data To Set
Button True (Two-state) "1" or 1
False (Two-state) "0" or 0
Not set (Two-state; looks False) Empty string or Null
Check Box True "1" or 1
False "0" or 0
Grayed "2" or 2
Not set; looks False Empty string or Null
Combo Box   Provide text string of item to select
Currency "$10,000.00" "$10,000.00" or 10000.00
Date "10/29/2001" "10/29/2001"
Provide in format that matches the setting of the TypeDateFormat property. When specifying the date value, use a separator where separators are displayed in the format.
Edit   Text string or numeric data
If the TypeEditMultiLine property is set to True, a linefeed character (ASCII 10 or `\n' in C++) can be used to force a line break when setting text.
Number "10,000.00" "10,000.00" or 10000.00 or "1E4"
Owner-Drawn not applicable
Percent "15%" "15%" or 0.15
PIC "22-45-76" "22-45-76"
Picture not applicable
Scientific "2.22E+05" "2.22E+05"
Static Text   Text string or numeric data
If the TypeTextWordWrap property is set to True, a linefeed character (ASCII 10 or `\n' in C++) can be used to force a line break when setting text.
Time "11:25:03 pm" "11:25:03 pm"
When using an a.m./p.m. indicator, include a space between the time value and the indicator, for example, "10:00:00 p.m."

If you set the Col or Row parameter to –1 to set data for multiple cells, the same data is placed in each cell.

Return Type

None

See Also

Adding Data

Clip, ClipValue, Sheet, Text, Value properties

GetText, SetFloat, SetInteger methods

DLL Correspondence

SSSetData, SSSetFloat, SSSetInteger functions

Copyright © GrapeCity, inc. All rights reserved.