Hawkvalley1
asked on
Word table, inserting lines.
I am looping thru a rows of data and adding these lines of text to a table cell - full page width. When I see the doc the lines are there, but there are also 2 empty lines b/t each line of text. What do I need to set to keep these blank lines from showing up.
I am using this:
For Each event As XmlNode In xmlRep.SelectSingleNode("/ /Report"). ChildNodes
oDoc.Tables(1).Rows(3).Cel ls(1).Rang e.Text &= event.InnerText
Next
I am using this:
For Each event As XmlNode In xmlRep.SelectSingleNode("/
oDoc.Tables(1).Rows(3).Cel
Next
ASKER
That's the problem, there are no empty lines. That would have to easy. I believe it's a formatting problem.
Hi,
Have you tried removing control characters (e.g. carriage return and line feed)? This might be the cause of the problem.
You can try doing this
event.InnerText.Replace(vb crlf,"")
The only problem with the code above is that it will remove the crlf of the valid lines.
Maybe, you can also inspect the length of the inner text and check if only control characters are in it.
I hope this gives you some idea. :-)
Have you tried removing control characters (e.g. carriage return and line feed)? This might be the cause of the problem.
You can try doing this
event.InnerText.Replace(vb
The only problem with the code above is that it will remove the crlf of the valid lines.
Maybe, you can also inspect the length of the inner text and check if only control characters are in it.
I hope this gives you some idea. :-)
ASKER CERTIFIED SOLUTION
membership
This solution is only available to members.
To access this solution, you must be a member of Experts Exchange.
ASKER
I modified the Word template: Line Spacing = At Least, before and after set to 0 pts. The other thing is not to use a VBCRLF or Environment.Newline following each nodes innertext - somehow it returns to the next line with each loop anyway - strange behavior I think. Thanks Graham.
ASKER
Not sure why I didn't think of that. Sitting too close to the action I guess. Thanks again.
I am not exactly sure if I understand what you want but you can check the event.InnerText if it has actual data or it is an empty string.
And if it is an empty string then, ignore event.InnerText. This would avoid the having empty lines. I hope this helps.