用Applet调用Excel是否有点浪费?你还不如直接使用IE来完成呢,何必多此一举呢?
你是不是要实现报表的Web打印问题?

解决方案 »

  1.   

    Try the following applet code, after filling in the Runtime.exec the exact adress where your local application is located. If your running in a windows OS, please note that you must enter \\ instead of \ (example: c:\\winnt\\notepad.exe) 
    And due, to security reason, you must make one of the following things too: 
    1) you must sign your applet (I don't know how to do that) 2) or you save the applet into a folder that is declared in your classpath (I know how to do it in winNt): 
    (1.- execute sysedit (before programs menu)) 
    2.- write into Autoexec.bat the following code: 
    SET PATH=%PATH%;%JAVAHOME%\BIN 
    SET CLASSPATH=.;C:\jdk1.1.8\lib\;C:\jdk1.1.8 
    \bin\;C:\jdk1.1.8\class\; (this is my example. I save all my applets into C:\jdk1.1.8\class\) 
    3.- save autoexec.bat 
    4.- restart your computer And the applet it now supposed to work succesfully. I hope this help you best Regards, 
    Pisonero import java.io.*; 
    import java.applet.*; 
    import java.awt.*; 
    import java.net.*; 
    import java.awt.event.*; public class interfaz4okartes extends Applet implements MouseListener { Graphics g; 
    boolean estado; public void init() { 
    Button boton = new Button("Lanzar Aplicacion"); 
    add(boton); 
    boton.addMouseListener(this); 
    estado = false; 
    } public void destroy() { 
    removeMouseListener(this); 
    } public void mouseClicked(MouseEvent event) { 
    if (estado == false){ 
    try { 
    Runtime.getRuntime().exec("c:\\where your application is located.exe"); 
    g.drawString("Success executing Application", 10, 10); 

    catch (SecurityException e) { 
    g.drawString("Caught security exception trying to run an underlying program", 10, 10); 

    catch (IOException ioe) { 
    g.drawString("Caught i/o exception in exec", 10, 10); 

    estado = true; 

    else 
    return; 
    } public void mousePressed(MouseEvent event) {} 
    public void mouseReleased(MouseEvent event) {} 
    public void mouseEntered(MouseEvent event) {} 
    public void mouseExited(MouseEvent event) {}