Jump to content
Charled

Sending datas in a pre-formatted Word document

Recommended Posts

Charled    0

Hello everyone,

I'm developing a little FMP database on Mac to help creating reports with MS Words. These reports will contain :

- non changing elements : logo and address, first level hierarchy titles…

- some specific datas from FMP : number and name of the affair, name and adress of the client…

- the text of the report directly typed in Word by the user.

So my need is :

- when all the fields are completed, user clics on "Create report" then :

- it creates a new folder with number and name of the affair,

- creates the report file by duplicating from the report template, naming it with number & name of the affair &.doc

- inserts datas from FMP (juste one record)

- add the file into a multimedia field to less user clic on it to open it.

All this by script of course for the user only clics on one button.

So what is the best way or what is the right plug-in for it ? I'm not familiar with Applescript nor VBA so I would prefer not have to use them.

Thanks all for your answers or suggestions.

Share this post


Link to post
Share on other sites
bcooney    102

The only plugin I know that interacts with Word is 306work's Scribe. The OS ops, creating a folder, etc., can be accomplished with their ScriptMaster product.

Share this post


Link to post
Share on other sites
comment    1,391

I'm not familiar with Applescript

Actually, Applescript may be your best option here - other than using a dedicated plugin (plus another plugin for the OS tasks).

What makes Word so attractive as an output format - compared to PDF, for example?

Share this post


Link to post
Share on other sites
bcooney    102

It's definitely worth examining the requirement that the final product is a Word doc. Sometimes, that is a relic of an old workflow, similar to "we must have reports in Excel."

Share this post


Link to post
Share on other sites
Charled    0

Hi everyone,

I'm back on this old topic. Thanks for your former help.

First, I answer the last question : why Word ? Because, after creating the document with FMP datas, users need to append it manually with Word.

Second. The situation now. As I couldn't manage to make Scribe work, I finally used EZXslt which did the job. But EZXslt is discontinued. So I would take advantage of making enhancements to the DB for replacing EZXslt by Scribe.

But, as before, my tests don't work. I tried to use ScribeDocSubstitute or ScribeDocWriteValue. But nothing is written in my Word document.

Can someone explain to me how I must prepare the document ? How I can add placeholders or what Scribe needs ?

I'm still using FMP 11 (.fmp7) ; Scribe 1_451 ; And Word 2011 Mac.

Thanks for help… again ;-)

Share this post


Link to post
Share on other sites
comment    1,391
Posted (edited)
30 minutes ago, Charled said:

First, I answer the last question : why Word ? Because, after creating the document with FMP datas, users need to append it manually with Word.

Wow, I don't think I have ever had a question answered 6 years after asking it. Except it doesn't really explain why they can't add their input from within Filemaker and then produce the final document from there.

Anyway, I cannot answer your questions regarding Scribe, so good luck with that.

 

 

Edited by comment

Share this post


Link to post
Share on other sites
Charled    0

Hi, sorry for being so long. I think I just didn't see your answer…

We are talking about expert reports which are all redacted the same way with same structure and 3 kind of datas :
- fixed informations (laws, blab bla…)
- datas about the case (who vs who, their adresses,  phone number, lawyers…) which come from the DB,
- text of the report itself (with photos etc) which must be written manually.

So I need to have some templates (.docx) with all the texte that don't change and the placeholders for case information. I duplicate the template, change the name, insert the datas in the placeholders. Then users can open it and append it manually.

If you know another way for sending datas into Word documents ? I tried with mail merge function but when I choose my database, Word says it can't connect to.

thx

Share this post


Link to post
Share on other sites
comment    1,391
3 minutes ago, Charled said:

If you know another way for sending datas into Word documents ?

Actually, I do know a couple, though they may not be as easy to work with as EZXslt or Scribe claim to be (I haven't worked with either, so I can't say for sure). But you can use XML export, with a custom XSLT stylesheet,  to produce a document that Word can read. I presume you would want a fomatted document conforming to some template. The most convenient format for this would be the Microsoft Word 2003 XML format (a.k.a WordProcessingML or WordML), which is just an XML document that Word considers as one of its native formats.

The process can be something like this:

  1. Create a template in Word, with some placeholders and save it as Microsoft Word 2003 XML;
  2. Open it in a text editor and use it as a basis for your XSLT stylesheet;
  3. Script your export to use the stylesheet.

Step 2 is manual and requires knowledge of the XSLT language. And you will need to repeat it any time you want to modify your template. But once it's done, it's just a matter of pressing a button and getting your document - just like exporting in one of the built-in formats.

It's also possible to use a similar process to produce a .docx document - but the format is more complicated, and you would also need a plugin to zip the result (I believe the free Base Element plugin could do this even in v.11).

And of course there 's AppleScript/VBA as you mentioned in the opening post.

 

  • Like 1

Share this post


Link to post
Share on other sites
Charled    0
Posted (edited)

Ok. Thanks.

How do I add placeholders in Word document (I'm on Mac with Word 2011) ?

Edited by Charled

Share this post


Link to post
Share on other sites
comment    1,391

There are no placeholders as such - use any text you can easily recognize, for example $$$CLIENTNAME$$$.

Share this post


Link to post
Share on other sites
MikeKD    7

Hi Charled,

Please take this answer with a HUGE pinch of salt!  I'm only a couple of baby steps beyond being a beginner....

I /think/ what I'd do here is create some kind of text string (one that's not likely to come up anywhere else) in word that I could then do a search / replace on, e.g:

////..Title..////

////..Date..////

////..Content..////

Oh boy - I've just seen comment's answer and I'm right!! Yay!

So then, you use substitute in FM to replace each of the text strings you've put in your template.

This is potentially /so/ useful!!!...

Thanks both :-)

 

 

Share this post


Link to post
Share on other sites
comment    1,391
15 minutes ago, MikeKD said:

I've just seen comment's answer and I'm right!! Yay!

You are right up to this point:

15 minutes ago, MikeKD said:

So then, you use substitute in FM to replace each of the text strings you've put in your template.

That's very limited. What if you have a placeholder for an item, but you want the final document to list 20 items (or any number of items in the current found set)? 

 

Share this post


Link to post
Share on other sites
MikeKD    7
Quote

That's very limited. What if you have a placeholder for an item, but you want the final document to list 20 items (or any number of items in the current found set)? 

mmm, *******, good point!

I'm showing my incompetence again..

My guess is that I should be looking at a calculation (or summary?) field listing either found or related records?

Once we've got the files text content correct, are there different methods for windows and Mac to set the filetype to .doc? Or is that part of the text content?

As always - huge thanks for the help you give to those of us learning the ropes comment :-)

Share this post


Link to post
Share on other sites
comment    1,391
6 minutes ago, MikeKD said:

My guess is that I should be looking at a calculation (or summary?) field listing either found or related records?

No the idea is to export the records and let the XSLT stylesheet do the hard work. I guess this may be a bit difficult to understand if you've never used XML/XSLT export. It's one of the most powerful and at the same time under-utilized FM features. 

 

Share this post


Link to post
Share on other sites
MikeKD    7

I've just had a quick google of it.

I think it needs rather more than a quick google! I think I probably need to learn how to use one tool at a time at the moment!!

Share this post


Link to post
Share on other sites
comment    1,391
1 minute ago, MikeKD said:

I think it needs rather more than a quick google!

It's true that XSLT is a world of its own. However, you only need a very limited knowledge of it in order to manipulate a Filemaker XML export into something useful.  There used be some basic examples included with the application, but I see that's no longer true. Still, there are quite a few examples here on FM Forums you can use for learning.

  • Like 1

Share this post


Link to post
Share on other sites
ryan360Works    18

Charled,

I think your best option is to use ScribeDocSubstitute instead of ScribeDocWriteValue. With Word documents, ScribeDocWriteValue requires your template to have named content control fields which can be a bit of a hassle to set up and I have only ever found the option to make them in the Windows version of Word. Example for how to use ScribeDocSubstitute is as follows:

Example is a form letter that might be sent out to a customer:

Quote

 

Hello CUSTOMERNAME,

We have found that your account, ACCOUNTNUMNER , is past due. Please pay ACCOUNTBALANCE by DUEDATE or your account will be canceled.

 

Here the placeholders are CUSTOMERNAME, ACCOUNTNUMBER, ACCOUNTBALANCE, and DUEDATE. In your FileMaker script you will load this document into memory using ScribeDocLoad. You will then call ScribeDocSubstitute for each placeholder Ex. ScribeDocSubstitute("CUSTOMERNAME";"John Smith")  and then save the file either with ScribeDocSaveContainer or ScribeDocSaveFile. 
 

Share this post


Link to post
Share on other sites
Charled    0

Thanks Ryan360Works.

I tried your solution with a little database with only 3 fields but it didn't work. I don't know why. Can I use fields name in ScribeDocSubstitue ? Ex : ScribeDocSubstitute("CUSTOMERNAME";Table::CustomerName)

Share this post


Link to post
Share on other sites
ryan360Works    18

Yes you can use field references as the second parameter. It does not need to be hard-coded. 

Share this post


Link to post
Share on other sites
Charled    0

ok.

What do you mean by "It does not need to be hard-coded" ?

Share this post


Link to post
Share on other sites
ryan360Works    18

By hard-coded I mean the parameter is not dynamic. IE ScribeDocSubstitute("CUSTOMERNAME";"John Smith") will always substitute John Smith in the place of CUSTOMERNAME regardless of what record you are on. However, ScribeDocSubstitute("CUSTOMERNAME"; Customer::CustomerName) will write whatever value is in CustomerName field for the current record. Have you tried using our example file? Do you see the same results that you saw in your own files?

Share this post


Link to post
Share on other sites
Charled    0

ok. thx.

Share this post


Link to post
Share on other sites
Charled    0

OK. This plugin is driving me crazy !!!!!

My configuration is FMP Advanced 11 on Mac with Scribe 1.451.

For testing, I've created the most simple DB : one table, a field name (text), a field lastname (text) and a container for the Word file.
My Word file is called TestScribe.docx and contains a %%%Nom%%% string (like in the example).
I copy/pasted the example script. When I run it, ScribeDocLoad finds the file (no error) but ScribeDocSubstitute answers : "No occurence of '%%%Nom%%%' were found in the document. Try using a shorter placeholder string, as longer strinqs with spaces and other characters may not be recognizable due to extra metadata."

What's wrong ?? I'm just using the same placeholder string %%%xx%%% as in the example.

Could it be a text encoding pb ? I tried to modify it but in Word you need to convert file in plaintext, then choose the right encoding, then save in docx. I tried with mac (by default) Windows Dos and UTF8 but none works (if the encoding is saved when converting back to docx).

I cand send my test files to anyone wants to test them. Thanks.

Share this post


Link to post
Share on other sites

Create an account or sign in to comment

You need to be a member in order to leave a comment

Create an account

Sign up for a new account in our community. It's easy!

Register a new account

Sign in

Already have an account? Sign in here.

Sign In Now


  • Similar Content

    • By fmdataweb
      I'm doing an export of a table with 5 fields to an Excel file with an XSL stylesheet to control the formatting of the Excel data. So far it's working well - I just need to add some additional formatting for a few of the cells. I'm looking for help with examples/syntax for setting the following attributes:
      - making a cell bold
      - changing the font size of a cell
      - making all columns set to auto resize so they fit the contents of each column (same as double clicking the divider between 2 columns)
      All fields I'm exporting are text fields.
      Thanks,
      Steve
    • By Little Mighty
      Hi Guys
      I can't figure out a solution for this. The final result is an export, No data have to be stored in filemaker afterwards.
      I need to combine and export data from 3 tables to the SAME field in Excel. Lets say we have table A: A1, A2 and A3, table B: B1, B2 and B3 and table C: C1, C2 and C3. These are tied together by a unique number in the solution. I need these fields to output i the export as all 1's in one column beneath each other, all 2's in one column beneath each other and all 3's in one column beneath each other. 
      I am thinking, that I need a new table to combine these fields in 3 new fields D1, D2 and D3 and then do the export of this table. After export, the table could be deleted until next export. I am thinking this should be set up as a script. 
      Does the above make sense, and could it be done via a script?
      Thanks for the help - really appreciate it!
    • By Jeff M
      Hello,
      I've done quite a bit with FileMaker in the past, but have never jumped into the XML arena. Now I have a need to do so, and I'm really needing some help with something I'm sure is quite basic...but still foreign to me. I have an external data source which export XML in a very specific format (see attached). I need to import that into FileMaker so I can manipulate the data, do some various lookups, etc. Once I've made my changes in the data, I need to export in the exact format it was when imported so the external data source can properly import.
      Not sure if it makes sense to import into 2 tables (workflows, workflow steps) or just a single table. I'm open either way. Once the data is in FileMaker I can get all my calculations and lookups and scripts going and make the data what I need it to be, but then I'll need to export it.
      Can someone point me in the right direction?
      Thanks so much in advance!
      Jeff
      workflows_export.xml
    • By pomilpetan
      Good morning everyone I created a database runtime solution with FileMaker Pro 15 advanced. The program must export the contents of a form in PDF format. In a solution that runs under FileMaker I could use the command "Save as PDF" but this command does not work in a runtime solution. Could someone tell me how I could make this function? thank you so much.
    • By Kevin Groder
      Hi,
      Has anyone else found that you are unable to export .fmp12 records from FM 16? I use this step in many scripts and the first machine I upgraded ( out of 48 ) I get the "unable to save file" error every time. FM 15 works, FM 16 fails on the same DB, same table, same record set. I can't even export manually.
      I made a screen movie here: https://www.youtube.com/watch?v=iOGcm4bt86o
       
×

Important Information

By using this site, you agree to our Terms of Use.