Re: [GENERAL] Link Office Word form document with data from PostgreSQL

From: Vincent Veyron <vv(dot)lists(at)wanadoo(dot)fr>
To: avpro avpro <avprowebeden(at)gmail(dot)com>
Cc: pgsql-novice(at)postgresql(dot)org, pgsql-sql(at)postgresql(dot)org, pgsql-general(at)postgresql(dot)org
Subject: Re: [GENERAL] Link Office Word form document with data from PostgreSQL
Date: 2015-03-30 13:01:21
Message-ID: 20150330150121.39fc80c1614692b758a6aae3@wanadoo.fr
Views: Raw Message | Whole Thread | Download mbox | Resend email
Thread:
Lists: pgsql-general pgsql-novice pgsql-sql

On Mon, 30 Mar 2015 10:20:15 +0200
avpro avpro <avprowebeden(at)gmail(dot)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 are unlikely 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

In response to

Responses

Browse pgsql-general by date

  From Date Subject
Next Message Guillaume Drolet 2015-03-30 13:04:33 Slow trigger on insert: alternative solutions?
Previous Message John McKown 2015-03-30 11:47:01 Re: How to recover or resent the password for the user 'postgres'

Browse pgsql-novice by date

  From Date Subject
Next Message John R Pierce 2015-03-30 15:18:23 Re: Link Office Word form document with data from PostgreSQL
Previous Message Felipe Santos 2015-03-30 11:09:36 Re: [SQL] [GENERAL] JSON TO POSTGRE TABLE

Browse pgsql-sql by date

  From Date Subject
Next Message John R Pierce 2015-03-30 15:18:23 Re: Link Office Word form document with data from PostgreSQL
Previous Message Felipe Santos 2015-03-30 11:09:36 Re: [SQL] [GENERAL] JSON TO POSTGRE TABLE