C
CP
I'm developing a .NET (VS2008) application in which I need to open a Word
document (Word 2007) from a Sharepoint site(MOSS 2007), insert some values
from a .NET form into Word content controls and then save and close the Word
document. Here is the code I use to open the document:
}
ApplicationClass wordApp = new ApplicationClass();
object fileName =
"https://mossbox.tncdev.org/AstrDest/B_ProjectAbstract.docx";
object readOnly = true;
object isVisible = true;
object missing = System.Reflection.Missing.Value;
Microsoft.Office.Interop.Word.Document abstractDoc =
wordApp.Documents.Open(ref fileName, ref missing, ref readOnly, ref missing,
ref missing, ref missing, ref missing, ref missing, ref missing, ref missing,
ref missing, ref isVisible, ref missing, ref missing, ref missing, ref
missing);
wordApp.Visible = true;
abstractDoc.Activate();
}
BUT I get an error that says "Cannot find the document
https://mossbox.tncdev.org/AstrDest/B_Pr". If I change the name of the
document to "B.docx", the message I get is that "the document B.do cannot be
found." Note the limitation to 4 characters for the document name,
including the file extension.
I get this error when running VS2008 on a virtual server on which Windows
Server 2003, Sharepoint 2007 & Office 2007 are installed. I DO NOT get the
error when running the exact code on my own laptop on which VS2008 & Office
2007 are installed (I am accessing the same SP site). My VS2008 project(s)
both have the same references to Microsoft.Office.Interop.Word and
Microsoft.Office.Tools.Word.v9.0.
Where did this 4 character limit come from? I'd appreciate hearing any ideas
you have about what is causing the problems.
Thank you very much in advance. Carol.
document (Word 2007) from a Sharepoint site(MOSS 2007), insert some values
from a .NET form into Word content controls and then save and close the Word
document. Here is the code I use to open the document:
}
ApplicationClass wordApp = new ApplicationClass();
object fileName =
"https://mossbox.tncdev.org/AstrDest/B_ProjectAbstract.docx";
object readOnly = true;
object isVisible = true;
object missing = System.Reflection.Missing.Value;
Microsoft.Office.Interop.Word.Document abstractDoc =
wordApp.Documents.Open(ref fileName, ref missing, ref readOnly, ref missing,
ref missing, ref missing, ref missing, ref missing, ref missing, ref missing,
ref missing, ref isVisible, ref missing, ref missing, ref missing, ref
missing);
wordApp.Visible = true;
abstractDoc.Activate();
}
BUT I get an error that says "Cannot find the document
https://mossbox.tncdev.org/AstrDest/B_Pr". If I change the name of the
document to "B.docx", the message I get is that "the document B.do cannot be
found." Note the limitation to 4 characters for the document name,
including the file extension.
I get this error when running VS2008 on a virtual server on which Windows
Server 2003, Sharepoint 2007 & Office 2007 are installed. I DO NOT get the
error when running the exact code on my own laptop on which VS2008 & Office
2007 are installed (I am accessing the same SP site). My VS2008 project(s)
both have the same references to Microsoft.Office.Interop.Word and
Microsoft.Office.Tools.Word.v9.0.
Where did this 4 character limit come from? I'd appreciate hearing any ideas
you have about what is causing the problems.
Thank you very much in advance. Carol.