首页 > 代码库 > 打开加密excel 和 自定义c#dll目录

打开加密excel 和 自定义c#dll目录

POIFSFileSystem pfs = newPOIFSFileSystem(POIDataSamples.getPOIFSInstance().openResourceAsStream("yourexcelfile.xlsx")); 
EncryptionInfo encInfo = new EncryptionInfo(pfs); 
Decryptor decryptor = new Decryptor(encInfo); 
decryptor.verifyPassword("ABCXYZ"); 
XSSFWorkbook wb = new XSSFWorkbook(decryptor.getDataStream(pfs));

 

打开加密excel。

 

自定义dll目录

 

        private void Form1_Load(object sender, EventArgs e)
        {
            AppDomain.CurrentDomain.AssemblyResolve += new ResolveEventHandler(CurrentDomain_AssemblyResolve);
        }
        static Assembly CurrentDomain_AssemblyResolve(object sender, ResolveEventArgs args)
        {
            AssemblyName assemblyName = new AssemblyName(args.Name);
            return Assembly.LoadFrom(Path.Combine(Application.StartupPath, "3rdLibs"));
        }

 

打开加密excel 和 自定义c#dll目录