MS-Word document

I want to generate a worddocument with the content of the fields in a sc-form
i.E I the have name, the adress etc in a form and want to make a Word document with the content of the fields in it.
I could prepare a word-template with bookmarks etc. and use it in combination with scriptcase.
Word should open with the filled fields on the right place and after that I start typing the content in the middle.

Question: What are steps to go…starting with the form in sc.

Can somebody help me?

Kind regards

Bert Steinebach

[QUOTE=ctmservice;22497]I want to generate a worddocument with the content of the fields in a sc-form
i.E I the have name, the adress etc in a form and want to make a Word document with the content of the fields in it.
I could prepare a word-template with bookmarks etc. and use it in combination with scriptcase.
Word should open with the filled fields on the right place and after that I start typing the content in the middle.

Question: What are steps to go…starting with the form in sc.

Can somebody help me?

Kind regards

Bert Steinebach[/QUOTE]

Hi Bert,

I assume that you want to create a docx as this is a text word format. If not, you should create a rtf file which can be opened by MsWord. What I useually do is create a template file in RTF so that fonts etc. are all in place. Where I want to store the data I create a template variable, i.e. [%myname%] In some event I read the rtf and do a stringreplace of the templatevariable by my scriptcase variable. Then it’s done. Finally to download you need to create a blanc application so that you can set the correct output header so that word is opened. After generating the file you put the text in a global variable and call the blanc application to get it output as rtf.

If you want to do that in word you could also install word on your server and control word via DOM.

http://msdn.microsoft.com/en-us/library/ee840137(v=office.12).aspx
http://msdn.microsoft.com/en-us/library/kw65a0we.aspx
http://ca3.php.net/com
http://webcheatsheet.com/php/create_word_excel_csv_files_with_php.php

Alternatively:
http://www.phpdocx.com/
http://www.phpclasses.org/package/2631-PHP-Create-Microsoft-Word-document-without-COM-objects.html
http://www.phpclasses.org/package/8175-PHP-Create-Microsoft-Word-DocX-document-from-template.html

etc… there is a LOT of info on how to do that. Basically using COM makes working with word quite easy…

Thanks for yours answers. (Albert and rr)
I will work on it and give a reply of the results on this forum.
Kind Regards Bert

Hi Bert,
did you made something with WORD merge… finally ???
In past I did something similar using a Php Word library creating a library folder within SC project application folder…
Something like …/z_phpword_CG using then the command.
require_once ‘…/z_phpword_CG/PHPWord.php’;
Now I’m trying to use


as public library of SC. I installed it many times but when you run the app it has always issues.
I tried all possible combinations without success and so trying to update the project from 8 to 9.6 I had to recreate the old directory with old library I used many years ago.
Did you ever used the command like this ?
sc_include_library(“sys”, “Php_Word”, “PHPWORD/src/PhpWord/PhpWord.php”, true, true );