Tables storing results of Stored Procedure

E

Edward Li

Dear all,

(I have posted this question to "Word Tables" discussion group before. I try
to post here again to see if somebody can help)

I need to populate the result of a stored procedure from SQL Server into a
Word 2000 document and present the result as a table. The result of the
stored procedure can be up to thouands of rows, which construct a table of
over hundreds of pages.

I use ADO to run the stored procedure and populate the result as a delimited
text Then I use ConvertToTable to create the table from the delimited text.
This works fine. However, I need to apply differet format to each columns of
the table (alignment, fonts...etc.). Since, in Word 2000, Table object does
not support the Style property, it takes long time to apply each style
separately. Is there a more efficient way?

The result of the stored procedure contains carriage return. Therefore I
need to convert the carriage return to another character before running
ConvertToTable and then use Find.Execute to replace them back to carriage
return afterwards. Is there a more efficient way?

Another question is that will it be faster if I use Database Fields instead
of using ADO to get the result?

Thank you very much.

Edward Li
 
C

Cindy Meister

Hi Edward

Creating large Word tables is inherently slow. About the only thing you
haven't mentioned is inserting the table with default Word97 behavior, in
order to avoid the overhead of Word defining the column spacings dynamically,
based on the cell content. This would definitely have a positive impact, if
you're not using it already.

A Database field could be faster, but you'd have to test. No guarantees. You
do need to keep in mind, however, that to be compatible back to Word 2000
you'd need to use an ODBC connection, with a DSN, to the Stored Proc. Word
2000 does not support OLE DB.

-- Cindy
 
E

Edward Li

Hi Cindy

Thank you for your comment.
I've already used Word97 behavior although I didn't mention it.
I think the performance of creating the table is acceptable. However, it
takes much longer when I apply the formatting to each columns (e.g. I need to
wait for about two minutes to right-align a single column)
What I want to know is whether there is a way to apply all formats to a
column in one statement (with the absence of Style property in Table object
in Word 2000). Or even better, to create the table with all columns in my
desired formatted.
Thanks.

Edward
 
C

Cindy Meister

Hi Edward

Even though Word 2000 doesn't support Table styles, it does support regular
styles. You can group all font and paragraph formatting into regular styles.

Other than that, the only thing available to you would be one of Word's
internal table AutoFormats (see the list in the Table/AutoFormat dialog box).
These are basically the same as table styles, the difference being, you can't
change the definition. But you can choose what formatting is applied (i.e.
left column, right column, top row, bottom row, shading, borders, etc).

-- Cindy
 

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