XLL+ Class Library

CXlOper::ConvertFormula

Convert a formula between A1 and RC formats, using local language settings

[C++]
BOOL ConvertFormula(
   const CString& strFormulaIn,
   CString& strFormulaOut,
   BOOL bToA1
) const;

Parameters

strFormulaIn

String buffer containing the formula. The formula is assumed to be in the current language (i.e. in "local" form), using punctuation derived from the user's regional settings, and function names derived from the Excel version.

If the formula is not in the correct format for the current settings, then the call will fail. To convert a formula which works under all language settings, see CXlOper::ConvertFormulaIntl.

strFormulaOut

Buffer to receive converted formula, in local language.

bToA1

If FALSE, then strFormulaIn should contain references in A1 format; if TRUE, the references should be in RC format.

Return value

Returns TRUE if the function was successful, FALSE if it failed.

Remarks

This method requires that the calling object be a valid reference (i.e. this->IsRef() is true). Relative addresses in the formula will be treated as being relative to the calling object's reference.

Breaking change

In XLL+ versions earlier than 4.3.1, this method was implemented as a static function. This was a design error, and has been corrected. As a result, existing calls to CXlOper::ConvertFormula that are explicitly expressed as static will fail to compile, e.g.:

BOOL ok = CXlOper::ConvertFormula(strIn, strOut, TRUE);
In addition, calls to ConvertFormula which are non-static will fail at run-time if the calling object does not contain a reference.

Requirements

Header: xllplus.h

See Also

CXlOper Class | CXlOper Methods | CXlOper::GetFormula() | CXlOper::SetFormula()