Xojo Conferences
MBSOct2019CologneDE

Slow Office Automation (Real Studio network user group Mailinglist archive)

Back to the thread list
Previous thread: Re: Pigmy 2.0
Next thread: [ANNOUNCE] Drop Script Backgrounder for mac OS X


Re: Pigmy 2.0   -   Jan Erik Moström <
  Slow Office Automation   -   Jim Meyer
   Re: Slow Office Automation   -   Alex Rice

Slow Office Automation
Date: 29.05.02 20:01 (Wed, 29 May 2002 15:01:16 -0400)
From: Jim Meyer
Hi all....

I have a Word Office Automation project that is running very slow....

In short I have to extract the text from a Word doc and write it back to a
new text file but I must include some basic character style info (bold,
italics) which is written out to the same file in an ASCII markup language.

To get the character text and style I set a Word Range to each character one
at a time..... which is what appears to be taking so long...

I ran the code below (which does not nothing but set the range to each
character) on a Word doc that was around 1000 characters long... it took
over 3 minutes.

Does anyone have any ideas on how to speed this up?
Is OA generally slow?

Thanks,
Jim


Dim word as wordApplication
Dim doc as worddocument
dim wr as wordrange

dim f as folderItem

dim i as integer
dim cnt as integer

f = getopenFolderItem("worddoc")
if f <> nil then

word = new wordApplication
doc = new worddocument

doc = word.documents.open(f.absolutePath)
cnt = doc.characters.count

for i = 0 to cnt - 1
wr = doc.range(i,i+1)
next

end if


---
Subscribe to the digest:
<mailto:<email address removed>>
Unsubscribe:
<mailto:<email address removed>>

Re: Slow Office Automation
Date: 31.05.02 21:30 (Fri, 31 May 2002 14:30:13 -0600)
From: Alex Rice

On Wednesday, May 29, 2002, at 01:01 PM, Jim Meyer wrote:
>
> Does anyone have any ideas on how to speed this up?
> Is OA generally slow?

Sorry, no ideas for speeding up that code.

I do applaud real software for adding a useful feature to RB like MS
office automation. However I think yes, it's quite slow.

I was experiencing the slowness as well as a lot of crashes with my app.
I ripped out all the RB office automation stuff and those troubles were
solved.

Based on my limited experience, I am wildly guessing that the RB office
automation is about 10 times slower than VBA code running directly in
Office. For some context, I am also wildly guessing also that the
PythonWin COM bindings are 2-3 times slower than than equivalent VBA
code. I could be curious how Visual Basic COM or C++ COM stacks up
speed-wise for office-automation stuff, compared to RB's office
automation.

I am still using office automation, but not from RB. The workaround I
was able to do is this:

o RB app copies Excel template file into place.
o RB app writes out a data file in the same directory.
o RB app launches the Excel file.
o The Excel file has VBA macros that run when the workbook loads. They
slurp all the data from the data file and insert into appropriate places
in the spreadsheet, doing formatting etc.

Now if I could only figure out why Office X for Mac doesn't have the
same VBA string functions as the Windows version of office. Mutter
mutter. :-/

Alex Rice, Software Developer
Architectural Research Consultants, Inc.
<email address removed>
<email address removed>


---
Subscribe to the digest:
<mailto:<email address removed>>
Unsubscribe:
<mailto:<email address removed>>