Reply
 
Thread Tools Display Modes
  #1   Report Post  
BethB
 
Posts: n/a
Default Formatting and column width problems

I am creating a table from a database. I must create each row and populate as
each record is read since for some records I only need 2 columns and some I
need 3. I accomplis this through setting the column width of column 2 as 425
with the ruler style to Adust Proportional.
Additionally, I need column 1 as bold and records that are section headers
get an Arial Bold font and cell shading.

The problem is that if I only write 1 row, the formatting works fine, but
when I read in the entire database, the formatting goes away when the next
row is written.

I am wondering if it is a range problem.

After I create a new row, I collapse my range before writing to the contents
of the 3 cells.
But if I dont collapse, my next row is written to cell 1 and so on.

Here is the code that writes the table

If GroupPrint = "Yes" Then
Set brng = ActiveDocument.Range
brng.Collapse wdCollapseEnd

ActiveDocument.Tables.Add Range:=brng, NumRows:=1, NumColumns:=3

With ActiveDocument.Tables.Item(1)
.Borders.Enable = True
.Range.Font.Name = "Times New Roman"
.Shading.Texture = wdTextureNone
.Range.Font.Size = "12"
.Range.ParagraphFormat.Alignment =
Word.WdParagraphAlignment.wdAlignParagraphLeft

If PrintData(1) "" Then
'Prints Section Heading
With .Cell(Row:=lrows, Column:=1)
.Range.Text = PrintData(1)
.SetWidth ColumnWidth:=500, RulerStyle:=wdAdjustProportional
.Shading.Texture = wdTexture90Percent
.Range.Font.Color = wdColorWhite
End With
With .Cell(Row:=lrows, Column:=2)
.Shading.Texture = wdTexture90Percent
End With
With .Cell(Row:=lrows, Column:=3)
.Shading.Texture = wdTexture90Percent
End With
Else
If PrintData(3) "" Then
'Prints row XP
With .Cell(Row:=lrows, Column:=1)
.Range.Text = PrintData(2)
.Range.Font.Name = "Times New Roman Bold"
End With
With .Cell(Row:=lrows, Column:=2)
.Range.Text = PrintData(3)
.SetWidth ColumnWidth:=425, RulerStyle:=wdAdjustProportional
.Borders(wdBorderRight).Visible = False
End With
With .Cell(Row:=lrows, Column:=3)
.Borders(wdBorderLeft).Visible = False
End With
Else
If PrintData(5) = "" Then
'Prints row IN with no O
With .Cell(Row:=lrows, Column:=1)
.Range.Text = PrintData(2)
.Range.Font.Name = "Times New Roman Bold"
End With
With .Cell(Row:=lrows, Column:=2)
.Range.Text = PrintData(4)
.SetWidth ColumnWidth:=425,
RulerStyle:=wdAdjustProportional
.Borders(wdBorderRight).Visible = False
End With
With .Cell(Row:=lrows, Column:=3)
.Borders(wdBorderLeft).Visible = False
End With
Else
'Prints row IN with O
With .Cell(Row:=lrows, Column:=1)
.Range.Text = PrintData(2)
.Range.Font.Name = "Times New Roman Bold"
End With
With .Cell(Row:=lrows, Column:=2)
.Range.Text = PrintData(4)
End With
With .Cell(Row:=lrows, Column:=3)
.Range.Text = PrintData(5)
End With
End If
End If
End If
lrows = lrows + 1
End With

End If


Thanks in advance for any help anyone can give me


Reply
Thread Tools
Display Modes

Posting Rules

Smilies are On
[IMG] code is On
HTML code is Off

Forum Jump

Similar Threads
Thread Thread Starter Forum Replies Last Post
Table width behavior Al G. Tables 5 October 27th 05 12:08 PM
Changing column width in copied text Dave Microsoft Word Help 4 August 16th 05 04:29 AM
How to copy/paste column formatting between rows Robert Tables 4 July 5th 05 08:19 PM
table column width problems Dena Tables 2 March 8th 05 04:51 AM
Table column formatting DAS Tables 1 December 3rd 04 05:41 PM


All times are GMT +1. The time now is 01:55 PM.

Copyright ©2000 - 2024, Jelsoft Enterprises Ltd.
Copyright ©2004-2024 Microsoft Office Word Forum - WordBanter.
The comments are property of their posters.
 

About Us

"It's about Microsoft Word"