Java Code Examples for com.jacob.com.Dispatch#call()

The following examples show how to use com.jacob.com.Dispatch#call() . You can vote up the ones you like or vote down the ones you don't like, and go to the original project or source file by following the links above each example. You may check out the related API usage on the sidebar.
Example 1
Source File: OfficeHtmlUtil.java    From jeecg with Apache License 2.0 6 votes vote down vote up
/**
 * EXCEL转HTML
 * 
 * @param xlsfile
 *            EXCEL文件全路径
 * @param htmlfile
 *            转换后HTML存放路径
 */
public void excelToHtml(String xlsfile, String htmlfile) {
	ActiveXComponent app = new ActiveXComponent("Excel.Application"); // 启动excel
	try {
		app.setProperty("Visible", new Variant(false));
		Dispatch excels = app.getProperty("Workbooks").toDispatch();
		Dispatch excel = Dispatch.invoke(excels, "Open", Dispatch.Method, new Object[] { xlsfile, new Variant(false), new Variant(true) }, new int[1]).toDispatch();
		Dispatch.invoke(excel, "SaveAs", Dispatch.Method, new Object[] { htmlfile, new Variant(EXCEL_HTML) }, new int[1]);
		Variant f = new Variant(false);
		Dispatch.call(excel, "Close", f);
		org.jeecgframework.core.util.LogUtil.info("wordtohtml转换成功");
	} catch (Exception e) {
		e.printStackTrace();
	} finally {
		app.invoke("Quit", new Variant[] {});
	}
}
 
Example 2
Source File: OfficeHtmlUtil.java    From jeewx with Apache License 2.0 6 votes vote down vote up
/**
 * EXCEL转HTML
 * 
 * @param xlsfile
 *            EXCEL文件全路径
 * @param htmlfile
 *            转换后HTML存放路径
 */
public void excelToHtml(String xlsfile, String htmlfile) {
	ActiveXComponent app = new ActiveXComponent("Excel.Application"); // 启动excel
	try {
		app.setProperty("Visible", new Variant(false));
		Dispatch excels = app.getProperty("Workbooks").toDispatch();
		Dispatch excel = Dispatch.invoke(excels, "Open", Dispatch.Method, new Object[] { xlsfile, new Variant(false), new Variant(true) }, new int[1]).toDispatch();
		Dispatch.invoke(excel, "SaveAs", Dispatch.Method, new Object[] { htmlfile, new Variant(EXCEL_HTML) }, new int[1]);
		Variant f = new Variant(false);
		Dispatch.call(excel, "Close", f);
		org.jeecgframework.core.util.LogUtil.info("wordtohtml转换成功");
	} catch (Exception e) {
		e.printStackTrace();
	} finally {
		app.invoke("Quit", new Variant[] {});
	}
}
 
Example 3
Source File: OfficeHtmlUtil.java    From jeewx with Apache License 2.0 6 votes vote down vote up
/**
 * WORD转HTML
 * 
 * @param docfile
 *            WORD文件全路径
 * @param htmlfile
 *            转换后HTML存放路径
 */
public void wordToHtml(String docfile, String htmlfile) {
	ActiveXComponent app = new ActiveXComponent("Word.Application"); // 启动word
	try {
		app.setProperty("Visible", new Variant(false));
		Dispatch docs = app.getProperty("Documents").toDispatch();
		Dispatch doc = Dispatch.invoke(docs, "Open", Dispatch.Method, new Object[] { docfile, new Variant(false), new Variant(true) }, new int[1]).toDispatch();
		Dispatch.invoke(doc, "SaveAs", Dispatch.Method, new Object[] { htmlfile, new Variant(WORD_HTML) }, new int[1]);
		Variant f = new Variant(false);
		Dispatch.call(doc, "Close", f);
	} catch (Exception e) {
		e.printStackTrace();
	} finally {
		app.invoke("Quit", new Variant[] {});
	}
}
 
Example 4
Source File: IITArtworkCollection.java    From The-5zig-Mod with MIT License 5 votes vote down vote up
/**
 * Returns an ITArtwork object corresponding to the given index (1-based).
 *
 * @param index Index of the playlist to retrieve, must be less than or
 *              equal to <code>ITArtworkCollection.getCount()</code>.
 * @return Returns an ITArtwork object corresponding to the given index.
 * Will be set to NULL if no playlist could be retrieved.
 */
public IITArtwork getItem(int index) {
	Variant variant = Dispatch.call(object, "Item", index);
	if (variant.isNull()) {
		return null;
	}
	Dispatch item = variant.toDispatch();
	return new IITArtwork(item);
}
 
Example 5
Source File: IITTrack.java    From The-5zig-Mod with GNU General Public License v3.0 4 votes vote down vote up
/**
 * Delete this object.
 */
public void delete() {
	Dispatch.call(object, "Delete");
}
 
Example 6
Source File: IITTrack.java    From The-5zig-Mod with GNU General Public License v3.0 4 votes vote down vote up
/**
 * Start playing this object.
 */
public void play() {
	Dispatch.call(object, "Play");
}
 
Example 7
Source File: IITArtworkCollection.java    From The-5zig-Mod with GNU General Public License v3.0 4 votes vote down vote up
/**
 * Returns an ITArtwork object corresponding to the given index (1-based).
 *
 * @param index Index of the playlist to retrieve, must be less than or
 *              equal to <code>ITArtworkCollection.getCount()</code>.
 * @return Returns an ITArtwork object corresponding to the given index.
 * Will be set to NULL if no playlist could be retrieved.
 */
public IITArtwork getItem(int index) {
	Variant variant = Dispatch.call(object, "Item", index);
	if (variant.isNull()) {
		return null;
	}
	Dispatch item = variant.toDispatch();
	return new IITArtwork(item);
}
 
Example 8
Source File: IITArtwork.java    From The-5zig-Mod with MIT License 4 votes vote down vote up
/**
 * Delete this object.
 */
public void delete() {
	Dispatch.call(object, "Delete");
}
 
Example 9
Source File: IITArtwork.java    From The-5zig-Mod with GNU General Public License v3.0 4 votes vote down vote up
/**
 * Delete this object.
 */
public void delete() {
	Dispatch.call(object, "Delete");
}
 
Example 10
Source File: IITTrack.java    From The-5zig-Mod with MIT License 4 votes vote down vote up
/**
 * Delete this object.
 */
public void delete() {
	Dispatch.call(object, "Delete");
}
 
Example 11
Source File: IITTrack.java    From The-5zig-Mod with MIT License 4 votes vote down vote up
/**
 * Start playing this object.
 */
public void play() {
	Dispatch.call(object, "Play");
}
 
Example 12
Source File: IITArtworkCollection.java    From The-5zig-Mod with GNU General Public License v3.0 3 votes vote down vote up
/**
 * Returns an ITArtwork object with the specified persistent ID. See the
 * documentation on ITObject for more information on persistent IDs.
 *
 * @param highID The high 32 bits of the 64-bit persistent ID.
 * @param lowID  The low 32 bits of the 64-bit persistent ID.
 * @return Returns an ITArtwork object with the specified persistent ID.
 * Will be set to NULL if no playlist could be retrieved.
 */
public IITArtwork getItemByPersistentID(int highID, int lowID) {
	Variant variant = Dispatch.call(object, "ItemByPersistentID", highID, lowID);
	if (variant.isNull()) {
		return null;
	}
	Dispatch item = variant.toDispatch();
	return new IITArtwork(item);
}
 
Example 13
Source File: IITArtworkCollection.java    From The-5zig-Mod with MIT License 3 votes vote down vote up
/**
 * Returns an ITArtwork object with the specified persistent ID. See the
 * documentation on ITObject for more information on persistent IDs.
 *
 * @param highID The high 32 bits of the 64-bit persistent ID.
 * @param lowID  The low 32 bits of the 64-bit persistent ID.
 * @return Returns an ITArtwork object with the specified persistent ID.
 * Will be set to NULL if no playlist could be retrieved.
 */
public IITArtwork getItemByPersistentID(int highID, int lowID) {
	Variant variant = Dispatch.call(object, "ItemByPersistentID", highID, lowID);
	if (variant.isNull()) {
		return null;
	}
	Dispatch item = variant.toDispatch();
	return new IITArtwork(item);
}
 
Example 14
Source File: IITArtwork.java    From The-5zig-Mod with MIT License 2 votes vote down vote up
/**
 * Save artwork data to an image file.
 * <p>
 * The format of the saved data is specified by the artwork's format (JPEG, PNG, or BMP). The directory that contains the file must already exist, it will not be created. If the file
 * already exists, its contents will be replaced.
 *
 * @param filePath Full path to the artwork image file.
 */
public void SaveArtworkToFile(String filePath) {
	Dispatch.call(object, "SaveArtworkToFile", filePath);
}
 
Example 15
Source File: ITURLTrack.java    From The-5zig-Mod with MIT License 2 votes vote down vote up
/**
 * Set the URL of the stream represented by this track.
 * @param url The URL of the stream represented by this track.
 */
public void setURL (String url) {
    Dispatch.call(object, "URL", url);
}
 
Example 16
Source File: ITURLTrack.java    From The-5zig-Mod with GNU General Public License v3.0 2 votes vote down vote up
/**
 * Set the URL of the stream represented by this track.
 * @param url The URL of the stream represented by this track.
 */
public void setURL (String url) {
    Dispatch.call(object, "URL", url);
}
 
Example 17
Source File: IITArtwork.java    From The-5zig-Mod with GNU General Public License v3.0 2 votes vote down vote up
/**
 * Save artwork data to an image file.
 * <p>
 * The format of the saved data is specified by the artwork's format (JPEG, PNG, or BMP). The directory that contains the file must already exist, it will not be created. If the file
 * already exists, its contents will be replaced.
 *
 * @param filePath Full path to the artwork image file.
 */
public void SaveArtworkToFile(String filePath) {
	Dispatch.call(object, "SaveArtworkToFile", filePath);
}