Object Changed Error


#1

Before our client buys licenses for this product, I would like to know why embedding an excel object into Aspose.Slides gives an error of "Object Changed." After scouring your forums, I've found this to be a very big annoyance. Some users resort to using macro's to double-click the object??? Is there plans to fix this issue Alexey? Can you explain what is happening?

It seems that using the HTMLwriter to output excel files from a datagrid and adding the object to a ppt slide gives an error. Can Aspose.slides component read HTML formatted .XLS files??

Thank you in advance.


#2

“Object Changed” text is not error it’s just information that object was changed and image should be updated.
I explained problem in the same posts.

To fix it we need create image of excel sheet or image of excel chart. We don’t have ways to do it.
If you can create such image you may use it instead of “Object Changed” text.

About html formatted .XLS files.
Can you insert html formatted xls files to a slide as OLE object in MS PowerPoint?
I think you can’t. That means you can’t do it also in Aspose.Slides.


#3

Alexey, thank you for the reply. I will try to create an image of the excel sheet and have users double-click when they would like to edit.

Yes, we can export an HTML formatted .xls file to powerpoint. Powerpoint recognizes the formatting and does it's best to match text, background colors, font colors, lines, etc...If it's an Office product that isn't below 2K, it should be able to interpret the HTML. Otherwise, might have to go with the tab delimited formatting.

The problem here is that when I create an Oleobject in Aspose and pass the HTML formatted XL worksheet, and I double-click the "Object Changed" image, it gives me the generic error everyone gets ("cannot find file/other error/please reinstall server app"). However, when I create a brand new, UNFORMATTED excel worksheet and read it in Aspose, I can go ahead a see the excel worksheet. I mean it works when I do it without Aspose, but with your product, it seems it can't handle the extra HTML information included in the excel file. Can you help find a solution for this?

(I've actually went to the COM route of embedding an excel worksheet into powerpoint directly until I came across the Aspose.Slides product.)

1. This is how you can embed an html formatted excel object in powerpoint:

private void PPT()
{
String strTemplate, strPic;
strTemplate = "C:\\Program Files\\Microsoft Office\\Templates\\Presentation Designs\\Blends.pot";

PowerPoint.Application objApp;
PowerPoint.Presentations objPresSet;
PowerPoint._Presentation objPres;
PowerPoint.Slides objSlides;
PowerPoint._Slide objSlide;
PowerPoint.TextRange objTextRng;
PowerPoint.Shapes objShapes;
PowerPoint.Shape objShape;
PowerPoint.SlideShowWindows objSSWs;
PowerPoint.SlideShowTransition objSST;
PowerPoint.SlideShowSettings objSSS;
PowerPoint.SlideRange objSldRng;
Graph.Chart objChart;

//Create a new presentation based on a template.
objApp = new PowerPoint.Application();
objApp.Visible = MsoTriState.msoTrue;
objPresSet = objApp.Presentations;
objPres = objPresSet.Open(strTemplate,
MsoTriState.msoFalse, MsoTriState.msoTrue, MsoTriState.msoTrue);
objSlides = objPres.Slides;

//Build Slide #1:
//Add text to the slide
objSlide = objSlides.Add(1,PowerPoint.PpSlideLayout.ppLayoutTitleOnly);
objTextRng = objSlide.Shapes[1].TextFrame.TextRange;
objTextRng.Text = "My Sample Presentation";
objTextRng.Font.Name = "Comic Sans MS";
objTextRng.Font.Size = 48;
objSlide.Shapes.AddPicture(strPic, MsoTriState.msoFalse, MsoTriState.msoTrue, 150, 150, 500, 350);

//Datagrid(formatted with colors, etc) written to xls (formatting is passed through to XL):
Response.Clear();
Response.Buffer= true;
Response.ContentType = "application/vnd.ms-excel";
Response.Charset = "";
this.EnableViewState = false;

System.IO.StringWriter oStringWriter = new System.IO.StringWriter();
System.Web.UI.HtmlTextWriter oHtmlTextWriter = new System.Web.UI.HtmlTextWriter(oStringWriter);

this.ClearControls(dg);
dg.RenderControl(oHtmlTextWriter);
StreamWriter sw = new StreamWriter("c:\test.xls");
sw.Write(oStringWriter());
sw.Close();

//Insert formatted xls object into powerpoint.(Format is retained)
objSlide = objSlides.Add(2,PowerPoint.PpSlideLayout.ppLayoutTitleOnly);
objTextRng = objSlide.Shapes[1].TextFrame.TextRange;
.
.
objSlide.Shapes.AddOleobject(w,x,y,z,"","c:\test.xls",msotrue, "",0,"", msofalse);

Can you explain if there is a way to view an excel worksheet in Aspose formatted from the datagrid?

How do I change the "Object Changed" graphic to display an image? Example?

Thanks,


#4

When you use MS PowerPoint then html formatted excel sheet will be converted by MS Excel
to normal excel sheet (not html) and after that it will be inserted to a slide as OLE object.

You can insert excel sheet and change picture with Aspose.Slides:

Dim oof As OleObjectFrame = slide.Shapes.AddOleObjectFrame(0, 0, width, height, “Excel.Sheet.8”, bytes_from_binary_excel_stream)

Dim picid As Integer = pres.Pictures.Add(New Picture(pres, “excel-sheet-image.jpg”))

oof.PictureId = picid


Another way to insert tables is create Table on a slide with Shapes.AddTable(…) function,
parse your html file, insert text to a cells and format it as necessary.


#5

Thanks for the quick reply.

I think you are wrong. When I export my datagrid to an excel sheet, the HTML is inserted into the excel sheet along with the data. I call the HTMLWriter to write to an excel file. The problem here is that the html is not interpreted correctly by Aspose. The only way around it that I can see is to pass the dataset into Excel and then regenerate the formatting in ppt after it's been created.

Since Aspose isn't handling the HTML, I was in the process of exporting the datagrid to xml and calling AddOleObject() but didn't know the class name for the xml file object... any thoughts?

I think I will go ahead with your suggestion and create a table on the slide and pass in the data that way.... hopefully its a much better solution than embedding an excel object into ppt.

Is there a way to avoid the object changed error? Is this occurring because I'm changing the ppt slide or adding an oleobject?