Hello.
We use Aspose Cells. NET v.7.3.4.0 to convert XLSX to XLS follows:
Stream stream;
…
var workbook = new Workbook(stream);
foreach (Worksheet worksheet in workbook.Worksheets)
{
worksheet.Zoom = 100;
}
workbook.Save(stream, new XlsSaveOptions(SaveFormat.Excel97To2003));
If the width of the columns in the source XLSX document set as the defaultColWidth and it’s value is less than 0.8, then a collection of columns worksheet.Cells.Columns will be empty.
For example, it’s happens when xl/worksheets/sheet1.xml in XLSX file contains
As a result, output file (XLS) is a zero number of columns and we do not see the data. The width of all columns are set to 0. The values worksheet.Cells.StandartWidth, worksheet.Cells.StandartWidthInch, worksheet.Cells.StandartWidthPixel also equal to 0. However, set these properties correctly does not work: setting of 5 pixels for worksheet.Cells.StandardWidthPixels, the output we have more than 5.
If you put defaultColWidth = “0.8” in sheet1.xml, then XLSX to XLS file converted correctly, but we need to set default width to 0.7109375 in this example.
Note, if XLSX file open in MS Excel 2010 and change width value for all columns to any, and then return back to the original value, then conversion is correctly and in sheet1.xml added following code:
Hi,
Attached please find:
Input.xlsx - input XLSX file
Output.xls - output XLS file (as produced by Aspose.Cells)
Expected.xls - expected XLS file (input XLSX file saved by Excel)
Input XML.jpg - input XLSX source XML
Modified XML.jpg - modified input XLSX file (which Apose.Cells saves correctly)
As to the code snippet we confirm it's exactly the same we use.
Hi,
var workbook = new Workbook(@“E:\test2\1\Input.xlsx”);
foreach (Worksheet worksheet in workbook.Worksheets)
{
worksheet.Zoom = 100;
}
workbook.Save(@“E:\test2\1\myoutput.xls”, new XlsSaveOptions(SaveFormat.Excel97To2003));
The issues you have found earlier (filed as CELLSNET-41290) have been fixed in this update.
This message was posted using Notification2Forum from Downloads module by aspose.notifier.