Message de Niklas Nebel  date 2010-03-11 10:56 :

On 03/10/10 21:08, Bernard Marcelly wrote:
fp = ThisComponent.createInstance("com.sun.star.sheet.FormulaParser")
fp.FormulaConvention = com.sun.star.sheet.AddressConvention.XL_OOX
fp.ReferencePosition = c.CellAddress
ftseq = fp.parseFormula(c.Formula)

You can get the token sequence directly from the cell, without using the parser or the formula text:

ftseq = c.Tokens

ftseq is a nice array of FormulaToken, but how can I interpret a formula token OpCode ? In the fp object, property OpCodeMap is an empty array, and the documented property ExternalLinks does not exist.

Use FormulaOpCodeMapper to map between function names and op codes. To get the code for the DDE function:

dim aNames(0 to 0) as String
aNames(0) = "DDE"
oMapper = CreateUnoService("com.sun.star.sheet.FormulaOpCodeMapper")
aMappings = oMapper.getMappings(aNames(),_
    com.sun.star.sheet.FormulaLanguage.ENGLISH)
print aMappings(0).OpCode

Several IDL pages are unpublished, is this service usable ?

This stuff is used by the xlsx import, so it should work. Unpublished means it might change in the future, but there are no API changes planned at the moment.

Niklas


Hi Niklas,
Now I can find if a cell uses DDE function. But retrieving the value of its arguments is another matter, except in simple cases. Probably there is no easy way to find which cells use a given DDE link.

Anyway, thanks for the tip.

Regards
  Bernard


---------------------------------------------------------------------
To unsubscribe, e-mail: [email protected]
For additional commands, e-mail: [email protected]

Reply via email to