using System; using System.Collections.Generic; using System.ComponentModel; using System.Data; using System.Drawing; using System.Text; using System.Windows.Forms; using Docs.Excel; namespace PasswordProtection { public partial class Form1 : Form { public Form1() { InitializeComponent(); } private void Form1_Load(object sender, EventArgs e) { // Read .xls file with password encription. ExcelWorkbook wbook = ExcelWorkbook.ReadXLS(@"..\..\..\PasswordExcel.xls", "qwerty"); // Display data of the excel workbook // without first row of headers DataTable dtable = wbook.Worksheets[0].WriteToDataTable(1,0); dataGridView1.DataSource = dtable; // Create columns for (int i = 0; i < wbook.Worksheets[0].Columns.Count; i++) { dtable.Columns[i].ColumnName = wbook.Worksheets[0].Columns[i].Cells[0].Value.ToString(); } } } }