Inserting values into Calc's cells with JS

Keyboard macros or custom scripts

Inserting values into Calc's cells with JS

Postby jza » Wed Aug 31, 2016 5:05 am

So been looking around for a macro that does the same as the python one, however, seems that import uno, unohelper was enough to be calling interfaces on python. Javascript seems that uses direct calling ot each interface. i would like to know how to insert data into Calc from Javascript including which modules do I need, I have been trying to do the following:
Code: Select all   Expand viewCollapse view

oDoc = UnoRuntime.queryInterface(XModel,XSCRIPTCONTEXT.getInvocationContext());
if ( !oDoc )
  oDoc = XSCRIPTCONTEXT.getDocument();
xSpread = UnoRuntime.queryInterface(XSpreadsheetDocument,oDoc);
xCell = xSpread.getCellRangeByName("E2");

However a few questions:
- Which interface to import for the cells, and the cells content?
- XSpreadSheet seems to not be correctly instantiated.
- How to instantiate the cell, is a Shee/Row/Range needed for that, or will getDocument() already instantiate everything (sheet, cell)?
- How to get current cell location.

Update Been looking around this examples these examples. But still no luck on trying to fit them into the code. So far XSpreadSheet and XCelllRange are there but not correctly declared.
AOO 4.1.1 on Arch Linux
User avatar
Posts: 239
Joined: Mon Nov 03, 2008 11:33 am
Location: Cancún, Mexico

Return to OpenOffice Basic, Python, BeanShell, JavaScript

Who is online

Users browsing this forum: No registered users and 2 guests