Thursday, 11 August 2011 03:06

Decrypt Excel Worksheet in C#, VB.NET

Why Decrypt Excel Worksheet?

To protect our Excel file data information, we can encrypt Excel worksheet by setting password. But we may sometimes forget the password and we can't read the excel data information neither. So, if this happens we need decrypt Excel worksheet. It’s not easy to decrypt Excel Worksheet which has been encrypted because the reason why we encrypt it is to prevent it from reading by people without password. And now, we do not have password.

How to Use C#/VB.NET to Decrypt Excel Worksheet?

Spire.XLS for .NET, a .NET Excel component which enables .NET applications to fast generate, read, write and modify Excel document without Microsoft Office Excel Automation can help us decrypt Excel worksheet by using C#/VB.NET.

Spire.XLS for .NET presents a very easy solution for developers/programmers decrypting Excel worksheet. We just need sheet.Unprotect( "password" ) method and normal encrypted excel worksheet can be decrypted.

Download Spire.XLS for .NET (or Spire.Office) with .NET framework 2.0 (or above) together. The sample code below will show you how to use C#/VB.NET decrypt Excel worksheet through Spire.XLS for .NET.

[C#]
Workbook workbook = new Workbook();
         workbook.LoadFromFile("test.xls");
         Worksheet sheet = workbook.Worksheets[0];
         sheet.Unprotect( "password" );
         workbook.SaveToFile("result.xls",ExcelVersion.Version97to2003);
[VB.NET]
Dim workbook As Workbook
workbook.LoadFromFile("test.xls")
            Worksheet sheet = workbook.Worksheets(0)
            sheet.Unprotect( "password" )
            workbook.SaveToFile("result.xls",ExcelVersion.Version97to2003)

Spire.XLS allows users to operate Excel document directly such as save to stream, save as web response, copy, lock/unlock worksheet, set up workbook properties, etc. As a professional .NET Excel component, it owns the ability of inserting content into Excel document, formatting cells and converting Excel documents to popular office file formats. Spire.XLS for .NET supports Excel 97-2003, Excel 2007 and Excel 2010.

Published in Security
Wednesday, 06 April 2011 09:27

PDF Decrypt in C#, VB.NET

The sample demonstrates how to decrypt an encrypted PDF document and extract the embedded picture.

Published in Security
Tuesday, 18 January 2011 04:01

Decrypt Word Document in C#, VB.NET

Word Decryption is a process to decode encrypted Word document. It requires a password or secret key. If readers want to open and read a protected Word, they need to decrypt this Word document firstly. This guide demonstrates an easy and convenient solution to decrypt Word in C# and VB.NET via Spire.Doc for .NET.

Spire.Doc for .NET, specially developed for programmers to manipulate Word without Word Automation, provides users a method Document.LoadFromFile(String fileName, FileFormat fileFormat, String password) of Document class to open encrypted Word document. It also provides another method Document.RemoveEncryption() to decrypt Word without any protection. Through these two methods, users can decrypt Word easily with Spire.Doc for .NET. Download and install Spire.Doc for .NET. Then follow the code to decrypt.

[C#]
using Spire.Doc;

namespace DecryptWord
{
    class Decryption
    {
        static void Main(string[] args)
        {
            //Load Encrypted Word
            Document document = new Document();
            document.LoadFromFile(@"E:\Work\Documents\Student Transcript.docx", FileFormat.Docx,"123456");

            //Decrypt
            document.RemoveEncryption();
            
            //Save and Launch
            document.SaveToFile("decryption.docx", FileFormat.Docx);
            System.Diagnostics.Process.Start("decryption.docx");
        }
    }
}
[VB.NET]
Imports Spire.Doc

Namespace DecryptWord
    Friend Class Decryption
        Shared Sub Main(ByVal args() As String)
            'Load Encrypted Word
            Dim document As New Document()
            document.LoadFromFile("E:\Work\Documents\Student Transcript.docx", FileFormat.Docx, "123456")

            'Decrypt
            document.RemoveEncryption()

            'Save and Launch
            document.SaveToFile("decryption.docx", FileFormat.Docx)
            System.Diagnostics.Process.Start("decryption.docx")
        End Sub
    End Class
End Namespace

Spire.Doc, professional Word component, is specially designed for developers to fast generate, write, modify and save Word documents in .NET, Silverlight and WPF with C# and VB.NET. Also, it supports conversion between Word and other popular formats, such as PDF, HTML, Image, Text and so on, in .NET and WPF platform.

Published in Security
Thursday, 22 July 2010 07:10

Word Decrypt in C#, VB.NET

The sample demonstrates how to decrypt a document.

Published in Protect