Hi Simon,
Thank you for your interest in our products. Please find the answers below.
How can I take the content of my SQL database and put it in my MS Word template?
The most suitable way is via MailMerge feature. You can find an example of Aspose.Words code using an SQL query to fill an MS Word template here:
https://docs.aspose.com/words/net/types-of-mail-merge-operations/
Do I have to use Aspose.Word.SharePoint?
The short answer is “No”.
You can use Aspose.Words or Aspose.Words for SharePoint. They use the same templates. A template is an MS Word file where placeholders to be filled with data are designated with MAILMERGE fields.
Aspose.Words is a class library. You need some code to retrieve your data from a database and put into a DataTable, DataSet or other supported object. Then you call Document.MailMergeExecute() to fill the template.
Aspose.Words for SharePoint is much like a wrapper around Aspose.Words. It integrates into SharePoint and provides user interface and workflow activities for file conversion and making reports. To make a report, you describe you data source and query in an XML file. You link this file with a mail merge template and put both files in a SharePoint document library. Then you can fill the report via user interface or workflow. You can also build the report programmatically via Aspose.Words for SharePoint API.
So I think that in case you are going to have your own code to retrieve the data (or for some other purpose) you should better use Aspose.Words. It’s much more flexible.
If all you need to code is a database connection, query to retrieve your data and probably some parameters, you can try Aspose.Words for SharePoint.
Do I have to create a XML from my SQL query and feed it every time to some C# code that would run in some SharePoint workflow?
The idea behind putting query into an XML file was to avoid writing code. I’m attaching an example of a test report template and definition. You can use Aspose.Words for SharePoint for making reports from such files without writing your own code.
So if you are going to have your own code to query anyway, it’s simpler to use Aspose.Words directly.
Is there some well explained examples of that?
I’ve given a link to Aspose.Words mail merge code example above.
Please check the attached files for an example of a simple Aspose.Words for SharePoint report. If you try to use them, note that the link between .doc template and report description should match the actual file location. Please see how to update the link in this topic:
https://docs.aspose.com/words/sharepoint/linking-report-template-with-report-definition/
if needed.
Hope this helps you. Feel free to ask further questions, I will be glad to help you.
Thanks && Best Regards,