how to trim extra spaces in RTF box in vb.while trasfering to word document.

What means "transfering to Word"?

If you read each line separetely, and then put each line in a Word window, use TRIM function for each line you read.

If you put entire text from textbox in a Word document, maybe you need to proccess the text in VB before sending it, but the same case: to delete extra spaces from each line, uses TRIM function. The variation RTRIM deletes spaces only from the right, and LTRIM, only from the left.

If you need to delete spaces that are in middle of your line (between two words, for example), you'll need to use Replace function combined with a While statement.


Sidnei

Be a part of the DaniWeb community

We're a friendly, industry-focused community of developers, IT pros, digital marketers, and technology enthusiasts meeting, networking, learning, and sharing knowledge.