问题描述
- java实现打印(C/S模式的),有没有例子?
- java实现打印(C/S模式的),有没有例子?目前我用的是JCOM实现打印,但是卸载office之后报“jp.ne.so_net.ga2.no_ji.jcom.JComException:createInstance()failed HRESULT=0x800401F3L”,怎样让它在不安装office的情况下也能打印(即支持WPS)?源代码如下:package com.psbc.print;
import jp.ne.so_net.ga2.no_ji.jcom.ReleaseManager;
import jp.ne.so_net.ga2.no_ji.jcom.excel8.ExcelApplication;
import jp.ne.so_net.ga2.no_ji.jcom.excel8.ExcelWorkbook;
import jp.ne.so_net.ga2.no_ji.jcom.excel8.ExcelWorkbooks;
import jp.ne.so_net.ga2.no_ji.jcom.excel8.ExcelWorksheet;public class JCOM {
public boolean print(String fname) { ReleaseManager rm = new ReleaseManager(); try { ExcelApplication excel = new ExcelApplication(rm); ExcelWorkbooks xlBooks = excel.Workbooks(); ExcelWorkbook xlBook = xlBooks.Open(fname); ExcelWorksheet xlSheet = excel.ActiveSheet(); xlSheet.PrintOut(); xlBook.Close(false null false); excel.Quit(); } catch (Exception e) { e.printStackTrace(); return false; } finally { rm.release(); } return true;}public static void main(String[] args) { JCOM test = new JCOM(); try { test.print(""D://test.xls""); } catch (Exception e) { e.printStackTrace(); }}
}
解决方案
这是我积累的一些java项目源码 你可以参考参考 不过有点基础
http://download.csdn.net/album/detail/1369
时间: 2024-12-06 04:39:04