Board index » delphi » D6 -> Word XP/2002

D6 -> Word XP/2002

Hi - I've had working for a few years an app originally written in D5 and
working with Word 97/2000. It uses Word OLE to create a document based upon
a 'form' template. It then 'pokes' data into the formfields using a variant
to reference the field number and a string to pass the data. And it all
works well.

Users have now moved to Office XP/XP Pro and the output from this program is
now so sloooow! I've modified it to see the Word document as data is poked
into it and it's amazingly slow at receiving the data. Anyone any ideas
please as to what's wrong?

Cheers

David

 

Re:D6 -> Word XP/2002


<<David Smith:
I've modified it to see the Word document as data is poked
into it and it's amazingly slow at receiving the data.
Anyone any ideas please as to what's wrong?

Quote

Please show us some code. :)

--
Deborah Pate (TeamB) http://delphi-jedi.org

  TeamB don't see posts sent via Google or ISPs
  Use the real Borland server: newsgroups.borland.com
  http://www.borland.com/newsgroups/genl_faqs.html

Re:D6 -> Word XP/2002


Deborah - here are some of the snippets

//wordapp is a TWordApplication

with WordApp do

begin

connect;

visible := true; //used for debugging only!

//now work out how many pages this number of payvalues will need to print
out on

if (Counter mod 45) <> 0 then NoPages := (counter div 45) + 1

else NoPages := counter div 45; //45 is no of numeric fields on page

//now iterate through number of pages required

for ThisPage := 1 to NoPages do

begin

wd1.ConnectTo(documents.Add(MergeDoc,EmptyParam, EmptyParam, EmptyParam));

//at this stage I now start poking data through to the protected form-based
word document (MergeDoc held the name of a word template) //and use the
following routine that I've been using for years

//..........................................................................
............................................

procedure TMainform.Pokeit(ThisField : oleVariant; ThisValue : string);
begin

//this is responsible for poking ThisField with ThisValue

WordApp.ActiveDocument.FormFields.Item(ThisField).result := ThisValue; end;
//..........................................................................
............................................

I just don't know what's changed when the clients moved to Office XP that's
caused the massive difference in speed. I can sit there watching the fields
being filled in - perhaps one every second - on a 1.4Ghz PC with 512Mb

Hope this helps as I have used this technique in many of my apps.

Cheers

David

"Deborah Pate (TeamB)" <d.p...@blueyonder.co.not-this-bit.uk> wrote in
message news:VA.00001883.0013d878@blueyonder.co.not-this-bit.uk...

Quote
> <<David Smith:
> I've modified it to see the Word document as data is poked
> into it and it's amazingly slow at receiving the data.
> Anyone any ideas please as to what's wrong?

> Please show us some code. :)

> --
> Deborah Pate (TeamB) http://delphi-jedi.org

>   TeamB don't see posts sent via Google or ISPs
>   Use the real Borland server: newsgroups.borland.com
>   http://www.borland.com/newsgroups/genl_faqs.html

Other Threads