none
Creating a Word document using a Sharepoint Custom Content Type

    Question

  • Within Sharepoint, I'm trying to figure out a programmatic way to create a Word document without opening Word.  It looks like OpenXML is the way to go.  However, the Word document needs to be a particular Sharepoint Site Content Type that I created (includes a specialized format with with special content controls).  Is it possible to do this with OpenXML?  If so, can you give me an idea of the coding I would need to do?  And can this same thing be done to create an Excel spreadsheet.  I also have a custom content type for one of those.

    Thanks in advance for your help.  Carol.

    Tuesday, February 12, 2013 3:36 PM

Answers

All replies

  • Hi cpnc,

    Thanks for posting in the MSDN Forum.

    I will involve some experts into your thread to see whether they can help you out. There might be some time delay, appreciate for your patience.

    Have a good day,

    Tom


    Tom Xu [MSFT]
    MSDN Community Support | Feedback to us
    Develop and promote your apps in Windows Store
    Please remember to mark the replies as answers if they help and unmark them if they provide no help.

    Wednesday, February 13, 2013 1:06 AM
    Moderator
  • Thanks, Tom.  My time is relatively short so I'll look forward to hearing what you find out.  Carol.
    Wednesday, February 13, 2013 1:58 PM
  • Hello Carol,

    Open XML can be used to generate Word documents without opening Word. I am not quite sure on your requirement.

    One thing you can do is to create the document in Word manually with the necessary SharePoint site contents and open the file in Open XML SDK Productivity tool which can be downloaded from the following site.

    http://www.microsoft.com/en-us/download/details.aspx?id=5124

    Use the Reflect code option to generate the code which can be used to create the document.

    Thanks,

    Sreerenj G Nair

    Saturday, February 16, 2013 2:30 AM
  • That's an interesting Sreerenj and I'll give it a try.  The only problem I can think of is when we make edits to the Content Type (which may be often) we'll have to create a new XML code and put it into our application.  Within Sharepoint, editing a Content Type just involves opening the template document in Word, making edits and saving the document.

    But your way is definitely a good starting point.  Thanks.

    Saturday, February 16, 2013 9:27 PM