Replacing Pictures during executing

Hi

I am making a PowerPoint Template using MS PowerPoint, and on one or more of
my slides I want to have a picture or different Pictures, but the picture should be replaced during
executing, depending on some data from my database.

My problem is how to find the picture an then replace it - can someone
please help me (i am using VB.NET) ?

Dear edc110,

Small VB.NET example:

1. At first you need open presentation. Presentation must have slides with any picture background which should be replaced.

Dim fis As System.IO.FileStream = New _
System.IO.FileStream(“test.ppt”,System.IO.FileMode.Open,System.IO.FileAccess.Read)
Dim pres As Presentation = New Presentation(fis)
fis.Close()


2. Add your new pictures to the Pictures collection.

Dim pic1 As Integer = pres.Pictures.Add(New Picture(pres,“newpic_1.jpg”))
Dim pic2 As Integer = pres.Pictures.Add(New Picture(pres,“newpic_2.bmp”))
Dim pic3 As Integer = pres.Pictures.Add(New Picture(pres,“newpic_3.png”))


3. Assign newpic_1 to the first slide and newpic_3 to the second slide.

pres.Slides(0).Background.PictureId = pic1
pres.Slides(1).Background.PictureId = pic3

Thanks, but what if I don’t want it as a background, but only as a small picture along with some text (the text-part I know how to do) ?

Dear edc110,

I’m sorry but picture frames are not implemented yet.
It will be next feature together with text formatting within frames.

Any idea when this will be?

2-3 days for pictures and about week for text.
Unfortunately PowerPoint doesn’t use rtf for text formatting.

Looking forward to try it.

Hi Alex,

We just realized how important support for pictures and text formatting is for our needs. I’m under a lot of pressure from my boss to deliver my project (which requires pictures and text formatting in PowerPoint). How certain are you about the time frame for implementation? My project is due Friday, July 30. I’d really appreciate if you could do everything you can to get all this implemented on schedule or ahead of schedule.

Thanks!!

Chris

Dear edc110,

Picture frames were implemented in the new hot fix.
Aspose.PowerPoint 1.0.3.0

Dear Chris,

Text formatting was implemented and included to the Standard edition of new release.
Aspose.PowerPoint 1.1.0.0

Hi Alex,

Just tried out version 1.1.0.0 and encountered some problems. I’m doing some very simple code to test if Aspose.PowerPoint will successfully open and save sample documents:

Dim ap As New Aspose.PowerPoint.Presentation(Filename.Text)
ap.Write(Filename.Text & “_ASPOSED.ppt”)

Please see my files at http://www.funderbunnies.com/agentLIFE.zip
In the ZIP file are three files:

Antitrust.ppt
Crashes when I instantiate the Presentation object with the filename.
ERROR: An unhandled exception of type ‘System.Exception’ occurred in aspose.powerpoint.dll
Additional information: Unable to construct record instance, the following exception occured: Unable to construct record instance, the following exception occured: Unable to construct record instance, the following exception occured: TextBytesAtom is null.

TRC_BOLI_Presentation.ppt
Crashes when I instantiate the Presentation object with the filename.
ERROR:An unhandled exception of type ‘System.NullReferenceException’ occurred in aspose.powerpoint.dll
Additional information: Object reference not set to an instance of an object.

Capabilities.ppt
Code runs fine, but when I try to open the result file PowerPoint gives me an error.
ERROR: PowerPoint can’t read Capabilities.ppt_ASPOSED.ppt

Really appreciate all your help and hard work Alex, Thanks!

"ERROR:An unhandled exception of type ‘System.NullReferenceException’ occurred in aspose.powerpoint.dll
Additional information: Object reference not set to an instance of an object."

I also get this error when trying to open the demo.ppt (with some very minor changes)

Dear Chris and JTaylor,

Thank you very much for the reports.

Please read my post and download last 1.1.1.0 hot fix.

Hi Alex,

Thanks for the hot fix; progress was definently made – 2 of my 3 test presentations now work. But on one of them I am still getting NullReference errors:

An unhandled exception of type ‘System.NullReferenceException’ occurred in aspose.powerpoint.dll
Additional information: Object reference not set to an instance of an object.

Please see my file at http://www.funderbunnies.com/TRC_BOLI_Presentation.ppt

Thanks!

Chris

Dear Chris,

Please, turn off incremental (quick) saving in the PowerPoint, resave this presentation and try again.
It will work without exception.