Here are the examples of the java api com.jacob.com.Variant.toString() taken from open source projects. By voting up you can indicate which examples are most useful and appropriate.
2 Examples
18
Source : JacobTestApplet.java
with GNU Lesser General Public License v2.1
from freemansoft
with GNU Lesser General Public License v2.1
from freemansoft
/**
* action method that receives button actions
*
* @param ev the event
*/
public void actionPerformed(ActionEvent ev) {
if (this.sC == null) {
String lang = "VBScript";
this.sC = new ActiveXComponent("ScriptControl");
Dispatch.put(this.sC, "Language", lang);
}
Variant v = Dispatch.call(this.sC, "Eval", this.in.getText());
this.out.setText(v.toString());
}
13
Source : SafeArrayDispatchTest.java
with GNU Lesser General Public License v2.1
from freemansoft
with GNU Lesser General Public License v2.1
from freemansoft
public void testDispatchWithSafeArray() {
try {
String scriptCommand = "1+(2*4)-3";
String lang = "VBScript";
ActiveXComponent sControl = new ActiveXComponent("ScriptControl");
Dispatch.put(sControl, "Language", lang);
Variant result = Dispatch.call(sControl, "Eval", scriptCommand);
replacedertTrue(result.toString().equals("6"));
// wrap the script control in a variant
Variant v = new Variant(sControl);
// create a safe array of type dispatch
SafeArray sa = new SafeArray(Variant.VariantDispatch, 1);
// put the variant in the array
sa.setVariant(0, v);
// take it back out
Variant v2 = sa.getVariant(0);
Dispatch d = v2.toDispatch();
// make sure you can call eval on it
result = Dispatch.call(d, "Eval", scriptCommand);
replacedertTrue(result.toString().equals("6"));
} catch (ComException e) {
e.printStackTrace();
fail("script failure " + e);
}
}