.NET Tutorials, Forums, Interview Questions And Answers
Welcome :Guest
Sign In
Win Surprise Gifts!!!

Top 5 Contributors of the Month
Gaurav Pal
Post New Web Links

Opening Word without Automation in ASP.net C#

Posted By:      Posted Date: October 13, 2010    Points: 0   Category :ASP.Net

Hi all,

I am been having trouble with finding an answer to this question but here goes:

Is there any way to write to MSWORD without automation through ASP.NET in C# (maybe write to an existing word document without opening it)?

I am pulling my hair out! I have tried adding IUSR, ASPNET to the web server, I have tried Identity Impersonate = True in the web.config.

My code for opening word looks like this:

object isVisible = true;
object readOnly = true;

I get a Macro storage error on the open statement. I have put a lot of time into figuring this out and I really dont want to do a TOTAL 180.

wordDoc = WordObj.Documents.Open2000(ref fileName, ref missing, ref readOnly, ref missing, ref missing, ref missing, ref missing, ref missing, ref missing, ref missing, ref missing, ref isVisible);

I appreciate any ideas or suggestions given! 

 Thank you in advance!


View Complete Post

More Related Resource Links

Word Automation Issue in Windows Server 2008 Hosting



The problem I am posting here is that I was facing nearly 2 weeks around. Any body comes with this stuff please help.

Word Automation in sample ASP.NET(C#) application.

I am using Microsoft.Office.Inetrop.Word Assembly for automation. Here I am reading a XXX.dot template file and fill the contents with dynamic data.

When i am executing my code in localhost:someportnumber the automation is working fine and I could get expected result and when I am hosting in my inetmgr(Windows XP is my OS) it is also working fine.

But the problem is that when I am hosting in my production server(Windows Server 2008 Standard Edition) I am not able to perform automation and results in the following error.

Data: System.Collections.ListDictionaryInternal
Message: Word has encountered a problem.
Source: Microsoft Word

The code gets failed in the following line:

ApplicationClass wordApp = new Microsoft.Office.Interop.Word.ApplicationClass();

Document wordDoc = wordApp.Documents.Add(ref oTemplate, ref oFalse, ref oMissing, ref oMissing); // Error in this line

I cannot able to proceed further. Can anybody please help me in solving this issue?

Thank you.

With Regards,


Word Automation - Multiple DCOM Errors/Behavior

Before I get started, I already know that Microsoft does not support and highly discourages server-based MS Office automation.  I've read a multitude of posts and smarmy "*wink*, here's a link" replies, so I'm looking for actual help here, not condescending reprimands.

That notwithstanding, here is my problem.  I have developed a simple method that will open a local Word document, modify some header information, and then save the document as a new file.  As expected, it works great as a console/windows app, but as soon as I went to ASP.NET, DCOM jacked my world up when accessing the app remotely from a different domain account (that has access to the ASP.NET app.  For reference, my method is shown below:


1    public static string ModifyAndSaveBuildDocument(string localFilePath, BuildDocumentType docType, string buildNumber, DateTime buildDate, string projectName)
2            {
3                try
4                {
5                    ProjectConfiguration config = (ProjectConfiguration)ConfigurationManager.GetSection("ProjectConfiguration");

Developing with SharePoint 2010 Word Automation Services

Using the Open XML SDK 2.0 in combination with Word Automation Services enables many scenarios that are difficult when using only the Open XML SDK 2.0, such as repagination, conversion to other document formats, or updating dynamic content in documents.

Developing Applications in SharePoint 2010 Using Word Automation Services and Excel Services

Learn about the new client services features that are available in SharePoint Server 2010, including Word Automation Services and Excel Services.

Sample: Developing Applications in SharePoint 2010 Using Word Automation Services and Excel Services

Download sample code that demonstrates the new client services features that are available in SharePoint Server 2010, including Word Automation Services and Excel Services.

Sample: Converting Word Documents to PDF using SharePoint Server 2010 and Word Automation Services

Explore the code in this visual how-to article as you learn how to programmatically convert Word documents to PDF format on the server by using Word Automation Services with SharePoint Server 2010.

asp.net 2.0 word automation issue


i 've VS2005 (asp.net 2.0) and i'm developing a intranet applcaition.

i want to create/open word files on the client side , that can be editable and can be saved on to the database.

all of the client systems will have Word 2007 installed. please suggets what approach should i take.

i tried with COM word automation but there are a lot of security/permissions issue associated and its not working fine.

please advise.

thanks in advance







Word automation under asp.net 1.1.4322 & Vista 64-bit

(this problem was solved, please refer to my later reply down in this thread)We have an asp.net 1.1.4322 application running successfully under Windows XP Pro 32-bit , Windows Server 2003 32-bit and Windows Vista Ultimate 32-Bit.In this application we are successfully generating/saving/opening Word documents, and we were able to successfully upgrade from Word 2000 to Word 2007 without problems, under both platforms.When installing and running the same application under Vista SP1 64-bit we faced a problem with automating Word. We tried giving all permissions possible, we tried impersonating in Web.Config, we tried running the IIS process as Administrator, we searched the internet and tried many solutions we found out there, but nothing seemed to fix the problem.Investigating under Task Manager, I can see that WINWORD is launched as:"C:\Program Files (x86)\Microsoft Office\Office12\WINWORD.EXE" /Automation -Embeddingbut the code crashes at a line like this:oDoc = oWord.Documents.Add(ref documentTemplate, ref oMissing, ref oMissing, ref oMissing);Generating this error:COMException (0x800a13e9): Word has encountered a problem.I have a feeling that this has to do with 32-bit/64-bit system dlls related to the Dcom Launcher, and during my search I came across this article which suggested checking some dlls and making sure they match the same version:http://support.microsoft.

How to use SharePoint Server 2007 SP2 to compare documents without opening one by one in Word ? (ver

Hi All, How to use / access the versiondiff.apsx feature ? I'm using SharePoint 2007 SP2 Enterprise but somehow i cannot use that features like in this website said: http://www.ssw.com.au/ssw/Standards/BetterSoftwareSuggestions/SharePointTeamServices.aspx for example: here's my document library - http://mossdev01/Correspondence/Forms/AllItems.aspx Diff - http://mossdev01/Correspondence/versiondiff.aspx --> FAILED 404 ? Any kind of help and suggestion would be greatly appreciated. Thanks, Albert/* Infrastructure Support Engineer */

Opening New Word Document with Template Selection in C#

From a Windows Forms Application, I need to launch Word. There is an option to create a new document template in the Application. So to implement this, I need to launch the template selection window (You get it when you click File->New in 2007). Once the user selects the template, a new document is created with the selected template. How do I achieve this using Word Object Model?

Opening a MS Word File and setting the save location



I have an ASP intranet site which opens word documents from a shared network drive (link is stored in a DB).  When the user then goes to save the document, it points the user to their default location - say C:\myprofile\my documents.  How can i get it so that the user can just click on save and it saves it in the location it got the file from?  I am using the following code to grab the document:

Response.AddHeader("Content-disposition", "attachment; filename=" & docfilename)
Response.ContentType = "application/vnd.ms-word"

If i navigate through the network share manually through windows, open the document and click save - it will save it to the right location.


Does Word Automation Services require Office 2010 install on server to function?


Subject is the question.


My requirements are to "maintain existing functionality with current version of a windows service running on Server 2003 and automating Word through COM."   I.E. All the stuff that breaks when you upgrade the OS to Server 2008.  

My customer has already rejected several third party alternatives as "not being accurate enough"  The rendered PDF doesn't match what comes out of Word when compared with an electron microscope.

So now I'm investigating using Word Automation Services and Sharepoint 2010.   Got my development server functional with Sharepoint 2010 and Visual Studio 2010.  But my first attempts at creating rendering jobs is failing with an "ArgumentNullException" in deep inside a method I'm 100.0% sure I'm NOT passing any NULL's to. 

My VM is low on space so I figure I'd save time by asking for a conclusive answer before I make room / install Office.

Long delay opening Word documents from SharePoint 2007 with Office 2010


The first time a document is opened it's fine, opens in just a few seconds.

Subsequently, there is a long delay (about 20 seconds) in the "Contacting server for information..." step.

This happens to all users and all documents, each one will open fast the first time then slowly the second and subsequent times (until, we think, the app pool is recycled - there is no schedules iisreset/reboot).

This does not happen when using Office 2007.

IE6 and 7 exhibit the same behaviour.

Opening Word 2003 document from sharepoint site in word 2010.


When using sharepoint services with word 2003 on an XP machine, everything works fine. We bought some new computers where we now have windows 7 and office 2007/2010. These work perfect too. Even the 64-bit computers.

We are very happy with the new office version, so we decided to upgrade the entire company. As a test, we upgraded 1 PC. But this is not working. So we upgraded office, later we reinstalled it. But nothing helps. This is the problem: I surf to the document click it to open it, and then Word hangs. "contacting server". This is not always the case, sometimes it works, sometimes it doesn't. This even with the same document.

We would really like to upgrade to office 2010 entirely. But we're not going to buy licences we cannot use. Anybody got a solution?

Word Web App cannot open this document due to an unknown error. If the problem persists, try opening

Word Web App cannot open this document due to an unknown error. If the problem persists, try opening the file in Microsoft Word.

Can anybody pls help me how to resolve this for which got strucked !!!!


Cheers !!


Thanks in Advance !!! Cheers !!! Praveen

Word Web App cannot open this document due to an unknown error. If the problem persists, try opening


Word Web App cannot open this document due to an unknown error. If the problem persists, try opening the file in Microsoft Word.

Hii ,

Can anybody pls help me how to resolve the above Error am getting in Sharepoint Foundation with the use Office WebApps installed on the same development server,when Opening a word document after it got created.






Thanks in Advance !!! Cheers !!! Praveen Mandalapu

Word 2010 error when opening as content type from SP



I have a document library in WSS3 with a custom content type I've created.

I just upgraded to Office 2010 and since then, each instance I'm creating from the DL, work freezes and closes.

Any thoughts?

Thanks in advance

ASP.NetWindows Application  .NET Framework  C#  VB.Net  ADO.Net  
Sql Server  SharePoint  Silverlight  Others  All   

Hall of Fame    Twitter   Terms of Service    Privacy Policy    Contact Us    Archives   Tell A Friend