none
Automated office word document development RRS feed

  • Question

  • I am a ASP.net developer with no office development experience. I have a word automation requirement to create a word document from a word template; populate defined fields with data from a SQL database (Name, address, etc...) and store the document on a file share. My investigation from web sites (stackoverflow; pluralsight; micorsoft office development) has left me confused as to the best approach for a solution to this task. Any advice would be much appreciated

    PS: I am aware of the below document stating:

    Microsoft does not currently recommend, and does not support, Automation of Microsoft Office applications from any unattended, non-interactive client application or component (including ASP, ASP.NET, DCOM, and NT Services), because Office may exhibit unstable behavior and/or deadlock when Office is run in this environment.

    This is part of my dilemma

     

    KB257757 Considerations for server-side Automation of Office http://support.microsoft.com/kb/257757 <o:p></o:p>

    • Edited by ramlotte1 Wednesday, February 11, 2015 5:05 PM
    Wednesday, February 11, 2015 4:47 PM

Answers

  • Hello,

    See How to automate Microsoft Word to create a new document by using Visual C# .

    Microsoft does not currently recommend, and does not support, Automation of Microsoft Office applications from any unattended, non-interactive client application or component (including ASP, ASP.NET, DCOM, and NT Services), because Office may exhibit unstable behavior and/or deadlock when Office is run in this environment.

    If you are building a solution that runs in a server-side context, you should try to use components that have been made safe for unattended execution. Or, you should try to find alternatives that allow at least part of the code to run client-side. If you use an Office application from a server-side solution, the application will lack many of the necessary capabilities to run successfully. Additionally, you will be taking risks with the stability of your overall solution.

    You can read more about that in the Considerations for server-side Automation of Office article. Use the Open XML SDK or any other third-party components on the server.

    Wednesday, February 11, 2015 5:04 PM

All replies

  • Hello,

    See How to automate Microsoft Word to create a new document by using Visual C# .

    Microsoft does not currently recommend, and does not support, Automation of Microsoft Office applications from any unattended, non-interactive client application or component (including ASP, ASP.NET, DCOM, and NT Services), because Office may exhibit unstable behavior and/or deadlock when Office is run in this environment.

    If you are building a solution that runs in a server-side context, you should try to use components that have been made safe for unattended execution. Or, you should try to find alternatives that allow at least part of the code to run client-side. If you use an Office application from a server-side solution, the application will lack many of the necessary capabilities to run successfully. Additionally, you will be taking risks with the stability of your overall solution.

    You can read more about that in the Considerations for server-side Automation of Office article. Use the Open XML SDK or any other third-party components on the server.

    Wednesday, February 11, 2015 5:04 PM
  • Thank you for your response, I am just confused by all the options (PIA's; Embedded Interop Types; VBA;VSTO) that I fell overwhelmed as to which one to pursue. I do need an "no client solution"  and if Open XML is the way to go, then that's what I will target.

    I just want to make sure the technology I am investing time in is the correct one.

    Thank you

    Wednesday, February 11, 2015 5:49 PM
  • Well, your initial post tells the opposite:

    > I am a ASP.net developer with no office development experience. I have a word automation requirement

    You need to describe where exactly you need to run the code. Only in that case you can get a valuable reply.

    Thursday, February 12, 2015 12:52 PM
  • The code will run on a IIS Web Server and the event to start the office automation will be generated from an ASP MVC5 application. I will have predefined word 2013 templates and I must insert data into merge fields and change background color of shape element that represents checkboxes. I am able to populate the mergefields but I cannot cannot change the shape color fill because it is a Com object and it is a read only property.
    Thursday, February 12, 2015 3:21 PM
  • As I already wrote above, use the Open XML SDK or any other third-party components on the server-side.
    Thursday, February 12, 2015 4:37 PM
  • Thanks, sorry to bother you
    Thursday, February 12, 2015 4:40 PM