Newbie question - chart.toimage looks much different

Hello,

I am brand new to Aspose. We are considering using it as a charting engine in a Winforms VB.NET program. To test it, I took one of our existing spreadsheets, opened it using Aspose, and saved one of the charts in the spreadsheets to a jpg using the .ToImage function. Below is the code I used.

The resultant chart doesn’t contain any of the formatting of the original chart in the spreadsheet. Colors are different among other things.

I have attached a side by side showing the chart as it looks in Excel (left), and as it looked after the Aspose.ToImage method. Is there a way to get the two to look identical?

thank you,
matt tagliaferri

Dim wb As Workbook
Dim ws As Worksheet
Dim c As Chart

wb = New Workbook
Try
wb.Open(“C:\Documents and Settings\mtagliaf\Desktop\Datasheet2.xlsx”, FileFormatType.Excel2007Xlsx)
ws = wb.Worksheets(0)
c = ws.Charts(1)
c.ToImage(“c:\testimage.jpg”)
Catch ex As Exception
Debug.WriteLine(ex.Message)
End Try

Hi,

Thanks for considering Aspose.

Could you post your template excel file. We will check the issue soon.

Thank you.

File attached. I also modified my test code to export ALL charts on the first page (there are 5 charts in the sample spreadsheet). That test code is below (all work done in folder C:\Temp)

Using this test code, all 5 chart images do get exported, but all have the default Excel colors.

thanks for your prompt attention
matt tagliaferri

Dim wb As Workbook
Dim ws As Worksheet
Dim c As Chart
Dim cName As String

wb = New Workbook
Try
wb.Open(“C:\Temp\DatasheetAspose.xlsx”, FileFormatType.Excel2007Xlsx)
ws = wb.Worksheets(0)
For i As Integer = 0 To ws.Charts.Count - 1
c = ws.Charts(i)
cName = “c:\temp\testimage”
cName &= i.ToString
cName &= “.jpg”
c.ToImage(cName)
Next
Catch ex As Exception
Debug.WriteLine(ex.Message)
End Try

Hi,

Thanks for providing us the template file.

Since you are exporting chart contained in an .xlsx file to images, well, exporting and manipulating charts in .xlsx files are not completely supported so you got formattings lost. We are working on the charts (in .xlsx files) feature, hopefully we will support it in our future versions.

Thank you.