"vbnetdev" <vb******@community.nospam> wrote in message
news:ew**************@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.Startu pPath &
"\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.Applica tion.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