Word automation version problem.

Collapse
This topic is closed.
X
X
 
  • Time
  • Show
Clear All
new posts
  • JensB

    #1

    Word automation version problem.

    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



  • vbnetdev

    #2
    Re: Word automation version problem.

    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




    "JensB" <JensB@newsgrou p.nospam> wrote in message
    news:O3rvqAYfGH A.3888@TK2MSFTN GP04.phx.gbl...[color=blue]
    >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
    >
    >
    >[/color]


    Comment

    • JensB

      #3
      Re: Word automation version problem.


      "vbnetdev" <vbnetdev@commu nity.nospam> wrote in message
      news:ew8K9zYfGH A.4276@TK2MSFTN GP03.phx.gbl...[color=blue]
      > 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.
      >[/color]

      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.Len gth() - 85
      doc(i - 85) = bytBLOBData(i)
      Next

      Dim file As New FileStream(Syst em.Windows.Form s.Application.S tartupPath &
      "\hcn.doc", FileMode.Create )
      Dim strm As New MemoryStream(do c)
      strm.WriteTo(fi le)
      file.Flush()
      file.Close()
      file = Nothing
      If wrdTMP Is Nothing Then wrdTMP = New Word.Applicatio n
      document = Nothing
      document =
      wrdTMP.Document s.Open(System.W indows.Forms.Ap plication.Start upPath &
      "\hcn.doc", , False)
      document.Applic ation.Selection .WholeStory()
      document.Applic ation.Selection .Copy()
      wrdTMP.ActiveDo cument.Close()
      '************** *************** *************** *************** *************** *************** *************** **
      GC.WaitForPendi ngFinalizers()
      GC.Collect()
      WRD.Activate()
      '************** *************** ***************
      'INSERT OLE OBJECT in main document
      ..Application.W ordBasic.EditPa ste()
      ..Selection.Doc ument.Fields.Up date()

      Regards
      Jens


      Comment

      • vbnetdev

        #4
        Re: Word automation version problem.

        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




        "JensB" <JensB@newsgrou p.nospam> wrote in message
        news:ujBToRZfGH A.4776@TK2MSFTN GP05.phx.gbl...[color=blue]
        >
        > "vbnetdev" <vbnetdev@commu nity.nospam> wrote in message
        > news:ew8K9zYfGH A.4276@TK2MSFTN GP03.phx.gbl...[color=green]
        >> 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.
        >>[/color]
        >
        > 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.Len gth() - 85
        > doc(i - 85) = bytBLOBData(i)
        > Next
        >
        > Dim file As New FileStream(Syst em.Windows.Form s.Application.S tartupPath &
        > "\hcn.doc", FileMode.Create )
        > Dim strm As New MemoryStream(do c)
        > strm.WriteTo(fi le)
        > file.Flush()
        > file.Close()
        > file = Nothing
        > If wrdTMP Is Nothing Then wrdTMP = New Word.Applicatio n
        > document = Nothing
        > document =
        > wrdTMP.Document s.Open(System.W indows.Forms.Ap plication.Start upPath &
        > "\hcn.doc", , False)
        > document.Applic ation.Selection .WholeStory()
        > document.Applic ation.Selection .Copy()
        > wrdTMP.ActiveDo cument.Close()
        > '************** *************** *************** *************** *************** *************** *************** **
        > GC.WaitForPendi ngFinalizers()
        > GC.Collect()
        > WRD.Activate()
        > '************** *************** ***************
        > 'INSERT OLE OBJECT in main document
        > .Application.Wo rdBasic.EditPas te()
        > .Selection.Docu ment.Fields.Upd ate()
        >
        > Regards
        > Jens
        >[/color]


        Comment

        • JensB

          #5
          Re: Word automation version problem.


          "vbnetdev" <vbnetdev@commu nity.nospam> wrote in message
          news:uPvoh0qfGH A.3468@TK2MSFTN GP03.phx.gbl...[color=blue]
          > can you tyr using simple tables instead of these objects and writing the
          > dataset to it?[/color]

          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


          Comment

          Working...