Free Support Forum - aspose.com

Aspose Cell : chart properties are modified by aspose cell

Hi Team,

We are using aspose cell dll to set the active worksheet and save excel file which will be used for further processing.

Aspose cell is modifying the properties of chart and legends of charts in sheet. For example , if I set active sheet manually and send it for further processing result comes correct. If I use aspose cell to set active sheet and process it chart if getting modified by aspose dll.

This difference can be observed when we use the excel file generated by Aspose cell and original excel file in word document as object.

Hope the case is clear; please let me know if you need any details.

OriginalExcel.xlsx: Original excel file.

AsposeCellResult.xlsx : result of Original file used in aspose cell to set active sheet.

WithAsposeCell.docx: contains aspose cell result excel files used in word document.

WithoutAsposeCell.docx: original file added in word document, by setting active sheet manually.

Thanks and Regards,

Nakul

Hi,


Thanks for the sample files.

Could you elaborate what are the significant differences/properties (that are changed for the chart objects) for the resultant Excel file generated by Aspose.Cells. Please also provide us the sample code (runnable) that you are using to get the output Excel file from original template file. Also, we would appreciate if you could highlight the problematic areas (encircling with red color) while comparing with Excel result (original) vs Aspose.Cells result. We will look into your issue soon.

Also, provide the Excel template file that is generated by manually doing the task in MS Excel.

Thank you.
Hi Amjad,

We did not perform any operation by opening excel sheet in Aspose Cell API. We have just set active sheet to some index in excel file as below.
Workbook workBook = new Workbook(excelStream);
//workBook.Worksheets[0].AutoFitColumns();
workBook.Worksheets.ActiveSheetIndex = workBook.Worksheets[codeName].Index;
workBook.Save(excelStream2, Aspose.Cells.SaveFormat.Xlsx);
excelStream2 is saved to file later.

I can only feel difference when i add same excel object in MS- Word document as part of object.

You can observe the difference between word document which holds original excel and excel saved by Aspose Cell API.

Refer to images which are taken from respective word document.

I have highlighted problem area in WithAsposecell.png with red color squares.

Hope it is clear, please let me know if you need any details.

Thanks and regards,
Nakul

Hi Nakul,


I have tested your issue, Aspose.Cells works fine. It generates the image (attached) for the chart sheet fine (similar to original charts that are displayed in MS Excel), also the re-saved file (attached) by Aspose.Cells is fine same as its original file. So, regarding the product, there is no issue at all. If you are talking about when you insert the Excel file into MS Word as an OLE Object (using MS Excel or so), the chart is detereorated abit and the formatting looks ugly a bit. I have tested this issue as well. I confirmed both your “OriginalExcel.xlsx” and re-saved file “myresultant_file.xlsx” (by Aspose.Cells) has this issue. So, it is not an issue with Aspose.Cells. I checked it inserting your “OrignalExcel.xlsx” file into MS Excel as an Object using MS Word, I have taken a screen shot for it, please see the screen shot attached here.
Moreover, Aspose.Cells is only responsible for generating image file for the sheet and Excel file, both should be fine tuned which they are. You may check the image into Image viewer and also open the Excel file into MS Excel (re-saved file), the file is fine and display the charts fine. Regarding the issue when it comes to insert the Excel file as an Ole Object into e.g MS Word, it is totally different architecture and does not have any concerns for the issue.

Here is the sample code that I am using:

Sample code:

Workbook wb = new Workbook(“e:\test2\OriginalExcel.xlsx”);
Worksheet sheet = wb.Worksheets[1];
ImageOrPrintOptions options = new ImageOrPrintOptions();
options.ImageFormat = ImageFormat.Png;

SheetRender sr = new SheetRender(sheet, options);
sr.ToImage(0, “e:\test2\myresultant_image.png”);

wb.Save(“e:\test2\myresultant_file.xlsx”);


Note: I am using latest fix i.e. v7.3.5.1, we also recommend you to download and try the latest fix/version: Aspose.Cells for .NET v7.3.5.1


Thank you.