We're sorry Aspose doesn't work properply without JavaScript enabled.

Free Support Forum - aspose.com

Back ground image problem

Hi ,

before purchasing ASPOSE.SLIDES, i am doing R&D work.Then finally i need small help

i have 2 ppt files i picked 1 slide from 1 ppt and applied background image

and i picked 1 slide from 2 ppt and applied background image then i have to create new ppt with those two slides

here i am passing my code how to do this help.

Dim objfrm As Presentation = New Presentation("C:\Documents and Settings\user\Desktop\1.ppt")

Dim sld As Slide = objfrm.GetSlideByPosition(1)

sld.FollowMasterBackground = False

sld.Background.FillFormat.Type = FillType.Picture

Dim pic As Picture = New Picture(objfrm, "C:\Documents and Settings\user\Desktop\masterbg.jpg")

Dim picId As Integer = objfrm.Pictures.Add(pic)

sld.Background.FillFormat.PictureId = picId

Dim objfrm2 As Presentation = New Presentation("C:\Documents and Settings\user\Desktop\2.ppt")

Dim sld2 As Slide = objfrm2.GetSlideByPosition(2)

sld2.FollowMasterBackground = False

sld2.Background.FillFormat.Type = FillType.Picture

Dim pic2 As Picture = New Picture(objfrm2, "C:\Documents and Settings\chowdary\Desktop\masterbg.jpg")

Dim picId2 As Integer = objfrm2.Pictures.Add(pic2)

sld2.Background.FillFormat.PictureId = picId2

How to write new ppt with thoese two slides which was applied background image

.Write("C:\Documents and Settings\user\Desktop\new.ppt")



You can clone a slide from one ppt to another ppt.


<?xml:namespace prefix = o ns = "urn:schemas-microsoft-com:office:office" />

in your case, if you want to clone a second slide in objfrm2 to objfrm then your code will look like this.

Dim slideToBeCloned as Slide=objfrm2.GetSlideByPosition(2)

Dim lastSlidePosition as Integer=objfrm.Slides.LastSlidePosition

‘This will copy second slide from objfrm2 to objfrm

objfrm2.CloneSlide(slideToBeCloned, lastSlidePosition+1, objfrm, new SortedList())

‘This is your final presentation

objfrm.Write("C:\Documents and Settings\user\Desktop\new.ppt")