Home | Contact Us | FAQ | Search & Site Map | Link to Us
Sign In | Join | Other 45 Sites in Network
Home
DiscussionsAccessExcelInfoPathOutlookPowerPointPublisherWord
DirectoryUser Groups
Related Topics
Outlook ExpressInternet ExplorerWindowsMS Server ProductsMore Topics ...

MS Office Forum / Word / Programming / March 2004

Tip: Looking for answers? Try searching our database.

Optimization question

Thread view: 
Enable EMail Alerts  Start New Thread
Thread rating: 
avarghese - 30 Mar 2004 19:11 GMT
I have a Word application that does the following to retrieve data from the database
 1) Run a JSP page that queries data from the database and formats the output into an HTML table/XML documen
 2) The output is copied and pasted into open word document as output.

My question is, is it more optimum to use this method of querying using JSP page or is it better to use ADO from Word itself to query the data? Also, is it better to do the formatting in JSP or in Word? In JSP, I format the data and it is sent back to Word as an HTML table. Then it is just copied and pasted onto the Word document. So, in Word, it becomes a Word table instead of HTML table. Actually my application generates about 20 different Word tables like this and puts in the word document. What I want to know is

 a) Is ADO faster than a JSP query
 b) Is it faster to copy output from a HTML page and paste it onto Word? Does Word do any re-formatting to the document once it is copied?

Thank
Alex
Leigh Webber - 31 Mar 2004 20:29 GMT
JSP is going to have to get at the database via ADO or some such technology.
In effect, the JSP is just adding another layer of code between the database
and your end result. Why not cut out the middleman, and do it from inside a
Word macro instead?

Pasting an HTML table in Word is a but ugly, because Word preserves all
sorts of features used in HTML tables that are not needed in a Word table.
Frankly, I think it would be faster (and I know it would be much cleaner) to
do something like:

(instantiate an ADO recordset called loMyRecordset and populate it)

Set loTable = ActiveDocument.Tables(1)
with loMyRecordset
   while not .eof
      loTable.Rows.Add
      With loTable.Rows(loTable.Rows.Count)
           .Cells(1).Range.Text = loMyRecordset.Fields("OneField").Value
           .Cells(2).Range.Text =
loMyRecordset.Fields("AnotherField").Value
           .Cells(3).Range.Text =
loMyRecordset.Fields("YetAnotherField").Value
       ...

       End With
       .movenext
   wend
end with

> I have a Word application that does the following to retrieve data from the database:
>   1) Run a JSP page that queries data from the database and formats the output into an HTML table/XML document
>   2) The output is copied and pasted into open word document as output.
>
> My question is, is it more optimum to use this method of querying using JSP page or is it better to use ADO from Word itself to query the data?
Also, is it better to do the formatting in JSP or in Word? In JSP, I format
the data and it is sent back to Word as an HTML table. Then it is just
copied and pasted onto the Word document. So, in Word, it becomes a Word
table instead of HTML table. Actually my application generates about 20
different Word tables like this and puts in the word document. What I want
to know is:

>   a) Is ADO faster than a JSP query?
>   b) Is it faster to copy output from a HTML page and paste it onto Word? Does Word do any re-formatting to the document once it is copied?
>
> Thanks
> Alex
 
Sign In
Join
My Latest Posts
My Monitored Threads
My Blog
My Photo Gallery
My Profile
My Homepage

Start New Thread
Enable EMail Alerts
Rate this Thread



©2008 Advenet LLC   Privacy Policy - Terms of Use
This website includes both content owned or controlled by Advenet as well as content owned or controlled by third parties.