Tom Carchrae | 1 Mar 2010 23:38
Favicon

Reading Excel data on a sheetChange event

Hello,

I wonder if anyone has had any luck in reading cells based on
sheetChange events in Java from Excel.  If so, I would greatly
appreciate some pointers.  Below is what I've tried.  I also tried
many other methods on target, but most of them seem to also throw
exceptions.  I list those below too.

Thanks,

Tom

I attach an event handler using:

	public static void main(String[] args) throws InterruptedException {
		final _Application app = excel.ClassFactory.createApplication();
		app.visible(0, true);
		final _Workbook wb = app.workbooks().add(null, 0);

		System.out.println(app.getClass().getSimpleName());
		app.advise(AppEvents.class, new AppEvents() {
			public void sheetChange(com4j.Com4jObject sh, excel.Range target) {
				try {
					System.out.println(target.formulaR1C1()); // <- this blows up
				} catch (Exception e) {
					e.printStackTrace();
				}
			}
		});

(Continue reading)


Gmane