hi i'm using MS Word2003 for my VB application which is a report. The word documents contains tables and the cells inside the table contain some fields. My application replaces the field values with Values from database.
The problem i was getting is if the text length that is replaced is more than the cell length, the text doesn't display rather "Display Text Cannot Span More Than One Line" is displayed.
I've two ideas for that.
1> if the text length that is to be replaced is more than the cell length, then it should make wordwrap i.e it should come into the next line without altering the original size of the table and column positions. OR
2> The cell to be AutoFit and each column value must come under the corresponding column name and the table is adjusted accordingly. But the original format of the table must retained.
To do this i used the following code , the cells values are now visible but they are not in proper position. That means one column value comes under another column name. So the total table format gets distorted.
Plz any one having any knowlegde regarding this plz help me. Below is my code. Also mention one thing when to set the property of the table, after replacing the field value or before.
- If (wrdFinApp.ActiveDocument.Tables.Count >= 1) Then
-
For liX = 1 To wrdFinApp.ActiveDocument.Tables.Count
-
With wrdFinApp.ActiveDocument.Tables(liX)
-
.AllowAutoFit = True
-
.Range.Cells(liY).WordWrap = True
-
.ApplyStyleFirstColumn = True
-
.ApplyStyleHeadingRows = False
-
.ApplyStyleLastColumn = False
-
.ApplyStyleLastRow = False
-
-
End With
-
Next liX
-
End If
Also i tried the wordwrap property of the cells but its not working. Thanking You