No need for custom code required - use SharePoint Designer 2013 ONLY.
What you can do is, using SharePoint Designer 2013, create a Workflow that uses the data from a List to create an item in a Library. You create a document library with the same fields as the list, and the workflow creates the item in the document library and passes over the values of the fields. The document template for the library will be customized, and you can easily insert the SharePoint list fields into the document using Quick Parts. Finally, set up a Custom Action that runs the workflow on a selected item.
The basic process is : Create Site Columns; Create Content Types; Create List and Library; Set up Document Template; Create Workflow.
There are a few "gotchas" though, so I will walk you through it:
Steps:
- Create the columns for the data as site columns
- Create a list item content type and a document content type and add the columns to each (its easiest to go to the Administration Web Page for the content type and click "Add Site Columns")
- Create a list and a library for each of the content types - enable custom content types and associate each with its respective content type.
Set up the Document Library
a. Make your custom content type the default, and remove the old "document" content type.
b. Use the "Edit Document Template" button (on the ribbon) for the Library, open it, and then save it back to the site as a .docx file (not a .dotx file). You MUST save the template as a .docx file.
c. Set the Document Template URL for the Library to the .docx file
You can now open you document template and add in the fields for the columns by going Insert -> Quick Part -> Document Property
Create your workflow. In SharePoint Designer Hit the New button on the Workflows section of your LIST (not the library)
a. Create a new SHAREPOINT 2010 Workflow (NOT 2013). It MUST be a 2010 Workflow.
b. In the workflow, set up an Action to Create New List Item in your Document Library. You will then be prompted to pass over fields and values.
c. You MUST pass over the "Content Type ID" field and set the value to your custom content type
d. You MUST set the "Path and Name (*)" variable to something like [%Current Item:Title%].docx
e. Now you can go to the Workflow Settings and set the Workflow to run automatically whenever you create a new item on the list, or go to the list and set up a Custom Action to run the workflow.