Korumalı bir excel dosyasının şifresini öğrenmek için aşağıdaki uygulamadan faydalanabiliriz.
private void button1_Click(object sender, EventArgs e)
{
DialogResult result = openFileDialog1.ShowDialog();
if (result == DialogResult.OK)
{
string startPath = @"c:\Temp\temploc\";
if (Directory.Exists(startPath))
{
DirectoryInfo di = new DirectoryInfo(startPath);
di.Delete(true);
Directory.CreateDirectory(startPath);
}
System.IO.Compression.ZipFile.ExtractToDirectory(openFileDialog1.FileName, startPath);
string exlFile = File.ReadAllText(@"C:\Temp\temploc\xl\worksheets\sheet1.xml");
string[] str = exlFile.Split('<','>');
foreach (string aranan in str)
{
if (aranan.Contains("sheetProtection"))
{
string[] bul = aranan.Split('"','"');
textBox1.Text = bul[1];
}
}
}
}

No comment