Обсуждение: Link Office Word form document with data from PostgreSQL
Hi all,
Have you ever experienced how to populate fields from a MS Office Word document with a PostgreSQL data available either in a table or view?
I haven’t seen anything on the web; only possible with MS products, VS or Access.
Thank you for your input
If you have windows then yes something like vba to pull data into MS Office Word .. search google for 'ms word odbc connection' a postgres mailing list is not the right place to do this search
If you are on *nix don't have/want windows & office products but want to generate/write to a MS Office Word document then postgresql extension perlu and something from the CPAN library like Win32::Word::Writer will work
Hector Vass
+44(0)7773 352 559
* Metametrics, International House, 107 Gloucester Road, Malmesbury, Wiltshire, SN16 0AJ
Sent: 30 March 2015 09:20
To: pgsql-novice@postgresql.org; pgsql-sql@postgresql.org; pgsql-general@postgresql.org
Subject: [SQL] Link Office Word form document with data from PostgreSQL
Hi all,
Have you ever experienced how to populate fields from a MS Office Word document with a PostgreSQL data available either in a table or view?
I haven’t seen anything on the web; only possible with MS products, VS or Access.
Thank you for your input
On Mon, 30 Mar 2015 10:20:15 +0200 avpro avpro <avprowebeden@gmail.com> wrote: > Have you ever experienced how to populate fields from a MS Office Word > document with a PostgreSQL data available either in a table or view? > > I haven’t seen anything on the web; only possible with MS products, VS or > Access. Hi, I use Perl for this. The process is : -unzip the .docx document, and look for /word/document.xml in the resulting directory -substitute field names with their values in this file (I don't use MS Word 'fields', though, just placeholders that areunlikely to be found in documents, such as client_name, client_address, facturation_date, etc) -zip the archive anew with a .docx extension Voilà. The code is about 40 lines long, I can post it if you care; the same process also works with Libre/OpenOffice documents -- Salutations, Vincent Veyron https://marica.fr/ Gestion des contentieux, des dossiers de sinistres assurance et des contrats pour le service juridique
Re: Re: [GENERAL] Link Office Word form document with data from PostgreSQL
Il 30.03.2015 15:01, Vincent Veyron ha scritto: > Hi, > > I use Perl for this. The process is : > > -unzip the .docx document, and look for /word/document.xml in the resulting directory > -substitute field names with their values in this file (I don't use MS Word 'fields', though, just placeholders that areunlikely to be found in documents, such as client_name, client_address, facturation_date, etc) > -zip the archive anew with a .docx extension > > Voilà. > > The code is about 40 lines long, I can post it if you care; the same process also works with Libre/OpenOffice documents > Hi Vincent, could you please post the code? That would be very nice. Thank you vince
On Mon, 30 Mar 2015 17:37:28 +0200 Vincenzo Campanella <vinz65@gmail.com> wrote: Stirling Newberry <stirling.newberry@gmail.com> wrote: >post the code Here you go : http://pastebin.com/eVXZiFws This is a mod_perl module used in the HeaderParser phase of the Apache request cycle; it first grabs the sql associated withthe model, and passes parameters to it; this sql is used to retrieve the required values for the model, and the placeholdersin the document are replaced with those values. The user is then redirected to the newly created document You can see it in action in the demo account of the site referenced in my signature : open any file (those are legal files/insuranceclaims), click on the 'Contributors' tab (third tab from left; add a contributor if none is present), andclick on 'Templates'. Click on the template to generate a document -- Salutations, Vincent Veyron https://legalcase.libremen.com/ Legal case, contract and insurance claim management software
I think to easiest option for me would be to use the ODBC connection. Now my problem is where to start with the VBA code; but that's for another list.
cheers
On Mon, 30 Mar 2015 17:37:28 +0200
Vincenzo Campanella <vinz65@gmail.com> wrote:
Stirling Newberry <stirling.newberry@gmail.com> wrote:
>post the code
Here you go :
http://pastebin.com/eVXZiFws
This is a mod_perl module used in the HeaderParser phase of the Apache request cycle; it first grabs the sql associated with the model, and passes parameters to it; this sql is used to retrieve the required values for the model, and the placeholders in the document are replaced with those values. The user is then redirected to the newly created document
You can see it in action in the demo account of the site referenced in my signature : open any file (those are legal files/insurance claims), click on the 'Contributors' tab (third tab from left; add a contributor if none is present), and click on 'Templates'. Click on the template to generate a document
--
Salutations, Vincent Veyron
https://legalcase.libremen.com/
Legal case, contract and insurance claim management software
thank you all for your responses.
I think to easiest option for me would be to use the ODBC connection. Now my problem is where to start with the VBA code; but that's for another list.
cheersOn 30 March 2015 at 19:51, Vincent Veyron <vv.lists@wanadoo.fr> wrote:On Mon, 30 Mar 2015 17:37:28 +0200
Vincenzo Campanella <vinz65@gmail.com> wrote:
Stirling Newberry <stirling.newberry@gmail.com> wrote:
>post the code
Here you go :
http://pastebin.com/eVXZiFws
This is a mod_perl module used in the HeaderParser phase of the Apache request cycle; it first grabs the sql associated with the model, and passes parameters to it; this sql is used to retrieve the required values for the model, and the placeholders in the document are replaced with those values. The user is then redirected to the newly created document
You can see it in action in the demo account of the site referenced in my signature : open any file (those are legal files/insurance claims), click on the 'Contributors' tab (third tab from left; add a contributor if none is present), and click on 'Templates'. Click on the template to generate a document
--
Salutations, Vincent Veyron
https://legalcase.libremen.com/
Legal case, contract and insurance claim management software
If PHP is an option, you might want to look at the Tiny But Strong template system (http://www.tinybutstrong.com/), along with the OpenTBS plugin (http://www.tinybutstrong.com/plugins/opentbs/demo/demo.html).
![](http://agency-software.org/demo/client/images/agency_logo_small.png)