To automate the creation of a Pitchbook by selecting specific slides from various reports in your Report Automation (RA) tool, you can follow these steps. Since your tool is created in WPF with C# code, the process involves manipulating PowerPoint slides programmatically. Here is a high-level approach:
Install Required Libraries: Use a library like Open XML SDK or Microsoft PowerPoint Interop to manipulate PowerPoint presentations. For this example, I will use Open XML SDK.
Extract Slides from Existing Reports: Write a method to extract the desired slides from the existing PowerPoint presentations generated by your RA tool.
Create a New Pitchbook: Write a method to create a new PowerPoint presentation and add the extracted slides to it.
Example Implementation
Step 1: Install Open XML SDK
You can install the Open XML SDK via NuGet Package Manager in Visual Studio:
bash
Copy code
Install-Package DocumentFormat.OpenXml
Step 2: Extract and Combine Slides
Here’s a basic example of how you can achieve this:
csharp
Copy code
using DocumentFormat.OpenXml.Packaging;
using DocumentFormat.OpenXml.Presentation;
using System;
using System.Linq;
public class PitchbookCreator
{
public void CreatePitchbook(string[] sourceFiles, int[][] slideIndices, string outputFilePath)
{
// Create a new presentation document
using (PresentationDocument newPresentation = PresentationDocument.Create(outputFilePath, DocumentFormat.OpenXml.PresentationDocumentType.Presentation))
{
// Add a new presentation part to the presentation document
PresentationPart presentationPart = newPresentation.AddPresentationPart();
presentationPart.Presentation = new Presentation();
SlideIdList slideIdList = new SlideIdList();
for (int i = 0; i < sourceFiles.Length; i++)
{
using (PresentationDocument sourceDocument = PresentationDocument.Open(sourceFiles\[i\], false))
{
PresentationPart sourcePart = sourceDocument.PresentationPart;
int slideIndex = 256 + i;
foreach (int index in slideIndices\[i\])
{
SlidePart slidePart = (SlidePart)sourcePart.GetPartById(sourcePart.Presentation.SlideIdList.ChildElements\[index\].GetAttribute("id", "").Value);
SlidePart newSlidePart = presentationPart.AddNewPart();
newSlidePart.FeedDa