I am encountering problem when using “Workbook.Save” feature in Aspose.Cells. My scenario is as follows:
I have an Excel file (generated from Crystal Report) — See attachment named “Original File(Generated by Crystal Report).xls”. Then I use Aspose.Cells to rename the sheet inside the file and save it again to the same file, see attachment named “File after saving using Aspose.xls”.
But when I take a look inside the new file, all the formatting, including my image is lost.
Below are the codes I used for renaming the sheet:
Aspose.Cells.Workbook objWorkBook = new Aspose.Cells.Workbook(Aspose.Cells.FileFormatType.Excel2003);
Aspose.Cells.Worksheet objWorkSheet = objWorkBook.Worksheets;
if (objWorkSheet != null)
objWorkSheet.Name = “MySheet”;
Appreciate your help.
Thanks & Regards,
Hi Erwin,<?xml:namespace prefix = o ns = "urn:schemas-microsoft-com:office:office" />
Thank you for considering Aspose.
Please use Workbook.Open() method instead of Workbook.LoadData(). Workbook.LoadData() method only fetches the data from the workbook. No formatting will be fetched from the workbook whereas Workbook.Open() will fetch both data and formatting from the template workbook.
Thank You & Best Regards,
Thanks a lot. It is working now.