Free Support Forum - aspose.com

Copy palette from Presentation to Workbook

Hello again,

I have this presentation that represents a visual template for my documents, specially color-wise. I create many other documents and I want to use the template’s palette in all of them, so I have to copy the palette from the template presentation to, for instance, excel workbooks.

The question is: can I do it in a more intuitive way than the code below? Is this code even correct?

for (int i = 0; i < 56; i++)
book.ChangePalette(pres.Slides[0].GetSchemeColor(i), i);

// pres is a Presentation object with my template
// book is a new Workbook to where the colors should be copied


Thanks in advance,
Cruz

Dear Cruz,

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

Yes, this is the right way, but I think, there are only 8 colors in MS-PowerPoint palette, so you should get first 8 colors and set them.

Further, you should get slide using getslidebyposition method. It takes 1 for first slide, 2 for second and so on

for (int i = 0; i < 8; i++)

book.ChangePalette(pres,GetSlideByPosition(1).GetSchemeColor(i), i);