Removing redundant new line

Hi all,

think i show the code first.

If doc.sectionnum(0) = “1” Then

'set the style and create a rich text item

Set richStyle = session.CreateRichTextStyle

Set rtitem = docFiling.CreateRichTextItem(“FillTextHere”)

rtpStyle.leftMargin = RULER_ONE_CENTIMETER*0

Call rtitem.AppendParagraphStyle(rtpStyle)

'change the words to bold and append the style

'----------insert section ----------------

richStyle.Bold =True

Call rtitem.AppendStyle(richStyle)

Call rtitem.AppendText(section)

'------------------------insert title —

rtpStyle.leftMargin = RULER_ONE_CENTIMETER*3.7

Call rtitem.AppendParagraphStyle(rtpStyle)

Call rtitem.AddTab(1) '1 tab after section number

Call rtitem.AppendText(title)

'add new line

'------reset back to the original margin-----

Call rtitem.AddNewLine(1,True)

rtpStyle.leftMargin = RULER_ONE_CENTIMETER*0

Call rtitem.AppendParagraphStyle(rtpStyle)

richStyle.Bold=False

'append the body

'----------setting the alignment ------

Call rtitem.AppendStyle(richStyle)

Call rtitem.AddTab(1)

'-----------------end -------------------

Call rtitem.AppendText(body)

Now based on tat code above i intend to copy from the section number, title and body of a document to another document.

All went fine until i am required to consider a case where the title is of 2 or more lines worth of text. At present i am able to do this

  1. title

—body

however the 2 lines title make my overall document into:

  1. title

second line title

----body

i used the notes paragraph style but end up in this manner:

-----title

-----second line title

-----body

Any better suggestions? Maybe is there a method for removing the extra line such that i can align the section number and title to the same level??

Or is there anyway i can check out if the section has reached a new line? Because in that case i can append tab to the richtext on every new line

Sorry if the question sound stupid. Many thanx in advance

Best Regards,

Hengshi