Sign In  Sign Up Live-Chat

newbie question - chart.toimage looks much different

Last post 07-02-2008, 1:27 PM by Amjad Sahi. 3 replies.
Sort Posts: Previous Next
  •  07-02-2008, 7:52 AM 133965

    newbie question - chart.toimage looks much different

    Attachment: Present (inaccessible)
    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

     
  •  07-02-2008, 9:12 AM 134015 in reply to 133965

    Re: newbie question - chart.toimage looks much different

    Hi,

    Thanks for considering Aspose.

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

    Thank you.

     


    Amjad Sahi
    Support Developer,
    Aspose Nanjing Team
    Contact Us
     
  •  07-02-2008, 9:45 AM 134034 in reply to 134015

    Re: newbie question - chart.toimage looks much different

    Attachment: Present (inaccessible)
    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

     
  •  07-02-2008, 1:27 PM 134078 in reply to 134034

    Re: newbie question - chart.toimage looks much different

    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.

     


    Amjad Sahi
    Support Developer,
    Aspose Nanjing Team
    Contact Us
     
View as RSS news feed in XML