Hi,

maybe a java snippet will help:

Oliver

[...]
final CellContentType type = xCell.getType();

if (type == CellContentType.FORMULA) {
        final CellContentType cellType = (CellContentType) 
getPropertyValue(xCell, "FormulaResultType");
        if (cellType.getValue() == FormulaResult.STRING) {
                final XTextRange xTextRange = getTextRange(xCell);
                if (xTextRange != null)
                        return xTextRange.getString();
                } else
                        return new Double(xCell.getValue());
        }

}

public XTextRange getTextRange(final XCell xCell) {
        if (xCell != null)
                return (XTextRange) UnoRuntime.queryInterface(XTextRange.class, 
xCell);
        return null;
}

Am 17.12.2008 16:08 schrieb Petteri Larjos:
> Hello,
> 
> I am using UNO C++ API and need help with XCell interface.
> 
> Question 1
> How do I get value of cell which contains formula returninng text? For
> example spreadsheet cell with formula '==CONCATENATE("some";"text")'. The
> com.sun.star.table.xcell method getValue() returns zero and getFormula()
> returns formula not value. Is there any way to get textual return value of
> formula? Or is there any method to be sure that returned zero value of
> getValue() is not result of string returned by formula?
> 
> Question 2
> com.sun.star.table.xcell method getError() returns long value. How do I get
> error string which corresponds with getError() value?
> 
> Thank you very much!
> 
> Regards,
> petteri

---------------------------------------------------------------------
To unsubscribe, e-mail: dev-unsubscr...@api.openoffice.org
For additional commands, e-mail: dev-h...@api.openoffice.org



-- 


GnuPG key 0xCFD04A45: 8822 057F 4956 46D3 352C 1A06 4E2C AB40 CFD0 4A45

Attachment: signature.asc
Description: OpenPGP digital signature

Reply via email to