Powerpoint editable chart with error messege "Object changed "

Hi Team,

I want to impliment a class which will export the data to powerpint ,to achieve this i want to use Aspose.we struck with below problem and not able to proceed furthur.Please provide solution .

i want to export data to powerpoint template having editable chart for that i wrote the below code.

I have a problem of messege "Object changed" after exporting,for removing this messge i added image to my object.But i don't want this method ,please suggest if any other method is aviable to remove the messege.

The below code(using spreadsheet) is supporting for Office 2007 ,it is not supporting office 2003.please provide solution in office 2003.

void AddMSGraphObject()

{

//Create powerpoint file and find the

Aspose.Slides.Presentation srcPres = new Aspose.Slides.Presentation();

srcPres = new Aspose.Slides.Presentation(Server.MapPath("PPTTemplates/Template.ppt"));

Slide fstSlide = srcPres.GetSlideByPosition(1);

Aspose.Slides.Shape srcShape = fstSlide.FindShape("Chart");

OleObjectFrame msGrphObj = srcShape as OleObjectFrame;

byte[] xlsData = msGrphObj.ObjectData;

MemoryStream memst = new MemoryStream(xlsData, true);

System.Data.DataTable dt = GetData();

WorkbookDesigner wbd = new WorkbookDesigner();

wbd.Open(memst);

wbd.SetDataSource(dt.DefaultView.ToTable(true, "Region", "Spend"));

Workbook wb = wbd.Workbook;

msGrphObj.ObjectData = wb.SaveToStream().ToArray();

Aspose.Cells.Chart objChart = wb.Worksheets[0].Charts[0];

string tempPath = Path.GetTempFileName();

objChart.ToImage(tempPath, System.Drawing.Imaging.ImageFormat.Png);

Aspose.Slides.Picture pic = new Aspose.Slides.Picture(srcPres, tempPath);

int picid = srcPres.Pictures.Add(pic);

msGrphObj.PictureId = picid;

Response.Clear();

Response.ContentType = "application/vnd.ms-powerpoint";

Response.AppendHeader("Content-Disposition", "attachment; filename=Account monthly Sales.ppt");

srcPres.Write(Response.OutputStream);

Response.Flush();

Response.End();

}

Thanks & Regards

Kumar Reddy

Hi Kumar,

Thanks for your interest in Aspose.Slides.

The issue of object that you have pointed to is not related to Aspose.Slides actually. Please follow this documentation link for further details. Please also follow this documentation link as a possible work around for you.

Thanks and Regards,

Hi Fayyaz ,

Thank you for your past reply.

As you suggested i cann't use "Add-ins",because in my client machines macro's are disabled.i cann't tell every time enable the macros.

please provide any other alternative solution like using .net code updating the oleobject and open the powerpoint some thing like...

The second solution adding image ,i cann't use that method because when i open the power point i want to see the chart object .using this method i can see the image which i added.

please provide the generic solution in .net. without any installation

Appreciate your help on this.

Thanks & Regards

Kumar Reddy E.

Hi Kumar,

As I mentioned earlier that issue of activating OLE Object and displaying of "Object changed" message in OLE Object of the generated presentation is not related to Aspose.Slides. I have already suggested the possible way out to you. Morever, Aspose.Slides also does not support editable charts inside it. You can update the chart by double clicking the OLE Object values and modifying them manually.

We are sorry for your inconvenience,

Hi Fayyaz,

Thank you so much for your help in solving my problem.

i have one query,can i convert aspose presentation object to microsft presentation object like below...

when i am trying to convert it is showing error messege "we cann't convert".Is there any way for conversion.

//Aspose object

Aspose.Slides.Presentation srcPres = new Aspose.Slides.Presentation();

srcPres = new Aspose.Slides.Presentation(Server.MapPath("PPTTemplates/Templatetwoobjects.ppt"));

Microsoft.Office.Interop.PowerPoint.Presentation presenet = (Microsoft.Office.Interop.PowerPoint.Presentation)srcPres;

Hi Kumar,

I regret to inform you that Aspose.Slides is a stand alone product with its own internal structure and architecture. So far it has no compatibility to work with object of Microsoft Presenetation.

We are sorry for your inconvenience,

Hi Fayyaz,

Thank you for your help.

I need one help from you.

I have a powerpoint template which is having chart object.i want to update the chart source using Asp.net .I don't want to change the chart format everything should be same.I tried with below code data is not changing.Please provide the solution for it.

OleObjectFrame msGrphObj = srcShape as OleObjectFrame;

byte[] xlsData = msGrphObj.ObjectData;

MemoryStream memst = new MemoryStream(xlsData, true);

System.Data.DataTable dt = GetData();

WorkbookDesigner wbd = new WorkbookDesigner();

wbd.Open(memst);

wbd.SetDataSource(dt);

Workbook wb = wbd.Workbook;

msGrphObj.ObjectData = wb.SaveToStream().ToArray();

Thanks & Regards

Kumar Reddy E

Hi Kumar,

I have observed the code snippet shared by you and it seems to be some issue with the data table that you might be using. I have modified the code by using setting reference to an excel sheet in the workbook object and things seems to work. For your kind information, I have also shared the template chart and output PPT file as well. I have used the following code snippet.

OleObjectFrame msGrphObj = srcShape as OleObjectFrame;
byte[] xlsData = msGrphObj.ObjectData;

MemoryStream memst = new MemoryStream(xlsData, true);

System.Data.DataTable dt = GetTable();

WorkbookDesigner wbd = new WorkbookDesigner();

wbd.Open("D:\\ppt\\excel2.xls");
//wbd.Open(memst);
//wbd.SetDataSource(dt);

Workbook wb = wbd.Workbook;

//Aspose.Cells.Chart ch = wb.Worksheets[0].Charts[1];
msGrphObj.ObjectData = wb.SaveToStream().ToArray();

We are sorry for your inconvenience,

Hi Fayyaz

I will explain what i need exactly,i think my previous questions might be confusing you.

I have a powerpoint template,which is having editable chart object in slide1.I have a data table fetching from sql server.

I want to use the chart object present in slide1 and update the values for the chart using my data table.I want to change the datasource ranges as well.

Here i don't want to change any format of the template and chart, even series color also.

If this is possible i will purchase Aspose licenced version for implimenting in my project.

Please send your solution for this .

Thanks &Regards

Kumar Reddy E

Hi Kumar,

We are extremely sorry for your inconvenience,

I have observed the specified problem in detail and the issue of data source not getting changed is more related to Aspose.Cells. I will request our Aspose.Cells support team to help you further in this matter.

Thanks and Regards,

Hi,

I am not sure if I understand you correctly.
Well, for your information, once you embed the saved spreadsheet/chart (by Aspose.Cells API)
as ole object into the powerpoint slide, how could you edit/get it again using Aspose.Cells API to make it updated.
Generally, Aspose.Cells provides control before embedding the generated
workbook as Ole Object into powerpoint and you can do it freely, Once the spreadsheet/workbook is saved (with the updated chart) to be embedded into the slide, then the control is shifted to
the PowerPoint (Aspose.Slides).

Moreover, you cannot specify a data table as chart data source directly as Aspose.Cells for .NET does not support to directly set a data table as chart’s data source. You need to import data table to the worksheet first. You can import data table into your worksheet cells and then can change the data source for the existing chart based on the range of cells (for imported data table range). For this purpose, you can use Cells.ImportDataTable() method, see the document for reference:
http://www.aspose.com/documentation/.net-components/aspose.cells-for-.net/importing-data-to-worksheets.html Also, you can use Smart Markers feature if your template file has smart markers inside its worksheet cells and you can specify the data table as its source. In this way, if your template chart has its data source based on the smart markers, so, when the markers are processed based on you data table, the chart would be updated.



Thank you.