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

Free Support Forum - aspose.com

New Chart.ToImage feature

Hey guys,
First off, I want to thank for your work on the new chart to image feature. This will really help me out.

However, I started using the feature and I have had a few problems with it. The image does not seem to be formatted the same way as the actual chart. It does not keep the same fonts, sizes and the scale can be different sometimes. My main concern, though, is when it mis draws a line though the middle of the chart or mis draws the chart entirely. I have attached a test ppt input and output so you can see an example of what I am talking about. My code is also below. Any suggestions? Thanks a lot.

Matt


Dim pres As New Aspose.Slides.Presentation(IO.Path.GetFullPath("…\presentation1.ppt"))
Dim shape As Slides.Shape

Dim slide As Aspose.Slides.Slide = pres.Slides.Item(0)
For i As Integer = 0 To slide.Shapes.Count - 1
shape = slide.Shapes(i)
If TypeOf shape Is Aspose.Slides.OleObjectFrame Then
Dim chart As Slides.OleObjectFrame = DirectCast(shape, Slides.OleObjectFrame)
If chart.ObjectProgId = “Excel.Chart.8” Then
Dim book As New Cells.Workbook
Dim stream As New IO.MemoryStream()

stream.Write(chart.ObjectData, 0, chart.ObjectData.Length)
stream.Position = 0
book.Open(stream)
stream.Close()

Dim img As Drawing.Bitmap = book.Worksheets(0).Charts(0).ToImage
img.Save("…\aaa.gif")
Dim dataStream As IO.MemoryStream = book.SaveToStream
Dim dataBuf(CInt(dataStream.Length) - 1) As Byte
dataStream.Position = 0
dataStream.Read(dataBuf, 0, dataBuf.Length)
dataStream.Close()


Dim newShape As Slides.OleObjectFrame

newShape = slide.Shapes.AddOleObjectFrame(shape.X, shape.Y, shape.Width, shape.Height, chart.ObjectClassName, dataBuf)
Dim pic As New Slides.Picture(pres, img)
pres.Pictures.Add(pic)
newShape.PictureId = pic.PictureId
slide.Shapes.Remove(shape)
End If
End If
Next

pres.Write(IO.Path.GetFullPath("…\presentation2.ppt"))

Hi,

We do not support AutoScaleFont(font size is changed with the chart width and height) in the Chart.ToImage();

We have fixed the problem of not keeping the same font and the pos of the legend.

The line in the middle of the chart is major gridline. We are tring to how to fix it. It will take a few days to do.

We will attach the fix if we fix the problem.Thanks for your patience.

Hi,

Please try this in <A href="</A></P>

Yes, the major grid line is gone, but numerous problems still remain. This is a long way from something that I can use in my software release. The fill format really needs to be supported in order for this to work for me. Please continue to keep me updates as progress is made on this issue. I attached files that represent another problematic chart for me. Thanks.

Matt

Heres another file for you guys. The data labels are appearing below the x axis here when they are 0.

Matt

@levinator,

Aspose.Cells has enhanced Chart to image, Chart to PDF and Excel to PDF features to next level. Aspose.Cells’ Chart to image and Chart to PDF features produce results with high fidelity and accuracy.

For details on converting Excel files to PDF, Sheet to image, rendering chart to image and chart to PDF features, please follow the document links below:
Convert Excel Workbook to PDF
Chart Rendering
Converting Worksheet to Image using ImageOrPrint Options

Please download the latest version of Aspose.Cells for .NET from the following link:
Aspose.Cells for .NET (Latest Version)

You may also download the latest demos here for your complete reference.