Hi,
Hi,
Hello Support,
Has there been any progress on linking or embedding with aspose.cells and aspose.slides?
Copying a range of cells and pasting them into PowerPoint is common when using Microsoft Office. I would like to find a way to perform this same action with the aspose API. The current workaround is that we save the excel file to pdf and then create an image of the pdf and place that into the PowerPoint. Unfortunately, this is becoming a problem due to file size and storage requirements.
Very much looking forward to a better solution or other creative ideas (apart from just using the PDF directly, which seems to be against the religion of the users who need to make last minute edits to the PowerPoint).
Thanks in advance!
Jason
Hi Jason,
I like to share that we have added the support for adding the linked ole file in Aspose.Slides generated Ole frame. Please use the following sample code to serve the purpose. The issue SLIDESNET-3103 actually relates to providing support for Linked Ole objects. However, as far as your requirement of adding excel sheet text in Aspose.Slides, I like to share that you will need Aspose.Cells in this along side. You will copy the text using Aspose.Cells and will then paste that in slides using Aspose.Slides inside table or text frame.
public static void AddLinkedOle()
{
String path=@“D:\Aspose Data”;
Presentation pres = new Presentation();
Slide slide = pres.GetSlideByPosition(1);
// adding substitute image image. This is mandatory operation.
Picture pic = new Picture(pres, path+“Tulips.jpg”);
pres.Pictures.Add(pic);
// ole.PictureId = pic.PictureId;
// creating new linked Ole object
OleObjectFrame ole = slide.Shapes.AddOleObjectFrame(500, 100, 500, 500, “Excel.Sheet.8”, new Guid("{00020820-0000-0000-C000-000000000046}"), null,path+ “worksheet2.xls”, null);
ole.PictureId = pic.PictureId;
// replacing link and type of an object
ole.SetObjectLink(“Excel.Sheet.8”, new Guid("{00020820-0000-0000-C000-000000000046}"), null, “worksheet1.xls”, null);
ole.PictureId = pic.PictureId;
// replacing link path without changing of object’s type
ole.SetObjectLink(null, “worksheet1.xls”, null);
pres.Write(path + “LinkOle.ppt”);
}
Many Thanks,
Hello Mudassir,
Thank you for the example. I pasted it into LINQPad and it didn't work. So I updated to Slides 7.4.0 and Cells 7.4.3. Now it works, but I did not like the result. I tried to fix it. Can you help me a bit further, please? I have attached my folder with code and results so you can easily re-create the situation I am seeing or you can just view the PPT files generated.
Here's my code now (but the attached .linq file should open in LINQPad and everything should run instantly if you use the same D:\AsposeOle folder).
void Main()
{
String path=@"D:\AsposeOle\";
String source=path+@"worksheetSource.xlsx";
Presentation pres = new Presentation();
Slide slide = pres.GetSlideByPosition(1);
// adding substitute image image. This is mandatory operation. (seriously? In production, how can I get the image, sized properly, of the original excel result?)
Picture pic = new Picture(pres, path+"Tulips.jpg");
pres.Pictures.Add(pic);
// creating new linked Ole object
OleObjectFrame ole = slide.Shapes.AddOleObjectFrame(500, 100, 500, 500, "Excel.Sheet.8", new Guid("{00020820-0000-0000-C000-000000000046}"), null,source, null);
ole.PictureId = pic.PictureId;
pres.Write(path + "LinkOle1.ppt"); //Works, but the tulips image is shown. User must click update links when file is opened. Even then, the image is too small to read.
// replacing link and type of an object
ole.SetObjectLink("Excel.Sheet.8", new Guid("{00020820-0000-0000-C000-000000000046}"), null, source, null);
ole.PictureId = pic.PictureId;
pres.Write(path + "LinkOle2.ppt"); //Sort of slow. Why is that? Still has image of tulips and after update the data is too small to read.
// replacing link path without changing of object's type
ole.SetObjectLink(null, source, null);
pres.Write(path + "LinkOle3.ppt"); //This works nice and is fast, but I still have to click update and I have the image and it is too small.
}
Hi Jason,
Hello Mudassir,
Using Excel.Sheet.12 has no visible effect. The Excel image is the same - tiny and unreadable on the powerpoint slide
Can you open my zip and view the ppt's created by the code?
Where should I ask the question about how to embed the excel sheet into the powerpoint? This link method doesn't seem to be helpful until it can be corrected to use the size of the object that is being attached at 100% scale so that the powerpoint will show the exact same size as is shown in Excel in the same manner as if a user were to do a copy/paste from Excel to Powerpoint.
Thank you,
Jason
Hi Jason,
.AddOleObjectFrame(500, 100, 500, 500, “Excel.Sheet.8”, new Guid(“{00020820-0000-0000-C000-000000000046}”), null,source, null);
The issues you have found earlier (filed as ) have been fixed in this update. This message was posted using BugNotificationTool from Downloads module by MuzammilKhan