Home All Groups Group Topic Archive Search About

Word automation version problem.

Author
22 May 2006 9:21 AM
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

Author
22 May 2006 10:46 AM
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.

--
Get a powerful web, database, application, and email hosting with KJM
Solutions
http://www.kjmsolutions.com



Show quoteHide quote
"JensB" <JensB@newsgroup.nospam> wrote in message
news:O3rvqAYfGHA.3888@TK2MSFTNGP04.phx.gbl...
>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
>
>
>
Author
22 May 2006 11:45 AM
JensB
"vbnetdev" <vbnetdev@community.nospam> wrote in message
news:ew8K9zYfGHA.4276@TK2MSFTNGP03.phx.gbl...
> 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
Author
23 May 2006 9:09 PM
vbnetdev
can you tyr using simple tables instead of these objects and writing the
dataset to it?

--
Get a powerful web, database, application, and email hosting with KJM
Solutions
http://www.kjmsolutions.com



Show quoteHide quote
"JensB" <JensB@newsgroup.nospam> wrote in message
news:ujBToRZfGHA.4776@TK2MSFTNGP05.phx.gbl...
>
> "vbnetdev" <vbnetdev@community.nospam> wrote in message
> news:ew8K9zYfGHA.4276@TK2MSFTNGP03.phx.gbl...
>> 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
>
Author
26 May 2006 8:15 PM
JensB
"vbnetdev" <vbnetdev@community.nospam> wrote in message
news:uPvoh0qfGHA.3468@TK2MSFTNGP03.phx.gbl...
> 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