当前位置: 首页>>代码示例>>Java>>正文


Java ActiveXComponent类代码示例

本文整理汇总了Java中com.jacob.activeX.ActiveXComponent的典型用法代码示例。如果您正苦于以下问题:Java ActiveXComponent类的具体用法?Java ActiveXComponent怎么用?Java ActiveXComponent使用的例子?那么, 这里精选的类代码示例或许可以为您提供帮助。


ActiveXComponent类属于com.jacob.activeX包,在下文中一共展示了ActiveXComponent类的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Java代码示例。

示例1: word2PDF

import com.jacob.activeX.ActiveXComponent; //导入依赖的package包/类
private void word2PDF(String inputFile, String pdfFile) {
  // 打开word应用程序
  ActiveXComponent app = new ActiveXComponent("Word.Application");
  // 设置word不可见
  app.setProperty("Visible", false);
  // 获得word中所有打开的文档,返回Documents对象
  Dispatch docs = app.getProperty("Documents").toDispatch();
  // 调用Documents对象中Open方法打开文档,并返回打开的文档对象Document
  Dispatch doc = Dispatch.call(docs, "Open", inputFile, false, true).toDispatch();
  // 调用Document对象的ExportAsFixedFormat方法,将文档保存为pdf格式
  Dispatch.call(doc, "ExportAsFixedFormat", pdfFile, WORD_VALUE);// word保存为pdf格式宏,值为17
  // 关闭文档
  Dispatch.call(doc, "Close", false);
  // 关闭word应用程序
  app.invoke("Quit", 0);
}
 
开发者ID:hivsuper,项目名称:document-converter,代码行数:17,代码来源:JacobPDFConverter.java

示例2: main

import com.jacob.activeX.ActiveXComponent; //导入依赖的package包/类
public static void main(String[] args) {
	System.out.println("Initing...");
	ComThread.InitMTA(true);
	System.out.println("Getting comp...");
	ActiveXComponent iTunesCom = new ActiveXComponent("iTunes.Application");
	Dispatch iTunesController = (Dispatch) iTunesCom.getObject();
	System.out.println("Instantiating...");
	IiTunes itunes = new IiTunes(iTunesController);
	System.out.println("You now have an Itunes...");
	
	IITSourceCollection sourceList = itunes.getSources();

	for (int i = 1; i <= sourceList.getCount(); i++) {
		IITSource s = sourceList.getItem(i);
		System.out.println("Source found:" + s.getName());
		IITPlaylistCollection lists = s.getPlaylists();
		for (int j = 1; j <= lists.getCount(); j++) {
			IITPlaylist pl = lists.getItem(j);
			System.out.println("Playlist found:" + pl.getName());
		}
	}
	// Dispatch.call(iTunesController, "PlayPause");
	ComThread.Release();
}
 
开发者ID:Eminenz,项目名称:itunesJacobExample,代码行数:25,代码来源:Playlister.java

示例3: excel2PDF

import com.jacob.activeX.ActiveXComponent; //导入依赖的package包/类
public boolean excel2PDF(String inputFile, String pdfFile) {
	try {
		ActiveXComponent app = new ActiveXComponent("Excel.Application");
		app.setProperty("Visible", false);
		Dispatch excels = app.getProperty("Workbooks").toDispatch();
		Dispatch excel = Dispatch.call(excels, "Open", inputFile, false,
				true).toDispatch();
		Dispatch.call(excel, "ExportAsFixedFormat", xlTypePDF, pdfFile);
		Dispatch.call(excel, "Close", false);
		app.invoke("Quit");
		return true;
	} catch (Exception e) {
		return false;
	}

}
 
开发者ID:cisasoft,项目名称:office2pdf,代码行数:17,代码来源:Office2pdfHelper.java

示例4: ppt2PDF

import com.jacob.activeX.ActiveXComponent; //导入依赖的package包/类
public boolean ppt2PDF(String inputFile, String pdfFile) {
	try {
		ActiveXComponent app = new ActiveXComponent(
				"PowerPoint.Application");
		// app.setProperty("Visible", msofalse);
		Dispatch ppts = app.getProperty("Presentations").toDispatch();

		Dispatch ppt = Dispatch.call(ppts, "Open", inputFile, true,// ReadOnly
				true,// Untitled指定文件是否有标题
				false// WithWindow指定文件是否可见
				).toDispatch();

		Dispatch.call(ppt, "SaveAs", pdfFile, ppSaveAsPDF);

		Dispatch.call(ppt, "Close");

		app.invoke("Quit");
		return true;
	} catch (Exception e) {
		return false;
	}
}
 
开发者ID:cisasoft,项目名称:office2pdf,代码行数:23,代码来源:Office2pdfHelper.java

示例5: test01

import com.jacob.activeX.ActiveXComponent; //导入依赖的package包/类
public void test01(){
    System.out.println("test01");
    System.out.println("========");
    
    ActiveXComponent drv = new ActiveXComponent("Addin.DRvFR");
    System.out.println("res code = "+drv.getProperty("ResultCode"));
    System.out.println("res code desc = "+drv.getProperty("ResultCodeDescription"));
    
    System.out.println("show properties");
    drv.invoke("ShowProperties");

    System.out.println("res code = "+drv.getProperty("ResultCode"));
    System.out.println("res code desc = "+drv.getProperty("ResultCodeDescription"));
}
 
开发者ID:gochaorg,项目名称:shtrih-m,代码行数:15,代码来源:TestShowProps.java

示例6: setListValuedField

import com.jacob.activeX.ActiveXComponent; //导入依赖的package包/类
@Override
public void setListValuedField(String fieldName, String fieldValue) {
    ActiveXComponent list = createList();
    for (String val : QCRequirement.getFieldValues(fieldValue)) {
        Dispatch.call(list, "Add", val);
        //Dispatch.put(list, "Add", new Integer(1));
    }
    Dispatch.invoke(this, "Field", Dispatch.Put, new Object[] { fieldName,
            list }, new int[2]);
}
 
开发者ID:jonico,项目名称:core,代码行数:11,代码来源:Requirement.java

示例7: excel2PDF

import com.jacob.activeX.ActiveXComponent; //导入依赖的package包/类
private void excel2PDF(String inputFile, String pdfFile) {
  ActiveXComponent app = new ActiveXComponent("Excel.Application");
  app.setProperty("Visible", false);
  Dispatch excels = app.getProperty("Workbooks").toDispatch();
  Dispatch excel = Dispatch.call(excels, "Open", inputFile, false, true).toDispatch();
  Dispatch.call(excel, "ExportAsFixedFormat", EXCEL_VALUE, pdfFile);
  Dispatch.call(excel, "Close", false);
  app.invoke("Quit");
}
 
开发者ID:hivsuper,项目名称:document-converter,代码行数:10,代码来源:JacobPDFConverter.java

示例8: ppt2PDF

import com.jacob.activeX.ActiveXComponent; //导入依赖的package包/类
private void ppt2PDF(String inputFile, String pdfFile) {
  ActiveXComponent app = new ActiveXComponent("PowerPoint.Application");
  // app.setProperty("Visible", msofalse);
  Dispatch ppts = app.getProperty("Presentations").toDispatch();
  Dispatch ppt = Dispatch.call(ppts, "Open", inputFile, true, // ReadOnly
      true, // Untitled指定文件是否有标题
      false// WithWindow指定文件是否可见
  ).toDispatch();
  Dispatch.call(ppt, "SaveAs", pdfFile, PPT_VALUE);
  Dispatch.call(ppt, "Close");
  app.invoke("Quit");
}
 
开发者ID:hivsuper,项目名称:document-converter,代码行数:13,代码来源:JacobPDFConverter.java

示例9: verifyXinNuo

import com.jacob.activeX.ActiveXComponent; //导入依赖的package包/类
/**
 * 校验信诺对象
 * 首先检查是否创建了信诺对象,若是创建了则跳过,没创建则先创建
 */
public void verifyXinNuo(){
	int i=0;
	while(i++<10){
		try {
			Command.activeXinNuo.invoke("WaitOnline");	//检测繁忙程度,判断信诺对象是否创建
			i=100;	//退出循环
		} catch (Exception e) {
			Command.activeXinNuo=new ActiveXComponent("XinNuo.SendData");		//创建信诺自动答题对象,再次创建
		}
	}
	if(i<100){	//小于100,循环中并没有成功过
		new Func.File().log("加载自动答题失败!可尝试关闭软件后重新打开软件");
	}
}
 
开发者ID:xnx3,项目名称:xunxian,代码行数:19,代码来源:XinNuo.java

示例10: createDmCom

import com.jacob.activeX.ActiveXComponent; //导入依赖的package包/类
/**
 * 创建大漠Com对象
 */
public boolean createDmCom(){
	boolean xnx3_result=false;
	try {
		this.activeDm=new ActiveXComponent("dm.dmsoft");		//创建大漠对象
		xnx3_result=true;
	} catch (Exception e) {
		e.printStackTrace();
		new Func.File().log("创建大漠Com对象时异常捕获:"+e.getMessage());
	}
	return xnx3_result;
}
 
开发者ID:xnx3,项目名称:xunxian,代码行数:15,代码来源:Com.java

示例11: createDb_MouseKeyCom

import com.jacob.activeX.ActiveXComponent; //导入依赖的package包/类
/**
 * 创建大兵键鼠Com对象
 */
public boolean createDb_MouseKeyCom(){
	boolean xnx3_result=false;
	try {
		this.activeDb_MouseKey=new ActiveXComponent("DBSoft.DBSoft_MouseKey");
		xnx3_result=true;
	} catch (Exception e) {
		e.printStackTrace();
		new Func.File().log("创建大兵键鼠Com对象时异常捕获:"+e.getMessage());
	}
	
	return xnx3_result;
}
 
开发者ID:xnx3,项目名称:xunxian,代码行数:16,代码来源:Com.java

示例12: createDb_WindowCom

import com.jacob.activeX.ActiveXComponent; //导入依赖的package包/类
/**
 * 创建大兵窗口Com对象
 */
public boolean createDb_WindowCom(){
	boolean xnx3_result=false;
	try {
		this.activeDb_Window=new ActiveXComponent("DBSoft.DBSoft_Window");
		xnx3_result=true;
	} catch (Exception e) {
		e.printStackTrace();
		new Func.File().log("创建大兵窗口Com对象时异常捕获:"+e.getMessage());
	}
	
	return xnx3_result;
}
 
开发者ID:xnx3,项目名称:xunxian,代码行数:16,代码来源:Com.java

示例13: Guard

import com.jacob.activeX.ActiveXComponent; //导入依赖的package包/类
public Guard(ActiveXComponent activeDm) {
	this.activeDm=activeDm;
	this.color=new Color(this.activeDm);
	this.findPic=new FindPic(this.activeDm);
	this.mouse=new Mouse(this.activeDm);
	this.press=new Press(this.activeDm);
	this.sleep=new Sleep();
	this.position=new Position(this.activeDm);
	this.file=new Func.File(this.activeDm);
	
	this.xinNuo=new XinNuo(this.activeDm);
}
 
开发者ID:xnx3,项目名称:xunxian,代码行数:13,代码来源:Guard.java

示例14: DaGuaiFunc

import com.jacob.activeX.ActiveXComponent; //导入依赖的package包/类
public DaGuaiFunc(ActiveXComponent activeDm){
	this.activeDm=activeDm;
	
	this.mouse=new Func.Mouse(this.activeDm);
	this.sleep=new Func.Sleep();
	this.findPic=new Func.FindPic(this.activeDm);
	this.findStr=new Func.FindStr(this.activeDm);
	this.lang=new Func.Lang();
	this.file=new Func.File(this.activeDm);
	this.color=new Func.Color(this.activeDm);
	this.press=new Func.Press(this.activeDm);
	this.position=new Func.Position(this.activeDm);
	
	this.guard=new Guard(this.activeDm);
}
 
开发者ID:xnx3,项目名称:xunxian,代码行数:16,代码来源:DaGuaiFunc.java

示例15: SaoHuoFunc

import com.jacob.activeX.ActiveXComponent; //导入依赖的package包/类
public SaoHuoFunc(ActiveXComponent active){
	this.activeDm=active;
	this.mouse=new Func.Mouse(this.activeDm);
	this.sleep=new Func.Sleep();
	this.findPic=new Func.FindPic(this.activeDm);
	this.findStr=new Func.FindStr(this.activeDm);
	this.lang=new Func.Lang();
	this.file=new Func.File(this.activeDm);
	this.color=new Func.Color(this.activeDm);
	this.press=new Func.Press(this.activeDm);
	this.message=new Func.Message();
}
 
开发者ID:xnx3,项目名称:xunxian,代码行数:13,代码来源:SaoHuoFunc.java


注:本文中的com.jacob.activeX.ActiveXComponent类示例由纯净天空整理自Github/MSDocs等开源代码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。