Skip to main content
josemanuelo0002
April 27, 2023
Question

Is there a plugin or a way to create a word document with information from the database?

  • April 27, 2023
  • 6 replies
  • 0 views

Hi! I am currently using the smart service "MS Word 2007 Doc from Template" to generate a word with a default template and to be able to retrieve the data of a record within a label that can be printed as a sticker. My question is, is there a way that I can generate a word document with N records and when I retrieve that data each record is stored in a separate tag. It would be something like this:

Thanks for your help.

6 replies

stefanhelzle0001
Brainy
April 27, 2023

AFAIk there is no direct way of doing this. You could create that template to include all stickers and include a number in the placeholders to inject data at runtime.

mikes0011
Brainy
April 27, 2023

I'll preface to say that one of the more advanced Word Doc generation smart services may work more smoothely for this.  But my experience is mainly with the Word 2007 from Template smart service. 

For this scenario, you would create a template with a single replacement key.  Then you're free to insert as much data as you want from Appian - for formatting, you'd need to make use of injecting WordML tags along with your (sanitized) text.  It would be hard to get a grid like in your example, but if you'd settle for a list of entries with nice linebreaks, it would be fairly simple to accomplish, because you'd just need to replace all text linebreaks with the WordML linebreak sequence.

josemanuelo0002
April 27, 2023

Thanks for your answer. Could you give me an example of how to retrieve a series of records with the line break you mention? Currently I am only able to get the data from a single record.

mikes0011
Brainy
April 27, 2023

I'm unclear what you're asking here - are you saying you don't know how to query a list of data, as opposed to a single entry?  Are you using Data Store + a!queryEntity()?  Or are you using Synced Records?

Edit: to clarify a bit, what we're talking about here in general is setting up a process model wherein some data is queried into local PV variables, for instance, and after that, the "Word from template..." smart service is called in such a way as to generate a document reflecting that queried data.  There isn't some magical one-stop tool to do everything all in one package, though some of the steps can be condensed slightly after you're confident in your methodology.