You could use OLE (Object Linking and Embedding) to host PowerPoint as an ActiveX control within WPF. Unfortunately WPF doesn't directly support OLE, but WinForms does. You would have to use a WindowsFormsHost
to place a WinForms control, that does the OLE embedding in your WPF application.
This all starts to get very complex, very quickly, but it is possible. There is a Microsoft article on how to do it here. You would want to wrap PowerPoint instead of Windows Media Player instead, but the idea is the same. This will require that the end user has Power Point installed, and most likely, be the same version as the one the application was compiled against.
// Create the interop host control.
System.Windows.Forms.Integration.WindowsFormsHost host =
new System.Windows.Forms.Integration.WindowsFormsHost();
// Create the ActiveX control.
AxWMPLib.AxWindowsMediaPlayer axWmp = new AxWMPLib.AxWindowsMediaPlayer();
// Assign the ActiveX control as the host control's child.
host.Child = axWmp;
// Add the interop host control to the Grid
// control's collection of child controls.
this.grid1.Children.Add(host);
Storing the file its self in the database is going to be the easy part.
copied from here:
public static void databaseFilePut(string varFilePath) {
byte[] file;
using (var stream = new FileStream(varFilePath, FileMode.Open, FileAccess.Read)) {
using (var reader = new BinaryReader(stream)) {
file = reader.ReadBytes((int) stream.Length);
}
}
using (var varConnection = Locale.sqlConnectOneTime(Locale.sqlDataConnectionDetails))
using (var sqlWrite = new SqlCommand("INSERT INTO Raporty (RaportPlik) Values(@File)", varConnection)) {
sqlWrite.Parameters.Add("@File", SqlDbType.VarBinary, file.Length).Value = file;
sqlWrite.ExecuteNonQuery();
}
}