We're sorry Aspose doesn't work properply without JavaScript enabled.

Free Support Forum - aspose.com

Aspose loses XLS settings

I have a simple program that does nothing more than Load an XLS file and writes it back out. Row formatting information is lost. I've attached a sample spreadsheet and the code for the sample application. For instance, row 70 in the original file was resized by the user, but when the file is saved back out, the row's size has reverted to the default row size, thus making the text appear truncated.

I discovered this when opening the spreadsheet and asking each row for it's height - they all returned the default row height, which in the original file, isn't the case.

Is there something that I need to do to preserve the original formatting/style information?

Note: (Give the sample app a moment to present the file open dialog)


Thanks for providing us the template project.

Since in your code you are using Workbook.LoadData() method. For your info, formattings and other contents or settings might be lost all as the method only extract data from the excel file. Please use Workbook.Open() method instead. I think you may change your code as follows:


OpenFileDialog ofd = new OpenFileDialog();
ofd.DefaultExt = ".xls";
string xlsFile = ofd.FileName;

Workbook book = new Workbook();

string outputdir = Path.GetDirectoryName(xlsFile);
string newxslfile = Path.Combine(outputdir, Path.GetFileNameWithoutExtension(xlsFile) + "_asposeout2003" + Path.GetExtension(xlsFile));
book.Save(newxslfile, FileFormatType.Excel2003);

Thank you.