Word automation version problem.

J

JensB

I have VB.Net VS2005 App which creates MS Word documents. Clients are using
Word 2000 and Word2003.
Project refers to MS Word 9.0 Object library, declaring Word as an object.
On the Word 2000 machines this works fast and nice, but on the Word 2003
machines it takes 5-10 times longer.
Is there a way to make Word 2003 clients to work faster?

Recently a warning message, showed up in the error list:
"There are updated custom wrappers available for the following referenced
components: Office ,VBIDE. "

A search on this message did not result in any hit that could explain what
to do?

Regards
Jens
 
V

vbnetdev

This will always appear as long as you are using an older library.

My experience was the same as you on Word 2003 automation vs older versions.

Are you writing a dataset? If so, how much data and are you writing it cell
by cell? seeing your code would help a lot to determine if there are
improvements that can be made.
 
J

JensB

vbnetdev said:
This will always appear as long as you are using an older library.

My experience was the same as you on Word 2003 automation vs older
versions.

Are you writing a dataset? If so, how much data and are you writing it
cell by cell? seeing your code would help a lot to determine if there are
improvements that can be made.

The database contain some colums with Word documents stored as OLE objects.
(BLOBS)
I am then filling a dataset/dataview
I am streaming the BLOB to a temperary Word document, from where copy/paste
it to the main document

This is the part of the code doing the job and which is the slow part:
( i have tested an unnumbered ways to this in order to speed up WORD 2003,
but most of the time, the price is unstable performance)
This code works every time, but is slow, due to fact a new tmp doc is
created for each record.
A typical document contain about 20-30 records BLOBS + other stuff (Plain
text)

bytBLOBData = dvItem.Item(0).Row(Language)
'Begin after WORD Signature = 85 byte
Dim doc(bytBLOBData.Length() - 85) As Byte
For i = 85 To bytBLOBData.Length() - 85
doc(i - 85) = bytBLOBData(i)
Next

Dim file As New FileStream(System.Windows.Forms.Application.StartupPath &
"\hcn.doc", FileMode.Create)
Dim strm As New MemoryStream(doc)
strm.WriteTo(file)
file.Flush()
file.Close()
file = Nothing
If wrdTMP Is Nothing Then wrdTMP = New Word.Application
document = Nothing
document =
wrdTMP.Documents.Open(System.Windows.Forms.Application.StartupPath &
"\hcn.doc", , False)
document.Application.Selection.WholeStory()
document.Application.Selection.Copy()
wrdTMP.ActiveDocument.Close()
'**********************************************************************************************************
GC.WaitForPendingFinalizers()
GC.Collect()
WRD.Activate()
'********************************************
'INSERT OLE OBJECT in main document
..Application.WordBasic.EditPaste()
..Selection.Document.Fields.Update()

Regards
Jens
 
V

vbnetdev

can you tyr using simple tables instead of these objects and writing the
dataset to it?
 
J

JensB

vbnetdev said:
can you tyr using simple tables instead of these objects and writing the
dataset to it?

In the real world, my customer have build up about 6000 documents during the
years, containing all the information he wants to give his customers.
If I try to convinst him to use simple tables or other solutions make it it
easy for the programmer, I believe there would no need for a programmer.
Jens
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Top