Accessing office project classes from windows form application in C# RRS feed

  • Question

  • I am creating an management project that take some inputs from user and then print them after proper formatting

    I've created 2 projects
    1) windows form application (for taking input in strings n datagridview )

    2)office project (for formatting and printing data of my first project)

    I have imported the office project and its .dll files to my 1st project
    but the question is how to pass parameters(string n datagridview) to thisdocument class of office project It already have some parameters and I don't know how to pass its built-in and new parameter from 1st project

    Saturday, August 17, 2013 3:02 AM


All replies

  • Hi,

    What do you mean about Office project? Is it a document add-in project? Below figure was my understanding.

    If I understood correctly, I think there was no solution how to pass the parameter to thisdocument class.

    For a workaround, you can use Word Automation technology. You can get more information from link below:

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

    Monday, August 19, 2013 1:37 PM
  • Hi Bilal

    From what I understand of your requirement, I believe you should look at leveraging the Open XML File format to write your data into an existing Word document. This will let you work with the file without needing to work with any Office application, which is more approriate if user interaction within the Office application is not required. From your description, it appears all user interaction is with the Windows Form?

    The starting point for learning about working with Office Open XML files is:

    Cindy Meister, VSTO/Word MVP, my blog

    Wednesday, August 21, 2013 10:48 AM