node-win32ole

Asynchronous, non-blocking win32ole bindings for node.js .

Download as .zip Download as .tar.gz View on GitHub

NAME

node-win32ole - Asynchronous, non-blocking win32ole bindings for node.js powered by v8 engine .

win32ole makes accessibility from node.js to Excel, Word, Access, Outlook, InternetExplorer, WSH ( ActiveXObject / COM ) and so on. It does not need TypeLibrary.

USAGE

Install with npm install win32ole.

It works as... (version 0.1.x)

try{
  var win32ole = require('win32ole');
  // var xl = new ActiveXObject('Excel.Application'); // You may write it as:
  var xl = win32ole.client.Dispatch('Excel.Application');
  xl.Visible = true;
  var book = xl.Workbooks.Add();
  var sheet = book.Worksheets(1);
  try{
    sheet.Name = 'sheetnameA utf8';
    sheet.Cells(1, 2).Value = 'test utf8';
    var rg = sheet.Range(sheet.Cells(2, 2), sheet.Cells(4, 4));
    rg.RowHeight = 5.18;
    rg.ColumnWidth = 0.58;
    rg.Interior.ColorIndex = 6; // Yellow
    var result = book.SaveAs('testfileutf8.xls');
    console.log(result);
  }catch(e){
    console.log('(exception cached)\n' + e);
  }
  xl.ScreenUpdating = true;
  xl.Workbooks.Close();
  xl.Quit();
}catch(e){
  console.log('*** exception cached ***\n' + e);
}

There are 3 ways to make force Garbage Collection for node.js / v8 .

see also examples/ole_args_test_client.js

Tutorial and Examples

Other built in functions

FEATURES

API

See the API documentation in the wiki.

BUILDING

This project uses VC++ 2008 Express (or later) and Python 2.6 (or later) . (When using Python 2.5, it needs multiprocessing 2.5 back port .) It needs neither ATL nor MFC.

Bulding also requires node-gyp to be installed. You can do this with npm:

npm install -g node-gyp

To obtain and build the bindings:

git clone git://github.com/idobatter/node-win32ole.git
cd node-win32ole
node-gyp configure
node-gyp build

You can also use npm to download and install them:

npm install win32ole

TESTS

mocha is required to run unit tests.

npm install -g mocha
nmake /a test

CONTRIBUTORS

ACKNOWLEDGEMENTS

Inspired Win32OLE

LICENSE

node-win32ole is BSD licensed.