storing a Word document as a customprop

Jan Schenkel janschenkel at yahoo.com
Fri Jun 12 09:24:30 EDT 2009


The Word file format is binary, and may contain checksums that will not add up when you replace something in it. It's better to save the Word file as an RTF document (as this is not a binary, but text-based file format) and fill that up instead.
You may want to use the 'merge' function to make your life easier - see also the articles that I wrote for the RevUp Newsletter:
- The Power of Merge (revUp | Issue 55 | August 18th, 2008)
  <http://runrev.com/newsletter/august/issue55/newsletter2.php>
- The Word of Merge - part 1 (revUp | Issue 61 | November 20th, 2008)
  <http://runrev.com/newsletter/november/issue61/newsletter3.php>
- The Word of Merge - part 2 (revUp | Issue 62 | December 22nd, 2008)
  <http://runrev.com/newsletter/december/issue62/newsletter3.php>

HTH,

Jan Schenkel
=====
Quartam Reports & PDF Library for Revolution
<http://www.quartam.com>

=====
"As we grow older, we grow both wiser and more foolish at the same time."  (La Rochefoucauld)


--- On Fri, 6/12/09, Peter Brigham MD <pmbrig at gmail.com> wrote:

> From: Peter Brigham MD <pmbrig at gmail.com>
> Subject: storing a Word document as a customprop
> To: "Use-rev mailing list" <use-revolution at lists.runrev.com>
> Date: Friday, June 12, 2009, 5:55 AM
> I would like to generate a Word doc
> stored in a customprop but I'd like to modify it first by
> script. I have a template successfully stored as the
> printDoc of this stack, with placeholders in applicable
> places like "<last>", "<first>", etc. However,
> this doesn't work:
> 
> on mouseup
>    put fld "Name" into tName
>    put item 1 of tName into lastName
>    put word 1 of item 2 of tName into
> firstName
>    put the printDoc of this stack into tDoc
>    replace "<last>" with lastName in
> tDoc -- * problem
>    replace "<first>" with firstName in
> tDoc -- * problem
>    put the printPath of this stack into
> pPath
>    -- contains something like
> "binfile:/Users/pmbrig/Desktop/wordTest.doc"
>    set the itemdelimiter to "/"
>    put tolower(lastName) & ".doc" into
> item -1 of pPath
>    set the filetype to "MSWDW8BN"
>    put tDoc into url pPath
> end mouseup
> 
> I get an error from the finder that the file "doesn't
> appear to be a Microsoft Word file." If I comment out the
> two "replace" lines in the script, the original template
> file is exported fine, and it opens fine in Word with a
> double-click. So there's something Word doesn't like about
> the replace operation. Is there any way to do this so I
> create the template document modified with data filled in
> from Rev?
> 
> -- Peter
> 
> Peter M. Brigham
> pmbrig at gmail.com
> http://home.comcast.net/~pmbrig
> 
> _______________________________________________
> use-revolution mailing list
> use-revolution at lists.runrev.com
> Please visit this url to subscribe, unsubscribe and manage
> your subscription preferences:
> http://lists.runrev.com/mailman/listinfo/use-revolution
> 


      



More information about the use-livecode mailing list