Instead of
Using (PresentationDocument mypptx = PresenationDocument.Open(Myfilename,true))
{
Mypptx.PresentationPart.Presentation.Save();
Mypptx.Close();
}
Do something like this, as PIEBALDconsultant suggested.
using System;
using SystemIO;
using System.Windows.Forms;
using DocumentFormat.OpenXml;
using DocumentFormat.Presentaton;
using Microsoft.Office.Interop.Powerpoint;
using Powerpoint = Microsoft.Office.Interop.Powerpoint;
namespace Test1
{
public partial class Form1 : Form
{
private PresentationDocument mypptx;
public Form1()
{
InitializeComponent();
}
private void button1_Click(object sender, EventArgs e)
{
OpenFileDialog1.ShowDialog();
...
this.mypptx = PresenationDocument.Open(Myfilename,true);
}
private void button2_Click(object sender, EventArgs e)
{
if(null != this.mypptx)
{
}
}
private void button3_Click(object sender, EventArgs e)
{
saveFileDialog1.ShowDialog();
if(null != this.mypptx)
{
this.mypptx.PresentationPart.Presentation.Save();
this.mypptx.Close();
}
}
}
}