Python: unable to write large integers into Calc

Dear all,

I am trying to write integer numbers from a Python script into Calc cells. The following code snippet works fine with smaller numbers, but with the number shown, the result in the cell is -2041967296.

doc = XSCRIPTCONTEXT.getDocument()

sheet = doc.getCurrentController().getActiveSheet()

cell = sheet.getCellByPosition(0,0)


I appears to me that the python long type is not properly mapped onto the uno type hyper, and hence the binary number is getting truncated.
Following the ideas here in the section on Any, I also tried to replace the cell.setValue line above with

import uno

uno.invoke( cell, “setValue” , (uno.Any( “hyper”, 2253000000),) )

However this fails with the error message: cannot coerce argument type during corereflection call!

Can anybody kindly advise how to deal with this, thanks?

Hi @Retep_re,

Sounds like you’ve run across a bug. If installing/running the latest release doesn’t seem to fix this problem, please file a bug and provide a list of steps that can reproduce your problem. The QA Team will be happy to help you track down this issue!

Please post a link to any bugs you file in a comment below using the format “fdo#123456”.