0

i am using open xml sdk to copy slides into another presentation , when the slides are copied and my desired presentation is generated , I iterate through each slide of the generated document and replace its existing images with the image of my choice , the process is executing and the images gets replaced , but here is the bind , if the dimensions of my images are larger then the image in the document , the image gets cropped to fit to the size that was previously occupied by the replaced image .But if i do the whole process manually , by right clicking with my mouse , power point changes the dimension of the image its get shorter but its not cropped and the whole image is displayed ...

so what approach should i go for , do i have to change some xml settings through code , or do i have to change the dimension of my images using c# classes , what is the right approach to tackle this issue???

guys i will be anxiously waiting for your response ......

user8189
  • 79
  • 1
  • 10

1 Answers1

0

Better change the image before replacing the image in your target presentation file. As power point is going to embed your image in the file itself, you can reduce the size of the overall generated file if you compress the images to required dimensions before replacing.

Changing the dimensions in the xml is also a valid idea but you are embedding images into the file without any added advantage.

Some pointers on how to resize image in c# :

https://stackoverflow.com/a/87786/860243

http://www.peterprovost.org/blog/2003/05/29/Resize-Image-in-C/

http://dzone.com/snippets/c-resize-image-while

Community
  • 1
  • 1
Flowerking
  • 2,551
  • 1
  • 20
  • 30