dbTalk Databases Forums  

Create Word documents

comp.databases.filemaker comp.databases.filemaker


Discuss Create Word documents in the comp.databases.filemaker forum.



Reply
 
Thread Tools Display Modes
  #1  
Old   
R Kruit
 
Posts: n/a

Default Create Word documents - 05-11-2005 , 06:36 AM






I changed form VB to Filemaker programming. With VB i could open a MS Word
document and added some contents from databse fields to the Word document.
Then the save of the document is also initiated from the program. The
filname is again the contents of a databasefield.

Is there a way to do this in Filemaker ?

Gr.
Roland



Reply With Quote
  #2  
Old   
G.Miller
 
Posts: n/a

Default Re: Create Word documents - 08-05-2005 , 08:33 AM






Quote:
I changed form VB to Filemaker programming. With VB i could open a MS Word
document and added some contents from databse fields to the Word document.
Then the save of the document is also initiated from the program. The
filname is again the contents of a databasefield.

Is there a way to do this in Filemaker ?
You can do this using Applescipt.

It depends on which versions of filemaker, word and OSX you have.

I was able to do it using filemaker 6 pro, word X and 10.2, 10.3.

When I upgraded to filemaker 7, my scripts stopped working because filemaker
began exporting text as Unicode text, and word X cannot import Unicode, only
plain text. I was able to find a fix by converting the text in my
applescript before importing into word.

I just upgraded my OS to 10.4 and now my scripts are broken again. It seems
that the new applescript that comes with tiger cannot do whatever it was
doing before to convert the unicode text.

I guess I am forced to upgrade to Word 2004 because, apparently, Word 2004
can import unicode text. So that should fix everything until the next
software upgrade. Thankfully, I use the database and this function only in
my office (ie it doesnąt get distributed to clients), otherwise it would be
a major hassle.

Here is an example of the script that used to work:

tell application "FileMaker Pro"
tell layout "layout_name"
set myVar to cellValue of field "field_name" of current record

-- this converts the Unicode text into a string and opens the target file
which is on the desktop

tell application "Finder"
set myVar to item 1 of ((myVar as record) as list))
open file "word_filename" of desktop
end tell

tell application "Microsoft Word"
activate
set contents of selection to myVar
end tell


You can tinker around with word by using commands like:
do Visual Basic "Selection.MoveDown Unit:=wdLine, Count:=2"
do Visual Basic "Selection.TypeParagraph"
Basically, you are sending VB commands through applescript. You can tweak
it to save files and all that jazz....

Good luck!

G.Miller



Reply With Quote
Reply




Thread Tools
Display Modes

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

vB code is On
Smilies are On
[IMG] code is On
HTML code is Off



Powered by vBulletin Version 3.5.3
Copyright ©2000 - 2012, Jelsoft Enterprises Ltd.