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

Free Support Forum - aspose.com

Changing my PPT background causes my code to fail

I have a PPT file that I use as a template, open using Aspose slides then manipulate the objects on the slides to build my full presentation. I need to change the background image on the template presentation. I have tried setting the background to both a new image as well as to a simple solid fill color. In both instances, my code breaks when trying to find a table object on the second slide.

The code opens the file, selects the second slide, iterates throug the shapes on the slide and looks for a table object which exists in the template file. I then add rows to the table from my data set.

I am perplexed as to why changing the background image or color would cause a table object to seemingly disappear.

Any suggestions?

Dear medrio,

Please attach your source code and presentation to look into this problem.

Baseline1.ppt is the presentation file that works fine.

This is the updated file that fails.

private void NewBaselineSlide()

{

_varsAdded = 0;

//Instantiate a Presentation from where the slide will be cloned

Presentation presSrc = new Presentation(_templatePath);

//Accessing a slide using its slide position

Slide slide = presSrc.GetSlideByPosition(2);

//Creating SortedList object that is used to store the temporary information

//about the masters of PPT file. No value should be added to it.

System.Collections.SortedList sList = new System.Collections.SortedList();

//Cloning the selected slide at the end of another presentation file

Slide clonedSlide = presSrc.CloneSlide(slide, _currentPresentation.Slides.LastSlidePosition + 1 - STATIC_SLIDE_COUNT, _currentPresentation, sList);

_baselineTable = GetTableFromSlide(clonedSlide);

SetupTableDimensions();

SetupHeaderRow();

}

private Table GetTableFromSlide(Slide slide)

{

Table tbl = null;

int i;

//Iterating through all shapes unless the desired table is found

for (i = 0; i < slide.Shapes.Count; i++)

{

if (slide.Shapes[i] is Table)

{

//in the original file this is found. in the update file this code is never hit and tbl remains NULL

tbl = (Table)slide.Shapes[i];

}

}

MAX_TABLE_WIDTH = 0;

for (i = 0; i < tbl.ColumnsNumber; i++)

MAX_TABLE_WIDTH += tbl.GetColumnWidth(i);

return tbl;

}

Did you create the baseline1+-+Copy.ppt by changing the background of baseline1.ppt using MS-PowerPoint? If so, which version of MS-PowerPoint did you use? I think, you have you used MS-PowerPoint 2007, because this problem does not occur if I change a background of baseline1.ppt using MS-PowerPoint 2002.

The problem occurs because table has been converted into a group shape, that’s why, it could not be found.