S
scw-tzg
I have a Word 2007 add-in that saves word docs in a database. When I go to
open a doc, I temporarily save the doc from DB to a temp file that does not
have a file extension (it is a docx file type). Then I open it in word and
this works fine.
// Save the doc file from the db in temp directory with no file extension
String filePlusPath = string.Format(@"{0}{1}", System.IO.Path.GetTempPath(),
((OpenTemplateEventArgs)e).tmplDataRow.TemplateId);
object oFilePlusPath = filePlusPath;
Stream fileStream = new FileStream(filePlusPath, FileMode.Create,
FileAccess.ReadWrite);
fileStream.Write(tmplDataRec.TmrvDoc, 0, tmplDataRec.TmrvDoc.Length);
fileStream.Close();
Word.Document activeDoc = Application.Documents.Open(ref oFilePlusPath, ref
oMissing, ref oMissing, ref oFalse, ref oMissing,
ref oMissing, ref oMissing, ref oMissing, ref
oMissing, ref oMissing, ref oMissing,
ref oMissing, ref oMissing, ref oMissing, ref
oMissing, ref oMissing);
The user makes changes and then selects my add-in's save button. This code
is executed.
// Save the current Word doc file then copy to temp name and
// stream in to tmrvDoc from temp file, finally delete temp file
string filePlusPath = Application.ActiveDocument.FullName;
Application.ActiveDocument.Save();
This code had been running successfully on a variety of environments until I
hit one where instead of the document saving with the existing name it saves
in with a docx extension. So now there are 2 files in my directory; file
names are the same except one has a docx extension.
Does anyone know why this might happen? I suspect it's an option or policy
setting somewhere but I can't find anything.
The environment here is Terminal Services session on MS windows server 2003
standard edition SP2 with Office Professional Plus 2007 SP2.
open a doc, I temporarily save the doc from DB to a temp file that does not
have a file extension (it is a docx file type). Then I open it in word and
this works fine.
// Save the doc file from the db in temp directory with no file extension
String filePlusPath = string.Format(@"{0}{1}", System.IO.Path.GetTempPath(),
((OpenTemplateEventArgs)e).tmplDataRow.TemplateId);
object oFilePlusPath = filePlusPath;
Stream fileStream = new FileStream(filePlusPath, FileMode.Create,
FileAccess.ReadWrite);
fileStream.Write(tmplDataRec.TmrvDoc, 0, tmplDataRec.TmrvDoc.Length);
fileStream.Close();
Word.Document activeDoc = Application.Documents.Open(ref oFilePlusPath, ref
oMissing, ref oMissing, ref oFalse, ref oMissing,
ref oMissing, ref oMissing, ref oMissing, ref
oMissing, ref oMissing, ref oMissing,
ref oMissing, ref oMissing, ref oMissing, ref
oMissing, ref oMissing);
The user makes changes and then selects my add-in's save button. This code
is executed.
// Save the current Word doc file then copy to temp name and
// stream in to tmrvDoc from temp file, finally delete temp file
string filePlusPath = Application.ActiveDocument.FullName;
Application.ActiveDocument.Save();
This code had been running successfully on a variety of environments until I
hit one where instead of the document saving with the existing name it saves
in with a docx extension. So now there are 2 files in my directory; file
names are the same except one has a docx extension.
Does anyone know why this might happen? I suspect it's an option or policy
setting somewhere but I can't find anything.
The environment here is Terminal Services session on MS windows server 2003
standard edition SP2 with Office Professional Plus 2007 SP2.