Opening serveral Word Documents based on the same Template

M

Mehran Ziadloo

Hi

I'm trying to open several Word Documents based on the same template file. I
want the document files to be editable but not the template. The first one
opens smoothly, but the second one prompts, since the template file is once
opened with write permission, and it should be opened read-only now! So the
question is how can I open the Word Document file while its Template is
opened in read-only mode?

Here's how I open the Word Document in C#:


using Word = Microsoft.Office.Interop.Word;

Word.Application appWord = new Word.Application();

object missing = Type.Missing;
object FileName = "Address/To/My/File.xml"
, ConfirmConversions = false, ReadOnly = false
, AddToRecentFiles = false, PasswordDocument = "", PasswordTemplate =
Type.Missing
, Revert = false, WritePasswordDocument = "", WritePasswordTemplate =
Type.Missing
, wdOpenFormatAuto = 0, XMLTransform = "", wdLeftToRight = 0;

Word.Document document;
//The actual "Open" command
document = appWord.Documents.Open(ref FileName, ref ConfirmConversions, ref
ReadOnly
, ref AddToRecentFiles, ref PasswordDocument, ref PasswordTemplate
, ref Revert, ref WritePasswordDocument, ref WritePasswordTemplate
, ref wdOpenFormatAuto, ref missing, ref missing, ref missing
, ref wdLeftToRight, ref missing, ref XMLTransform);


BTW, as you can see, my document files are in XML format. I'm not sure if it
has anything to do with it, but anyhow.

Regards,
Mehran Ziadloo
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Top