Hi,
We upgraded from 19.4 to 19.9 and saving an Xls file now is removing all Document and Custom Properties. Saving the same file as XlsX does not have the issue.
Excel Properties.zip (4.8 MB)
I have attached a basic sample EXE with the issue. Please place a license file in the exe directory. It has an XLS file as an internal resource.
- Click “Original Xls” to save to the exe directory and open in Excel. No Aspose calls)
- Click “Save As Xls” to save to the exe directory, Open in Aspose.Cells, save as XLS (no processing) and open in Excel.
- Click “Save As XlsX” to save to the exe directory, Open in Aspose.Cells, save as XLS (no processing) and open in Excel.
You will see that the “Save As Xls” version has no properties anymore. You can see the code used in this form below. the “Save As” buttons just open the file and save. It should not change any properties of the file.
private void button1_Click(object sender, EventArgs e)
{
File.WriteAllBytes("Test_Document.Xls", Properties.Resources.Test_Document);
Process.Start("Test_Document.Xls");
}
private void button2_Click(object sender, EventArgs e)
{
File.WriteAllBytes("Test_Document.Xls", Properties.Resources.Test_Document);
LoadOptions cellLoadOptions;
Workbook cellWorkbook = null;
cellLoadOptions = new LoadOptions(LoadFormat.Excel97To2003);
cellWorkbook = new Workbook("Test_Document.Xls", cellLoadOptions);
XlsSaveOptions saveOptions = new XlsSaveOptions(SaveFormat.Excel97To2003);
cellWorkbook.Save("Test_Document_Saved.Xls", saveOptions);
cellWorkbook.Dispose();
Process.Start("Test_Document_Saved.Xls");
}
private void button3_Click(object sender, EventArgs e)
{
File.WriteAllBytes("Test_Document.Xls", Properties.Resources.Test_Document);
LoadOptions cellLoadOptions;
Workbook cellWorkbook = null;
cellLoadOptions = new LoadOptions(LoadFormat.Excel97To2003);
cellWorkbook = new Workbook("Test_Document.Xls", cellLoadOptions);
OoxmlSaveOptions saveOptions = new OoxmlSaveOptions(SaveFormat.Xlsx);
cellWorkbook.Save("Test_Document_Saved.XlsX", saveOptions);
cellWorkbook.Dispose();
Process.Start("Test_Document_Saved.XlsX");
}