读/写Excel 2007密码保护的文档 [英] Read/write Excel 2007 password-protected documents

查看:119
本文介绍了读/写Excel 2007密码保护的文档的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

Office 2007用于加密的方法(从Office菜单中选择加密和设置密码时)?

What method does Office 2007 use for encryption (when choosing Encrypt and setting a password from Office menu)?

我的C#应用​​程序需要创建和读取加密的Excel 2007文件(.xlsx)。重要的是这些文件可以从Excel访问,所以我必须使用Microsoft的加密方法,不能自己创建。

My C# app needs to create and read encrypted Excel 2007 files (.xlsx). It is important that these files remain accessible from Excel, so I must use Microsoft's encryption method, can't brew my own.

正常的Excel 2007文件是一个ZIP压缩文件,我正在使用 ExcelPackage 访问它,内部使用* System.Io.Packaging.Package *(

Normal Excel 2007 file is a ZIP-compressed file, and I'm accessing it using ExcelPackage, which internally uses * System.Io.Packaging.Package* (part of .net 3.0).

但是,Office中的加密是标准的ZIP加密。 Package类似乎不支持加密,并报告损坏的文件。 7Zip打开文件(没有提供密码),并显示一些二进制文件。

However, the encryption in Office is not the standard ZIP encryption. The Package class seems not to support encryption, and reports a corrupted file. 7Zip opens the file (with no password provided) and shows a few binary files inside.

推荐答案

根据几个开源的部分,我创建了一个 OoXmlCrypto stream 包装器可以轻松访问Office 2007加密文件。

Based on several open source bits and pieces, I created a OoXmlCrypto stream wrapper to access Office 2007 encrypted files easily.

这是基于博客发布源代码这是OOXML加密/解密。

This is based on a blog post with source code which does OOXML encryption/decryption.

这篇关于读/写Excel 2007密码保护的文档的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆