none
Generating a Word Document from Data in a SQL Database RRS feed

  • Question

  • I have a tool that collects data from a client side form into a server side SQL database. I want to use the data entered into the form by the client to generate a word document on the server side and push that word document back out to the client. I have used php to gather the required SQL data on the server side. What would you suggest I use to generate the server-side MS Word document to push out to the client?

    Robert L. Collins

    Tuesday, July 22, 2014 7:05 PM

Answers

  • Hi Robert,

    You can use XSL Transformations (XSLT) to transform XML data into the Microsoft Office Open XML SDK 2.0 format that is used by Microsoft Office Word 2007, and make new Word 2007 documents from XML data. You can simplify transforming XML data into a Word 2007 document by starting with an existing Word 2007 document that has the desired layout.

    This Visual How To shows how to use XSLT and PHP to create a new Word 2007 document. It shows how you create an XSL Transform file that is based on an existing Word 2007 document. The code sample shows how to use the XSL Transform file to create a Word 2007 document based on data that is stored in an XML file.

    This Visual How To uses PHP version 5.3.0 which you must install in order to follow the steps provided here.

    For more information, please refer to Using PHP to Create a Word 2007 Document.

    Hope this helps.


    We are trying to better understand customer views on social support experience, so your participation in this interview project would be greatly appreciated if you have time. Thanks for helping make community forums a great place.
    Click HERE to participate the survey.

    Wednesday, July 23, 2014 8:33 AM
    Moderator

All replies

  • Hi Robert,

    You can use XSL Transformations (XSLT) to transform XML data into the Microsoft Office Open XML SDK 2.0 format that is used by Microsoft Office Word 2007, and make new Word 2007 documents from XML data. You can simplify transforming XML data into a Word 2007 document by starting with an existing Word 2007 document that has the desired layout.

    This Visual How To shows how to use XSLT and PHP to create a new Word 2007 document. It shows how you create an XSL Transform file that is based on an existing Word 2007 document. The code sample shows how to use the XSL Transform file to create a Word 2007 document based on data that is stored in an XML file.

    This Visual How To uses PHP version 5.3.0 which you must install in order to follow the steps provided here.

    For more information, please refer to Using PHP to Create a Word 2007 Document.

    Hope this helps.


    We are trying to better understand customer views on social support experience, so your participation in this interview project would be greatly appreciated if you have time. Thanks for helping make community forums a great place.
    Click HERE to participate the survey.

    Wednesday, July 23, 2014 8:33 AM
    Moderator
  • Never used it, but the Word part of the open source PHPOffice may be useful.

    Peter Jamieson

    Thursday, July 24, 2014 10:42 AM