We have done it programmatically (closed source at the moment, sorry) so might be able to help, but beware of a few gotchas.
One is that the POI project (at least when we looked at it last year), was quite incomplete. It didn't do PPTX Charts - which is the one feature we wanted. Infact the POI site may not be upto date, but they don't appear to support PowerPoint 20087 format (http://poi.apache.org/slideshow/index.html). Everybody recommends this project, but our evaluation was that it was pretty much useless for generating PowerPoint 2007 files via Java. Your milage may vary.
Apose also had some significant limitations when we looked at it; not doing Charts in PowerPoint 2007 being the blocking issue for us.
Another issue is that PowerPoint 2007 can be quite buggy. We have had a number of progammatically produced PPT files that caused lock ups, but when testing, we found that we can repro crashes and lock ups with simple PPTX documents created in PowerPoint 2007 - i.e. not our code.
In the end, we did the following: Unpacked a 'template' PowerPoint file to a folder, then on demand, filled the template XML with new values, zipped it up, renaming various elements & delivered it to the user as a valid PPTX. Works OK, other than the odd PowerPoint crash when people edit the file. If there was a market for it, I guess we could package up the code as a webservice (i.e xml/csv -> PPTX) or put together a commerical package, but we wouldn't do it for free.
You can just run PowerPoint, get the windows handle, and set a new parent window using the SetParent function.
All you need is the name of the window class of the PowerPoint window, but thanks to Spy++, this is no big deal.
Here's a screenshot of PowerPoint running 'inside' of a custom application:
Full example (taken from here and modified for PowerPoint):
public partial class Form1 : Form
{
public Form1()
{
this.Size = new System.Drawing.Size(800, 600);
this.TopMost = true;
this.Text = "My Application";
this.FormBorderStyle = FormBorderStyle.FixedToolWindow;
Func<bool> run = () =>
Window.Find(hwnd =>
{
var cn = Window.GetClassName(hwnd);
var res = (cn == "PPTFrameClass");
if (res)
{
this.Controls.Clear();
Window.SetParent(hwnd, this.Handle);
Window.SetWindowPos(hwnd, new IntPtr(0), -8, -30, this.Width + 10, this.Height + 37, 0x0040);
}
return res;
});
new Button { Parent = this, Text = "Start" }
.Click += (s, e) =>
{
if (run() == false)
MessageBox.Show("Open PowerPoint");
};
}
}
public static class Window
{
public static bool Find(Func<IntPtr, bool> fn)
{
return EnumWindows((hwnd, lp) => !fn(hwnd), 0) == 0;
}
public static string GetClassName(IntPtr hwnd)
{
var sb = new StringBuilder(1024);
GetClassName(hwnd, sb, sb.Capacity);
return sb.ToString();
}
public static uint GetProcessId(IntPtr hwnd) // {0:X8}
{
uint pid;
GetWindowThreadProcessId(hwnd, out pid);
return pid;
}
public static string GetText(IntPtr hwnd)
{
var sb = new StringBuilder(1024);
GetWindowText(hwnd, sb, sb.Capacity);
return sb.ToString();
}
delegate bool CallBackPtr(IntPtr hwnd, int lParam);
[DllImport("user32.dll")]
static extern int EnumWindows(CallBackPtr callPtr, int lPar);
[DllImport("user32.dll")]
static extern uint GetWindowThreadProcessId(IntPtr hWnd, out uint lpdwProcessId);
[DllImport("user32.dll", CharSet = CharSet.Auto, SetLastError = true)]
static extern int GetWindowText(IntPtr hWnd, StringBuilder lpString, int nMaxCount);
[DllImport("user32.dll", SetLastError = true, CharSet = CharSet.Auto)]
static extern int GetClassName(IntPtr hWnd, StringBuilder lpClassName, int nMaxCount);
[DllImport("User32", CharSet = CharSet.Auto, ExactSpelling = true)]
public static extern IntPtr SetParent(IntPtr hWndChild, IntPtr hWndParent);
[DllImport("user32.dll", SetLastError = true)]
public static extern bool SetWindowPos(IntPtr hWnd, IntPtr hWndInsertAfter, int X, int Y, int W, int H, uint uFlags);
}
Best Answer
It is not possible in PowerPoint 2007.