Package com.jacob.activeX

Examples of com.jacob.activeX.ActiveXComponent.invoke()


    ActiveXComponent application = new ActiveXComponent("Word.Application");
    ActiveXComponent documents = application
        .getPropertyAsComponent("Documents");
    String fileName = "abc\u0411\u0412\u0413\u0414def";
    try {
      documents.invoke("Open", fileName);
      fail("Should have thrown an exception");
    } catch (ComException e) {
      assertTrue("Error message should contain file name with unicode "
          + "characters in it. " + e.getMessage(), e.getMessage()
          .indexOf(fileName) > 0);
View Full Code Here


    try {
      ActiveXComponent documents = new ActiveXComponent(getProperty(
          "Documents").toDispatch());
      Variant[] args = new Variant[1];
      args[0] = new Variant(f.getPath());
      documents.invoke("Open", args);
    } catch (Exception e) {
      e.printStackTrace();
      throw new VisioException(e);
    }
  }
View Full Code Here

   */
  public void save() throws VisioException {
    try {
      ActiveXComponent document = new ActiveXComponent(getProperty(
          "ActiveDocument").toDispatch());
      document.invoke("Save");
    } catch (Exception e) {
      e.printStackTrace();
      throw new VisioException(e);
    }
  }
View Full Code Here

    System.out.println("Received quit()");
    // there can't be any open documents for this to work
    // you'll get a visio error if you don't close them
    ActiveXComponent document = new ActiveXComponent(getProperty(
        "ActiveDocument").toDispatch());
    document.invoke("Close");
    invoke("Quit");
  }

  /**
   * runs the Visio export command
View Full Code Here

    try {
      ActiveXComponent document = new ActiveXComponent(getProperty(
          "ActivePage").toDispatch());
      Variant[] args = new Variant[1];
      args[0] = new Variant(f.getPath());
      document.invoke("Export", args);
    } catch (Exception e) {
      throw new VisioException(e);
    }
  }
View Full Code Here

      System.out.println("Closed File\n");
    } catch (Exception e) {
      e.printStackTrace();
      fail("Caught Exception " + e);
    } finally {
      xl.invoke("Quit", new Variant[] {});
    }
  }
}
View Full Code Here

      if (de == null) {
        System.out
            .println("null returned when trying to create DispatchEvents");
      }
      Variant result;
      result = sC.invoke("Eval", getSampleVPScriptForEval());
      // call it twice to see the objects reused
      result = sC.invoke("Eval", getSampleVPScriptForEval());
      // call it 3 times to see the objects reused
      result = sC.invoke("Eval", getSampleVPScriptForEval());
      System.out.println("eval(" + getSampleVPScriptForEval() + ") = "
View Full Code Here

            .println("null returned when trying to create DispatchEvents");
      }
      Variant result;
      result = sC.invoke("Eval", getSampleVPScriptForEval());
      // call it twice to see the objects reused
      result = sC.invoke("Eval", getSampleVPScriptForEval());
      // call it 3 times to see the objects reused
      result = sC.invoke("Eval", getSampleVPScriptForEval());
      System.out.println("eval(" + getSampleVPScriptForEval() + ") = "
          + result);
    } catch (ComException e) {
View Full Code Here

      Variant result;
      result = sC.invoke("Eval", getSampleVPScriptForEval());
      // call it twice to see the objects reused
      result = sC.invoke("Eval", getSampleVPScriptForEval());
      // call it 3 times to see the objects reused
      result = sC.invoke("Eval", getSampleVPScriptForEval());
      System.out.println("eval(" + getSampleVPScriptForEval() + ") = "
          + result);
    } catch (ComException e) {
      e.printStackTrace();
    } finally {
View Full Code Here

      // call a method on the thread-local Dispatch obtained
      // from the DispatchProxy. If you try to make the same
      // method call on the sControl object - you will get a
      // ComException.
      String scriptCommand = getSampleVPScriptForEval();
      Variant result = sc.invoke("Eval", scriptCommand);
      System.out.println("eval(" + scriptCommand + ") = " + result);
      script.quit();
      System.out.println("called quit");
    } catch (ComException e) {
      e.printStackTrace();
View Full Code Here

TOP
Copyright © 2018 www.massapi.com. All rights reserved.
All source code are property of their respective owners. Java is a trademark of Sun Microsystems, Inc and owned by ORACLE Inc. Contact coftware#gmail.com.