CODE
public void OnAction(IRibbonControl control)
{
Stream myStream;
switch (control.Id)
{
case "Opslaan":
SaveFileDialog saveFileDialog = new SaveFileDialog();
saveFileDialog.Filter = "Word-document (*.docx)|*.docx|Word 97-2003-werkmap (*.doc)|(*.doc)";
saveFileDialog.FilterIndex = 1;
saveFileDialog.RestoreDirectory = true;
saveFileDialog.InitialDirectory = @"C:\Temp\waldo";
if (saveFileDialog.ShowDialog() == DialogResult.OK)
{
if ((myStream = saveFileDialog.OpenFile()) != null)
{
// I have no idea what to do here
}
}
break;
.
.
.
etc.
}
}
{
Stream myStream;
switch (control.Id)
{
case "Opslaan":
SaveFileDialog saveFileDialog = new SaveFileDialog();
saveFileDialog.Filter = "Word-document (*.docx)|*.docx|Word 97-2003-werkmap (*.doc)|(*.doc)";
saveFileDialog.FilterIndex = 1;
saveFileDialog.RestoreDirectory = true;
saveFileDialog.InitialDirectory = @"C:\Temp\waldo";
if (saveFileDialog.ShowDialog() == DialogResult.OK)
{
if ((myStream = saveFileDialog.OpenFile()) != null)
{
// I have no idea what to do here
}
}
break;
.
.
.
etc.
}
}
The SaveFileDialog pops up, but I can't save the file. I've tried several approaches, but how can I just save the Word document? In this code snippet I can specify the default file location. I tried a different approach, which also pops up a SaveFileDialog and DOES actually save the file. But the problem is I don't know how to change the default save location:
CODE
this.applicationObject.ActiveDocument.Save();
// SaveFileDialog pops up, but starts in My Documents as default location. I'd like to change this...
// SaveFileDialog pops up, but starts in My Documents as default location. I'd like to change this...
Either approach is OK, but I just want to Save a file in a custom default location. any help is appreciated...