FileOutputStream fileOut = new FileOutputStream("D:/A.xls");
  outWB.write(fileOut);
  fileOut.close();
    
  生成了excel 怎么给它加密呢?
  
  上网搜了一天都没找到 着急啊 哪位有经验的人给提示下怎么做啊
  
  谢谢啦!!!!!!!!!!!!!!

解决方案 »

  1.   

    此回复为自动发出,仅用于显示而已,并无任何其他特殊作用
    楼主【adong1423】截止到2008-07-16 09:28:07的历史汇总数据(不包括此帖):
    发帖的总数量:2                        发帖的总分数:70                       每贴平均分数:35                       
    回帖的总数量:5                        得分贴总数量:0                        回帖的得分率:0%                       
    结贴的总数量:2                        结贴的总分数:70                       
    无满意结贴数:0                        无满意结贴分:0                        
    未结的帖子数:0                        未结的总分数:0                        
    结贴的百分比:100.00%               结分的百分比:100.00%                  
    无满意结贴率:0.00  %               无满意结分率:0.00  %                  
    敬礼!
      

  2.   

    可以设置保护密码,poi应该有方法。
      

  3.   

    POI有没有加密功能就不知道了
    可以使用jxcell组件来读取加密的excel文件 
    http://www.jxcell.netView   m_view   =   new   View(); 
    m_view.read( "c:\\yourfile.xls ", "123456 "); 
    123456为yourfile.xls文件的password;
      

  4.   

    是利用 Excel 本身的数据加密方法吗?就是一打开这个 Excel 文件蹦出一个管你要读写密码的对话框。
      

  5.   

    1) 去这里下一个jexcel(有native调用,感觉不是很爽,而且要钱的!)
    http://www.teamdev.com/jexcel/downloads.jsf JExcel v1.2
      - JExcel library
      - JExcel Demo (with source code)
      - Programmer's Guide
      - Bundled with JNIWrapper and ComfyJ
      - Samples Download *  2.03 MB 2) http://www.teamdev.com/jexcel/index.jsf
    evaluation license key.
    申请一个试用的key,之后你的邮箱会收到说明Dear bootupnow,Thanks for your interest in JExcel library.Attached you will find the evaluation key to unlock a full-featured version of JExcel for a period of 30 days starting from today [Wed Jul 16 10:09:10 CDT 2008].Please rename the attached file "license._zip" into "license.zip".
    For installation instructions, please see the "readme.txt" file inside the JExcel download package.Your successful evaluation is important to us. Feel free to contact us if you have any questions about the product.
    For technical questions, please e-mail to [email protected] or visit our support forum.
    For general questions, please e-mail to [email protected] or visit our support forum.
    We hope you will enjoy using JExcel!
    Sincerely,
    TeamDev Ltd.
    http://www.teamdev.com+1 425 223-3079 (US)
    +380 57 766-0163 (UA)
    Monday to Friday, 11 a.m.–7 p.m. (GMT+2).
    license.zip
    2K   Download   3) 按照Readme.txt的说明配置。The  JExcel package  downloadable  from  JNIWrappper  Download  page  contains
    following:
     - JNIWrapper Native Library (jniwrap.dll)
     - JNIWrapper Library (jniwrap.jar)
     - ComfyJ Library (comfyj.jar)
     - WinPack Library (winpack.jar)
     - Programmer's Guides for JNIWrapper, ComfyJ and JExcel products
     - JExcel usage examples source code
     - JExcel Demo application and its source code
     - JExcel License file (License.txt)
     - This Readme file   Installing Library JAR Files
       ----------------------------
    JExcel uses JNIWrapper, ComfyJ and WinPack  products,  so  all  these  JAR  files 
    should be in the application class path. Native JNIWrapper library (jniwrap.dll) is required  for  JExcel  and  it  should 
    be placed in the working directory of a Java application.All license files should be placed along with native JNIWrapper library or in the
    application's JAR file, in its META-INF folder.
    4) 按照jexcel的JExcel Programmer's Guide就可以开始操作excel了import java.io.File;
    import java.io.IOException;import com.jniwrapper.win32.jexcel.Application;
    import com.jniwrapper.win32.jexcel.ExcelException;
    import com.jniwrapper.win32.jexcel.FileFormat;
    import com.jniwrapper.win32.jexcel.Workbook;
     
    public class Test {
        public static void doSomething(){
            try {
                Application application = new Application();
                application.setVisible(true);
                Workbook workbook = application.createWorkbook("title");
                workbook.setPassword("123"); // 需要密码是123才能打开excel文件。
                workbook.saveAs(new File("C:/test.xls"),FileFormat.WORKBOOKNORMAL, true);
                workbook.close(true);
            } catch (ExcelException e) {
                e.printStackTrace();
            } catch (IOException e) {
                e.printStackTrace();
            }         
        }
        
        public static void main(String[] args) {        
            doSomething();
        }

    over ,睡觉!
      

  6.   


    偶使用了jexcel居然差点把excel整的非常慢,打开要10秒,而且双击文件打开后都是灰色的,不能显示文件内容,
    但是从开始菜单-》程序-》office中直接打开excel程序,再用open file就可以打开文件内容。奇怪解决方法:注册表,要删除 HKEY_CURRENT_USER\Software\Microsoft\Office 
    再打开双击一个excel文件,打开的时候会自动重新配置,耐性等待一下下就好了。真是遇到怪事呀,-.-#
      

  7.   

    公司的程序代码里有这样实现的,就是生成加密的Excel,今天正在研究呢。因为是公用的jar包,所以反编译之后看起来还是有点费事,东西特别多。回头研究好了写个总结上来。