none
Is Sharepoint the new way to do Office/Word integration? RRS feed

  • Question

  • Is Sharepoint the new way to do Word integration? I'm looking to start a project that uses 100 or so Word templates with merge fields. I plan to get the data for those merge fields from a SQL database. I see info regarding Office integration with Office 2007 but but nothing for 2010. Google searches bring up Sharepoint a lot. But I was under the impression that SharePoint was just a collaborative technology. Since I haven't worked with Word integration in ANY way, where do i start my research?

    Thanks


    • Moved by Bob Shen Wednesday, September 12, 2012 5:30 AM (From:Visual C# General)
    • Edited by ASI Tech Thursday, September 13, 2012 2:38 AM
    Tuesday, September 11, 2012 3:55 PM

Answers

  • Hi ASI Tech

    For Word 2007 / 2010 you have two basic approaches available:

    1. Automate the "Interop" (same interface that VBA uses, but it could be .NET code, instead)

    2. Manipulate the Office Open XML files (*.dotx) directly, without requiring the Word application.

    Moving to Word 2013, a third possibility will be available:

    3. "Office apps". These let you display a task pane for the user to interact with and manipulate the current selection in the Office document.

    Given that you want to merge data from SQL server into Word documents, generating multiple documents ("mail merge") option 2 is probably the one best suited to your requirements. You can find more information about this technology at OpenXMLDeveloper.org and there's an Open XML SDK forum on MSDN, as well as additional documentation on the technology.


    Cindy Meister, VSTO/Word MVP, my blog

    • Proposed as answer by servy42 Thursday, September 13, 2012 1:52 PM
    • Marked as answer by ASI Tech Friday, September 14, 2012 1:03 AM
    Thursday, September 13, 2012 11:42 AM
    Moderator

All replies

  • I'm reasonably certain that you don't want to use SharePoint as a solution for that type of problem.
    Tuesday, September 11, 2012 4:14 PM
  • I'm not an Office expert but use it almost everyday.  Over the past few years cloud computing is becoming King.  Recently, for example, we saw that PowerPoint no longer saves presentations as HTML pages.  Why is this?  Because it will save to a Cloud instead as HTML.  So MSFT has been slowly getting away from Desktop instances to Cloud instances.  For me, desktop is only way.  But MSFT doesn't see it that way and maybe system admins. don't either.  

    Enter Sharepoint.... What was interesting was that less than 5 years ago, you could trick a browser into showing Excel spreadsheets.  Today you cannot do that, I believe the reason is MSFT wanted to hold that back from us and that it had something to do with Sharepoint being a center for all things Office.  To me any spreadsheet should be openable inside a browser with full support.  But alas, the only thing available now is (get this) the desktop client!

    Conclusion:  To me the client portions of office will never be totally replaced.


    JP Cowboy Coders Unite!

    Tuesday, September 11, 2012 4:15 PM
  • ASI, it is a little bit difficult for me to understand what you are doing over there, but I'd ask you to consider this setup: Excel and Word.  Here is an example of filling Word DocVariables from Excel, using VBA (this process is controlled from Excel).

    Sub PushToWord()

    Dim objWord As New Word.Application
    Dim doc As Word.Document
    Dim bkmk As Word.Bookmark
    sWdFileName = Application.GetOpenFilename(, , , , False)
    Set doc = objWord.Documents.Open(sWdFileName)

    objWord.activedocument.variables("BrokerFirstName").Value = Range("BrokerFirstName").Value
    objWord.activedocument.variables("BrokerLastName").Value = Range("BrokerLastName").Value

    ActiveDocument.Fields.Update

    objWord.Visible = True

    End Sub

    In Word, Alt+F9 shows the DocVariables.  In Excel, you need to enter a couple NamedRanges ('BrokerFirstName' & 'BrokerLastName').




    Ryan Shuell

    Wednesday, September 12, 2012 4:00 AM
  • Thanks Ryan, but I'm trying to stay away from VBA / Macros.
    Thursday, September 13, 2012 2:37 AM
  • Hi ASI Tech

    For Word 2007 / 2010 you have two basic approaches available:

    1. Automate the "Interop" (same interface that VBA uses, but it could be .NET code, instead)

    2. Manipulate the Office Open XML files (*.dotx) directly, without requiring the Word application.

    Moving to Word 2013, a third possibility will be available:

    3. "Office apps". These let you display a task pane for the user to interact with and manipulate the current selection in the Office document.

    Given that you want to merge data from SQL server into Word documents, generating multiple documents ("mail merge") option 2 is probably the one best suited to your requirements. You can find more information about this technology at OpenXMLDeveloper.org and there's an Open XML SDK forum on MSDN, as well as additional documentation on the technology.


    Cindy Meister, VSTO/Word MVP, my blog

    • Proposed as answer by servy42 Thursday, September 13, 2012 1:52 PM
    • Marked as answer by ASI Tech Friday, September 14, 2012 1:03 AM
    Thursday, September 13, 2012 11:42 AM
    Moderator
  • I don't have SQL Server installed on my office machine, so I can't try this, but you can give it a go, and see how you get along:

    http://www.simple-talk.com/sql/t-sql-programming/writing-to-word-from-sql-server/


    Ryan Shuell

    Thursday, September 13, 2012 2:59 PM
  • Thank you Cindy. I'm checking out OpenXMLDeveloper.org now!
    Friday, September 14, 2012 1:03 AM