Google Groups no longer supports new Usenet posts or subscriptions. Historical content remains viewable.
Dismiss

OLE and Word

31 views
Skip to first unread message

Trevor G. Leybourne

unread,
Feb 10, 1997, 3:00:00 AM2/10/97
to

I have a project whereby th sales consultants enter quotes into our system,
but then need to be able to export that information into a word document
for re-formatting, customisation etc. Can anyone help me, by gib\ving me
some examples, of how I can generate a "default" word document (ie.
exporting the information from my database into a word document) and then
allowing the user to edit this document on screen.

Trevor Leybourne
tre...@mailing.co.nz

Steve MacLeod

unread,
Feb 12, 1997, 3:00:00 AM2/12/97
to

>Trevor Leybourne
>tre...@mailing.co.nz

Hi Trevor

There was a write up on this in one of the first Clarion for Windows
journals ... if you don't get the magazine I recommend you get it now
.. and of course I mean *all 4* back issues ...

From that point there are also a number of 3rd party addins to do the
mail merge for you .. Mitten has one .. DDEHotBrowse from Yoram Beer
is another .. and last of all just check out the help on Word Basic in
your MS Word help files .. you will see how almost everything can be
called by DDE or OLE .. just record a macro and review it ..

And if you think that Word Basic is not so easy .. check out what is
needed with WordPerfect .. I think you will gain a fondness for MS
Word!<g>

hth

Best Regards
sm
-----------------------------------------------------------------------
Steve MacLeod Microcomputer Specialist (902)563-1625
Computer Centre University College of Cape Breton
Sydney, N.S. Canada B1A 2H8
--------------------ooOOoo---------------------
smac...@uccb.ns.ca
CIS: 76234,3371
http://w3.uccb.ns.ca/clarion
Member of Team TopSpeed Internet


Christopher Hargett

unread,
Feb 12, 1997, 3:00:00 AM2/12/97
to Trevor G. Leybourne

Trevor G. Leybourne wrote:
>
> I have a project whereby th sales consultants enter quotes into our system,
> but then need to be able to export that information into a word document
> for re-formatting, customisation etc. Can anyone help me, by gib\ving me
> some examples, of how I can generate a "default" word document (ie.
> exporting the information from my database into a word document) and then
> allowing the user to edit this document on screen.
>
> Trevor Leybourne
> tre...@mailing.co.nz

Trevor,

I'm whacking through the bush a little ahead of you. My project is
somewhat similar. Steve's suggestion will get you started but
apparently
there is not that much experience out here. Vocal experience anyway.
Here's some untested code you can try:

wb LONG(0) !Holds window control for OLE
Object
....
if wb=0 THEN !If control hasn't been created
wb=LastField()+1 !Get a FEQ number
CREATE(wb,CREATE:OLE) !Create a new OLE Object
SETPOSITION(wb,0,0,0,0) !Make object infintesibly small
unhide(wb) !Still won't see it because of
above
wb{PROP:create}='Word.Basic' !OLE object that recognizes Word
Basic
wb{PROP:ReportException}=1 !Report Faux Pas
END
wb{'AppMaximize'} !Maximize Word
wb{'FileNew("C:\MSOffice\Templates\Normal.dot"'} !Create a new
document
SET(CHGLIST) !This is an ascii file layout
follows
NEXT(CHGLIST) !Get first record
LOOP UNTIL ERRORCODE() !Do until no more records
! This will insert text in the format "PRE:FIELD = xxxxxxxxxxxxx"
into the document
wb{'Insert("'&CLIP(CLIST:FIELD)&' =
'&clip(evaluate(CLIST:REPLACEMENT))&'")'}
! This is commented out line the will do a FindAndReplace of all
matching text
!
wb{'EditReplace("'&CLIP(CLIST:FIELD)&'","'&clip(evaluate(CLIST:REPLACEMENT))&'",0,0,0,0,0,1,0,1,0,,)'}
NEXT(CHGLIST)
END
....


CHGLIST Ascii File Layout:
CHGLIST
FILE,DRIVER('ASCII'),PRE(CLIST),CREATE,BINDABLE,THREAD,EXTERNAL(''),DLL(dll_mode)
Record RECORD,PRE()
FIELD STRING(32)
REPLACEMENT STRING(32)
END
END

CHGLIST contents:
PAT:DATEOFBIRTH FORMAT(PAT:DATEOFBIRTH,@D1)
PAT:HEIGHT FORMAT(PAT:HEIGHT,@N3)&' IN'
PAT:WEIGHT FORMAT(PAT:WEIGHT,@N3)&' LBS'


It wouldn't hurt to get a copy of Microsoft's "Word Developer's Kit".
It's a VB based book (of course),
but it has valuable information and some electronic media in the back.


Let me know how it goes,
Christopher "Harg" Hargett

Peter Kirk

unread,
Feb 14, 1997, 3:00:00 AM2/14/97
to

Trevor G. Leybourne <tre...@leybourne.gen.nz> wrote:

TR>I have a project whereby th sales consultants enter quotes into our system,
TR>but then need to be able to export that information into a word document
TR>for re-formatting, customisation etc. Can anyone help me, by gib\ving me
TR>some examples, of how I can generate a "default" word document (ie.
TR>exporting the information from my database into a word document) and then
TR>allowing the user to edit this document on screen.


I have developed a set procedures and routines that enable merges to
WORD documents using OLE and Word Basic. The documents are stored in
a Container (BLOB) attached to a central database where they can browsed
and easily located by other users on the network.

I am using the procedures in an application I am writting for accountants
that merges a range of documents including Job Estimates and Tax Letters
and Applications to the Tax office.

A set of buffered IO routines enables DOS files greater than 64K to be
imported and stored in the BLOB. These enable the catalog to be extended
to handle OLE Objects, Document Files, Scanned Images, Drawing Files and
DOS EXE's.

***************************************************

I have put together a demonstration program that you can download from:
Either: http://dyson.brisnet.org.au/~cugq
or : ftp.icetips.com/incoming

It can also be found on the DEMO directory of the Clarion Forum on
Compuserv.

The full source code for the demo program can be purchased for $100US
including:

***************************************************

1) A setup utility for registering Documents by Class and Topic
and for nominating which Word Templates and Macros the Documents
will use in the merge process.

2) A browse utility for locating and updating Documents in the
Catalog. The browse utility allows records to be selected
and printed without opening the container.

3) Forms for updating the Catalog. This includes a universal
attachment control for importing DOS Files and for merging
documents to an OLE container.

4) Sample procedures for creating the Basic CSV merge files.

5) Word Templates and Macros to use with the sample data.

***************************************************

NOTE: The program is 32 bit designed and tested to work under
Win95 using Clarion CW2002 and Word 7.

For more information contact:
PETER KIRK
EMail peter...@cugq.brisnet.org.au
___
ş SLMR 2.1a ş Back Up My Hard Drive? I Can't Find The Reverse Switch!

0 new messages