Hi,
I’m trying to fix a bu where our export file say’s it has a problem with the content, and prompts for a repair. the message is "We found a problem with some content "
then
"Excel completed file level validation and repair. Some parts of this workbook may have been repaired or discarded."
the data is all there when the repair is completed, so I don’t know what it is fixing.
I’ve gotten this error with both version 7.0.4 and the 8.2 evaluation version, Office 2013
can you please help me figure out what I’m doing wrong?
we are calling in like so:
// call export method to generate the fill stream for export
MemoryStream stream = Hiperos.EvaluationExport.ExporterUtilities.ReturnStreamFromDataTable(dbKey, dt, exportString);
//return the memory stream bytes application/vnd.openxmlformats-officedocument.spreadsheetml.sheet
return this.Doc(stream.GetBuffer(), “Alerts.xlsx”, “application/vnd.openxmlformats-officedocument.spreadsheetml.sheet”);
public static MemoryStream ReturnStreamFromDataTable(DatabaseKey dbKey, DataTable dataTable, string description, bool fullDateTime = false)
{
//Set up the license…
//License license = new License();
//license.SetLicense(“Aspose.Cells.lic”);
//Create a new 2003 workbook
Workbook workbook = new Workbook();
//Get the first worksheet in the workbook
Worksheet sheet = workbook.Worksheets[0];
//Get the cells collection in the worksheet
Cells cells = sheet.Cells;
//Get Style Object
Aspose.Cells.Style style = cells[“A1”].GetStyle();
//the font text is set to bold
style.Font.IsBold = true;
//Apply style to the cell
cells[“A1”].SetStyle(style);
sheet.Cells[“A1”].PutValue(description);
//Import the datacolumn in the datatable to the sheet cells
sheet.Cells.ImportDataTable(dataTable, true, 1, 0);
// Set the datetime format based on the users culture
Style dateTimeFormat = workbook.CreateStyle();
if (fullDateTime)
{
dateTimeFormat.Custom = new CultureInfo(dbKey.Culture).DateTimeFormat.FullDateTimePattern;
}
else
{
dateTimeFormat.Custom = new CultureInfo(dbKey.Culture).DateTimeFormat.ShortDatePattern;
}
StyleFlag flag = new StyleFlag {All = true};
foreach(DataColumn column in dataTable.Columns)
{
if(column.DataType == typeof(DateTime))
{
// first row = 1 because A1 has the description
// first column is the index of the column
// total rows is the number of rows - 1 (because of the description)
sheet.Cells.CreateRange(1, column.Ordinal, sheet.Cells.Rows.Count - 1, 1).ApplyStyle(dateTimeFormat, flag);
}
}
//Autofit all the columns in the sheet
sheet.AutoFitColumns();
MemoryStream stream = new MemoryStream();
//take the results to a memory stream
workbook.Save(stream, new OoxmlSaveOptions(SaveFormat.Xlsx));
return stream;
}