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")); }
时间: 2024-11-10 13:09:35