P
Piet Linden
I am creating nested Word tables on the fly from ADO recordsets passed
from Access. That part works fine (Thanks for the tip, Doug!)
I am trying to automatically format the contents of the nested table
based on the field type of the data that I'm stuffing into them.
(basically, based on whether they're Text or Numeric). Basically, so
I can right-align the numeric data and left align all the text data...
Can I do this in Word, or would I need to grab field types from my
recordset that it's generating the data? If I can do it in Word,
would anybody have a code snippet?
The basic idea is to loop over the rows of a table and format them all
at once. Something (sort of )
like this:
' loop through the columns of the table
for lngColumn=1 to docNestedTable.Columns.count
if IsNumeric(rst.Fields(intCounter)) Then
' loop through the rows of the table, skipping the first one (because
it's a header row)
for lngRow = 2 to docNestedTable.Rows.Count
docNestedTable.Cells(lngRow,
lngColumn).ParagraphAlignment=wdParagraphAlignLeft
next lngRow
next lngColumn
thanks
Pieter
from Access. That part works fine (Thanks for the tip, Doug!)
I am trying to automatically format the contents of the nested table
based on the field type of the data that I'm stuffing into them.
(basically, based on whether they're Text or Numeric). Basically, so
I can right-align the numeric data and left align all the text data...
Can I do this in Word, or would I need to grab field types from my
recordset that it's generating the data? If I can do it in Word,
would anybody have a code snippet?
The basic idea is to loop over the rows of a table and format them all
at once. Something (sort of )
like this:
' loop through the columns of the table
for lngColumn=1 to docNestedTable.Columns.count
if IsNumeric(rst.Fields(intCounter)) Then
' loop through the rows of the table, skipping the first one (because
it's a header row)
for lngRow = 2 to docNestedTable.Rows.Count
docNestedTable.Cells(lngRow,
lngColumn).ParagraphAlignment=wdParagraphAlignLeft
next lngRow
next lngColumn
thanks
Pieter