Free Support Forum - aspose.com

Update OLE link in Powerpoint

Hi,
The workflow of our project is

1. User gives the input in ASPX page
2. The excel input fields will be updated based on that.
3. A button will be there which will say: DISPLAY PRESENTATION
4. On click of the button, the updates will be carried over to the presentation and it will be downloaded to users system.

The possible way:

Using ASPOSE how it will genetare the ppt is the most challenging part. Now the ppt is linked to the excel (OLELink). Is it possible to update the ppt during runtime?
What i mean to say: Open the ppt object in ASPOSE; Then find the document links and then update the links. Save the presentation. is it possible to achieve this?

Please see the attached files. Store it in same folder and open the ppt. It will update the document link

If you have any thought on this, please share. This is extremely needed.

Also: When we try to open a presentation more than 2.5MB, I have seen that there are some performance overhead. The system hangs…

Thanks in Advance.
Regards,
Dibyendu

Hello Dibyendu,

It is possible to access linked OLE objects. OleObjectFrameEx class has LinkPathLong property for that. Currently, we found one limitation (thanks to your example), there are only simple urls are supported in Aspose.Slides. You presentation contains url like “Dummy.xlsx!Sheet1!R1C1:R2C1” which is not supported yet. I have added it to our future plans.

When you tell about performance, do you mean ppt or pptx presentations? Could you please provide example of such presentation file.

Hi,

Thank you for your e-mail. What I meant by performance issue is

I am trying to Extract charts from an excel and convert it into an image. I have a presentation contains Image. The ALT Text of the Image say Image_1. Now I am getting the Image_1 from Excel chart and replacing it by the Image itself. So Everytime when the program runs Images are updated automatically.

A probale way of solving my requirement.

Now with 1 image it works fine. But I have aroung 50 slides and 50 image :(. So what happens, the program stops working and it seems that the system hangs. The presentation file is around 2.5MB in size.

I don’t know whether there is any limitation or not.

I am not ablr to share the PPT for security reasons. Its PPT and not PPTX.

Here is the code which I used:
-------------------------------------------------------------
//load ProjectPPT
Presentation presnew = new Presentation(“C:\TMPOCTeast\Test.ppt”);

XmlDocument xDoc = new XmlDocument();
ArrayList arImage = new ArrayList();

xDoc.Load(“C:\TMPOCTeast\chartlist.xml”);
XmlNodeList xmlimage = xDoc.GetElementsByTagName(“image”);
XmlNodeList xmlImgName = xDoc.GetElementsByTagName(“name”);
int k = 0;

//Read from chartlist.xml file and store images name in Array object
foreach (XmlElement NewImg in xmlImgName)
{
arImage.Add(NewImg.InnerText);
k++;
}
for (int j = 1; j <= presnew.Slides.Count; j++)
{
Slide slide = presnew.GetSlideByPosition(j);
Shapes shapes = slide.Shapes;

for (int i = 0; i < shapes.Count; i++)
{

Shape shape = shapes[i];

//check if the shape is Picture
if (shape is PictureFrame)
{
PictureFrame pic = shape as PictureFrame;
for (int k1 = 0; k1 < k; k1++)
{
string newpic_name = arImage[k1].ToString();

//match d alternate text on image wid d image name read from xml file
if (pic.AlternativeText != null && pic.AlternativeText != “”&&pic.AlternativeText==newpic_name)
{
//get d absolute path of newpic
string str = “C:\TMPOCTeast\Image\” + arImage[k1].ToString();
Picture new_pic = new Picture(slide.Parent, str);
int old_pic_id = pic.PictureId,
new_pic_id = slide.Parent.Pictures.Add(new_pic);
pic.PictureId = new_pic_id;
}
}
// else continue;
}

}
}
//Save the modified PPT as Output.ppt
string output_file_name = @“C:\TMPOCTeast\Test.ppt”;
presnew.Write(output_file_name);
-------------------------------------------------------------

Regards,
Dibyendu

Hello,

Please check attached new version of Aspose.Slides for .NET. We added workaround for custom urls in OLE objects so Aspose.Slides won’t throw such exception anymore.

The issues you have found earlier (filed as 10295) have been fixed in this update.


This message was posted using Notification2Forum from Downloads module by aspose.notifier.