这是我第一次使用ExcelLibrary,我似乎遇到了一个小问题。我正在使用以下代码保存测试文件:
Workbook workbook = new Workbook();
Worksheet worksheet = new Worksheet("Sheet 1");
//Write the first row
worksheet.Cells[0, 0] = new Cell("Name");
worksheet.Cells[0, 1] = new Cell("Address");
worksheet.Cells[0, 2] = new Cell("Phone");
worksheet.Cells[0, 3] = new Cell("Fax");
worksheet.Cells[0, 4] = new Cell("E-mail");
worksheet.Cells[0, 5] = new Cell("Contact Person/s");
worksheet.Cells[0, 6] = new Cell("Domain/s of Activity");
worksheet.Cells[0, 7] = new Cell("Number of Employees");
worksheet.Cells[0, 8] = new Cell("Turnover");
workbook.Worksheets.Add(worksheet);
workbook.Save(sfd.FileName);
但是当我尝试打开文件时,我收到一个警告框,说它不可读。我在Excel 2010中打开文件,只是作为旁注,我可以打开其他.xls文件而不是程序生成的文件。
我做错了什么?
感谢。