Excel found unreadable contnet in "FileName.xls" - Runs on some servers

I am getting a "Excel found unreadable contnet in FileName.xls. Do you want to recover the contents of this workbook? If you trust the source of the workbook, click Yes." error when opening a file created by Aspose.Cells. However, I only recieve the error when I install my application on my staging server. On three other machines I do not get the error. The only change that I have made was upgrading my project to .NET 4.0. Any ideas what might be causing the issue on one server only?

Hi Colin,

Please forward us the template file, the file generated by Aspose.Cells and the code sample. So that we can look into it in order to find out the root cause of the issue.

Thanks,

Attached is the template file and the file it creates using the code below.

Cheers

/*** START ***/

var templateFilePath = GetExcelFilePath();

if (!File.Exists(templateFilePath)) {

throw new Exception("Unable to find the template Excel file");

}

var templateFileInfo = new FileInfo(templateFilePath);

var tempRequestFile = Path.Combine(HttpRuntime.CodegenDir, Guid.NewGuid() + templateFileInfo.Extension);

FileStream fileStream = new FileStream(templateFileInfo.FullName, FileMode.Open);

var excelFile = new Workbook();

excelFile.Open(fileStream, templateFileInfo.Extension.EndsWith(".xlsx", true, CultureInfo.InvariantCulture) ? FileFormatType.Excel2007Xlsx : FileFormatType.Default);

var dataTable = new DataTable("RawData");

var firstRow = true;

foreach (var valueRow in values) {

if (firstRow) {

for (var col = 0; col < columnTypes.Count(); col++) {

dataTable.Columns.Add(new DataColumn(values.First().ElementAt(col).ToString()));

}

firstRow = false;

continue;

}

var row = dataTable.NewRow();

for (var col = 0; col < valueRow.Length; col++) {

row[col] = valueRow[col] == DBNull.Value ? string.Empty : valueRow[col];

}

dataTable.Rows.Add(row);

}

const int HEADER_ROW_COUNT = 1;

for (var row = 0; row < dataTable.Rows.Count; row++) {

for(var col=0; col < dataTable.Columns.Count; col++) {

excelFile.Worksheets["RawData"].Cells[row+HEADER_ROW_COUNT, col].PutValue(dataTable.Rows[row][col].ToString(), true);

}

}

for (var col = 0; col <= values.First().Length; col++) {

excelFile.Worksheets["RawData"].Cells.HideColumn(col);

}

if (excelFile.Worksheets.Count > 1) {

excelFile.Worksheets["RawData"].IsVisible = false;

}

var reportFilesPassword = "password";

if (!string.IsNullOrEmpty(reportFilesPassword)) {

excelFile.Worksheets["RawData"].Protect(ProtectionType.All, reportFilesPassword, null);

}

excelFile.Save(tempRequestFile, FileFormatType.Default);

fileStream.Close();

/*** END ***/

Hi Colin,

We have a found the issue. The issue has been logged into our Issue Tracking System with ID CELLSNET-20672. We will update you with the solution soon.

Thanks,

Thank you. Is there anyway I can track the progress? Any idea when might I have a solution?

Cheers!

Hi Colin,

We are continuously working on the issues. We will try our best to update you as soon as possible. Most probably with in 10 to 15 days we are about to release a new version and i am sure that your mentioned issue will be resolved in this version.

Furthermore, we will look for the possibility to provide you some path for the issue.

Thanks,

Hi Colin,

We have tried to reproduce the issue mentioned by you. We used .Net 4.0 but unable to find any issue. Can you please forward us some more information.

Thanks,

The issues you have found earlier (filed as 20672) have been fixed in this update.


This message was posted using Notification2Forum from Downloads module by aspose.notifier.