Received: from malur.postgresql.org ([217.196.149.56]) by arkaria.postgresql.org with esmtp (Exim 4.80) (envelope-from ) id 1YcZJr-0001Fb-MR for pgsql-sql@arkaria.postgresql.org; Mon, 30 Mar 2015 13:01:31 +0000 Received: from localhost ([127.0.0.1] helo=postgresql.org) by malur.postgresql.org with smtp (Exim 4.80) (envelope-from ) id 1YcZJq-0008Ov-Bm for pgsql-sql@arkaria.postgresql.org; Mon, 30 Mar 2015 13:01:30 +0000 Received: from magus.postgresql.org ([2a02:c0:301:0:ffff::29]) by malur.postgresql.org with esmtps (TLS1.2:DHE_RSA_AES_256_CBC_SHA256:256) (Exim 4.80) (envelope-from ) id 1YcZJp-0008Oo-As for pgsql-sql@postgresql.org; Mon, 30 Mar 2015 13:01:29 +0000 Received: from smtp07.smtpout.orange.fr ([80.12.242.129] helo=smtp.smtpout.orange.fr) by magus.postgresql.org with esmtps (TLS1.0:DHE_RSA_AES_256_CBC_SHA1:256) (Exim 4.80) (envelope-from ) id 1YcZJl-0004E7-2G for pgsql-sql@postgresql.org; Mon, 30 Mar 2015 13:01:28 +0000 Received: from X201.home ([193.251.178.45]) by mwinf5d13 with ME id 9p1N1q0060z9ZVd03p1NzL; Mon, 30 Mar 2015 15:01:23 +0200 X-ME-Helo: X201.home X-ME-Auth: dnYubGlzdHNAd2FuYWRvby5mcg== X-ME-Date: Mon, 30 Mar 2015 15:01:23 +0200 X-ME-IP: 193.251.178.45 Date: Mon, 30 Mar 2015 15:01:21 +0200 From: Vincent Veyron To: avpro avpro Cc: pgsql-novice@postgresql.org, pgsql-sql@postgresql.org, pgsql-general@postgresql.org Subject: Re: [GENERAL] Link Office Word form document with data from PostgreSQL Message-Id: <20150330150121.39fc80c1614692b758a6aae3@wanadoo.fr> In-Reply-To: References: X-Mailer: Sylpheed 3.2.0 (GTK+ 2.24.10; i486-pc-linux-gnu) Mime-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit X-Pg-Spam-Score: -1.9 (-) List-Archive: List-Help: List-ID: List-Owner: List-Post: List-Subscribe: List-Unsubscribe: X-Mailing-List: pgsql-sql Precedence: bulk Sender: pgsql-sql-owner@postgresql.org On Mon, 30 Mar 2015 10:20:15 +0200 avpro avpro 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 -- Sent via pgsql-sql mailing list (pgsql-sql@postgresql.org) To make changes to your subscription: http://www.postgresql.org/mailpref/pgsql-sql