Hello,
Hi Tim,
You can access the Ole frame inside presentation slide and may access the data inside that using Aspose.Cells. Please watch this video tutorial to achieve the desired goal.
Thanks and Regards,
Thank you for your reply. I had tried this based on the documentation. Unfortunately the shapeEx is not an OleObjectFrameEx, so I can’t cast it. I’d like to emphasize the chart is embedded rather than linked, if that makes a difference. I’m able to access and manipulate the chart w/ the Slides API, but I need some Excel functionality as well.
Hi Tim,
In that case I will request you to please share the source presentation and also code snippet that you are using on your end for this purpose. Please also specify which component you are using for your application. I will further investigate the issue on my end once you will share the requested data.
Thanks and Regards,
Thank you.
And I should mention that the assertion succeeds if I link the chart rather than embed it.
Hi Tim,
I have worked with the presentation shared. It has in fact chart in it and the chart type is ChartEx. Please read this article to get to know how to modify existing charts. In Aspose.Slides for .NET 5.3.0, the dependence on Aspose.Cell for .NET has been removed for charts and it can not be accessed as in case of OleFrames. Please share, if you still have any issue. For your kind reference, I have also shared the chart modified using Aspose.Slides for .NET 5.3.0.
Thanks and Regards,
Yes, I understand the chart can be modified with Aspose Slides. The question was how to access the embedded chart and data with Aspose Cells. There some things (perhaps a lot of things?) that can be done with Cells that can’t be done with Slides. I see it more of a feature than a dependency.
Hi Tim,
I have created an issue with ID 29704 as a new feature request to further investigate the possibility of implementing the requested feature. This thread has been linked with the issue so that you may be automatically notified once the issue is resolved.
We are sorry for your inconvenience,
Not at all. They are all wonderful, wonderful products.
Hi Tim,
- WriteWorkbookStream(MemoryStream ms)
- MemoryStream ReadWorkbookStream()
using Aspose.Slides.Pptx;using Aspose.Slides.Pptx.Charts;using Aspose.Cells;PresentationEx pres = new PresentationEx(“example.pptx”);ChartEx chart = (ChartEx) pres.Slides[0].Shapes[0];Workbook wb = new Workbook(chart.ChartData.ReadWorkbookStream());wb.Worksheets[0].Cells[1, 1].PutValue(150);MemoryStream ms = new MemoryStream();wb.Save(ms, SaveFormat.Xlsx);chart.ChartData.WriteWorkbookStream(ms);pres.Save(“result.pptx”,Aspose.Slides.Export.SaveFormat.Pptx);
Fabulous. Thank you.
Is this supported in the java version as well? If I have a ChartEx I would like to load the workbench. I am assume I am on the right track.
if (shapeEx instanceof ChartEx) {
ChartEx chartEx = (ChartEx) shapeEx;
dkp test = chartEx.getChartData();
}
What is the return type dkp? How do I get a workbook from this or what do I cast to?
Thanks
Good Morning
Thanks for taking the time to write back. I had reviewed the video link you had send before posting the message. In the video it checks for an instance of OLEObjectFrameEx and when I do a check for that it does not enter the if condition as the object in question is a ChartEx
From reading the API documentation the ChatEx extnds the class GraphicalObjectEx and classes that implment that are ChartEx, OleObjectFrameEx, TableEx
So based on this ChartEx and OleObjectFrameEx are at the same level so I can not cast the object to OleObjectFrameEx.
I guess what I am asking is if I have a ChartEx instance how do I get at the data based on the details I explained above. In the .NET sample you can do the following
Workbook wb = new Workbook(chart.ChartData.ReadWorkbookStream());
However in java I can get the ChartData via getChartData() but there is no variable or getter method get WorkbookStream
Thanks
Hi Ashley,
Good Morning
Again thanks for you help but I am using the Java version and the methods do not seem to be the same. Here is the sample source I have so far as you can see it is very short.
I also have attached a screen shot showing the methods on chartEx instance .getCharData() method. This is why I am confused as the methods in question do not seem to exist and the return type for getChartData is “djj"
Can you provide the few lines to get the ChartDataCellFactory in java? Or point out what I am doing wrong?.
Thanks again for you help
Your
Source
import java.io.File;
import java.io.FileInputStream;
import com.aspose.slides.license.AsposeLicenseException;
import com.aspose.slides.pptx.ChartEx;
import com.aspose.slides.pptx.PresentationEx;
import com.aspose.slides.pptx.ShapeEx;
import com.aspose.slides.pptx.ShapesEx;
import com.aspose.slides.pptx.SlideEx;
public class TestApplication {
public static void main(String[] args) {
try {
if (TestApplication.loadLicense(new File(”/c:/dev/aspose/Aspose.Total.Java.lic"))) {
// Instantiate PresentationEx that represents PPTX
PresentationEx pres = new PresentationEx(“c:\ashley.pptx”);
// Access first slide by its index
SlideEx slideEx = pres.getSlides().get(0);
ShapesEx shapesEx = slideEx.getShapes();
int size = shapesEx.size();
for (int i = 0; i < size; i++) {
ShapeEx shapeEx = shapesEx.get(i);
System.out.println(shapeEx.getName());
System.out.println(shapeEx.getClass().getName());
if (shapeEx instanceof ChartEx) {
ChartEx chartEx = (ChartEx) shapeEx;
chartEx.getChartData();
}
}
}
}
catch (Exception exception) {
exception.printStackTrace();
}
}
public static boolean loadLicense(File file) throws AsposeLicenseException {
try {
FileInputStream fileInputStream = new FileInputStream(file);
com.aspose.cells.License cellLicense = new com.aspose.cells.License();
cellLicense.setLicense(fileInputStream);
fileInputStream.close();
fileInputStream = new FileInputStream(file);
com.aspose.slides.License slidesLicense = new com.aspose.slides.License();
slidesLicense.setLicense(fileInputStream);
fileInputStream.close();
return true;
} catch (Exception exception) {
exception.printStackTrace();
return false;
}
}
}
Hi Ashley,
Ok Thanks for the update. Is it possible to tell power point to use an oleframe to generate charts as end users need to design charts without development?
Thanks
Hi Ashley,
You can create excel charts and embed them in your presentation. Kindly use this article for your further reference.
Many Thanks,