none
Minimizing processing load in a PowerPoint add-in RRS feed

  • Question

  • Right. This is more about logic than VSTO. Here's the scenario:

    1. I have a folder containing hundreds (or even thousands) of PowerPoint presentations.

    2. For each presentation, I have to go through all its slides.

    3. For each slide, I have to fetch its Title and export the slide to a new presentation named <Title>.pptx and save it to output folder. The process then carries on with next slide. Have to "keep source formatting" so the only choice is to use Slide.Copy() and ExecuteMso("PasteSourceFormatting") commands (Slides.Paste() doesn't keep source formatting and I couldn't find any equivalent of PasteSourceFormatting in the object model).

    4. If a slide has a title that has been exported before, the slide will be exported to that presentation.

    5. At the end of the process, all slides that had similar titles will be collected under one presentation named <Title>.pptx in the output folder.

    Although the entire thing appears simple, the pin here is that I want to minimize the FileOpen and FileSave operations (since my perception is that these two are the heaviest operations involved in the entire process).

    First choice here is to go like I have described above, pick each presentation and export its slides to the target presentations based on their titles, but this involves opening and closing presentations on the TARGET side EVERY TIME we find a match. We cannot keep all of the target presentations open since there may be thousands.

    Another method would be to run one pass through all presentations to create an "index" of all the titles, then:

    1. Sort the index on titles

    2. Create the first target presentation

    3. Go through the index

    4. Open each source presentation

    5. Look for any slides having the same title as the currently open target presentation and export it.

    6. Carry on with each of the titles in the index.

    As you can see, this also involves considerable amount of FileOpen/FileSave operations on the SOURCE side.

    So the questions really is, what's my best choice here? Is there any HashMap or some other technique to minimize the overhead of constantly opening/closing the SAME file again and again either on the source or target side?

    Many thanks.

    Shujaat

    Saturday, February 25, 2012 5:44 AM

All replies

  • Hi Syed,

    Thanks for posting in the MSDN Forum.

    It's based on my experience that isn't a good idea for you to handle this issue via VSTO technic. I would recommend you post it in the OpenXml forum for better support.

    Have a good day,

    Tom


    Tom Xu [MSFT]
    MSDN Community Support | Feedback to us


    Monday, February 27, 2012 6:53 AM
    Moderator