Solved

Removing leading spaces /tabs from text removed from a word document and put into a rich  textbox on a form

Posted on 2011-03-14
9
618 Views
Last Modified: 2012-05-11
we have vb net 2008 crystal report 11 sql 2005
I am having a user put text into a rich text box on a form /cut and paste
I am taking that text and saving it to a table and printing it out on a letter in crystal reports.
My problem some of the code pasted in has a few tab fields or spaces between the beginning and the first letter.
I want to remove leading spaces or tabs.  Does anyone know now to identify them and removed them within a form.

This text
This had spaces leading the text.

                            You did not sign your application. As stated in the current application packet, the application “[m]ust be signed and dated or the application will be returned as incomplete.”
Is rtf is
{\rtf1\ansi\ansicpg1252\deff0{\fonttbl{\f0\fswiss\fprq2\fcharset0 CG Omega;}{\f1\fnil\fcharset0 Microsoft Sans Serif;}}
\viewkind4\uc1\pard\li720\lang1033\f0\fs22 You did not sign your application. As stated in the current application packet, the application \ldblquote [m]ust be signed and dated or the application will be returned as incomplete.\rdblquote\par
\pard\f1\fs17\par



Regular text no leading spaces or tabs



You provided an Employer Work Experience Statement that does not include the name of the candidate. As stated in the current application packet, “[t]his form must be completed and included in the application by at least one of your current/former dentists.”

rtf
{\rtf1\ansi\ansicpg1252\deff0\deflang1033{\fonttbl{\f0\fswiss\fprq2\fcharset0 CG Omega;}{\f1\fnil\fcharset0 Microsoft Sans Serif;}}
{\colortbl ;\red0\green0\blue0;}
\viewkind4\uc1\pard\f0\fs22 You provided an \i Employer Work Experience Statement \i0 that does not include the name of the candidate. As stated in the current application packet, \ldblquote\cf1\fs16 [t]his form \ul must \ulnone be completed and included in the application by at least one of your current/former dentists.\rdblquote\cf0\fs22\par
\f1\fs17\par
}

0
Comment
Question by:john M
  • 4
  • 2
  • 2
9 Comments
 
LVL 41

Assisted Solution

by:graye
graye earned 250 total points
ID: 35132731
There's a good VB6 example at this website:  http://bytes.com/topic/visual-basic-net/answers/387438-white-space-string

You can accomplish the same kind of thing with VB.Net using the String.Trim method
http://msdn.microsoft.com/en-us/library/t97s7bs3.aspx
0
 
LVL 3

Author Comment

by:john M
ID: 35140683
trim did not work - i don't think they are white spaces. It is more like the identing word does itself.
when you start typeing with the old word you saw a ruler up on top.

Thanks
0
 
LVL 41

Expert Comment

by:graye
ID: 35141520
Wow... you lost me on that last comment.

So, if you still need to remove "white space" (to include space, tab, line feed, carriage return) from a string, the Trim() method will indeed to that.  The VB6 example above shows specifically how.  I didn't include a link to the VB.Net version of String.Trim, since it operatates almost the same way.

On the other hand, if I completely missed the point (and it's certainly looking that way), then tell us again what the question is.
0
The New “Normal” in Modern Enterprise Operations

DevOps for the modern enterprise offers many benefits — increased agility, productivity, and more, but digital transformation isn’t easy, especially if you’re not addressing the right issues. Register for the webinar to dive into the “new normal” for enterprise modern ops.

 
LVL 3

Author Comment

by:john M
ID: 35142106
Please read the document attacted
thanks
ee1.docx
0
 
LVL 3

Author Comment

by:john M
ID: 35160279
Update

What i was wanted was in the rtf code that is in my table I was hoping to find out if there was a control for indenting. I did find thats if the when you indent the   \li123 is the control that shows that.
what i was hopeing was to find the best way not to let something be indented



{\rtf1\ansi\ansicpg1252\deff0{\fonttbl{\f0\fswiss\fprq2\fcharset0 CG Omega;}{\f1\fnil\fcharset0 Microsoft Sans Serif;}}
\viewkind4\uc1\pard\li000\lang1033\f0\fs22 You did not sign your application. As stated in the current application packet, the application \ldblquote [m]ust be signed and dated or the application will be returned as incomplete.\rdblquote\par
\pard\f1\fs17\par
}
0
 
LVL 45

Accepted Solution

by:
aikimark earned 250 total points
ID: 35161014
you have correctly identified the RTF tag.  \li### is the left indent tag.

there is also a first line (of the paragraph) indent and a right indent

http://www.biblioscape.com/rtf15_spec.htm

Back in the mid 90s, I chose RTF as the format of a document that my application created.  It wasn't easy, since Word, WordPad, and WordPerfect all implemented RTF a little differently.  The link also has a section for Word-specific RTF tags (\pn____).
0
 
LVL 3

Author Comment

by:john M
ID: 35166915
Aikimark

Is there a way to put  like word or another spell checker to spell check a rich text box?
0
 
LVL 45

Expert Comment

by:aikimark
ID: 35167286
There are third-party controls and at least one open-source spell checker.  If you want to use Word, you will need to use ActiveX automation (creating a Word.Automation object), inserting the raw text and then invoking Word's spell checker.  For performance sake, you would probably want to create the Word object only once for the program.

You might want to look at a VSTO implementation.
0

Featured Post

Free Tool: Site Down Detector

Helpful to verify reports of your own downtime, or to double check a downed website you are trying to access.

One of a set of tools we are providing to everyone as a way of saying thank you for being a part of the community.

Question has a verified solution.

If you are experiencing a similar issue, please ask a related question

The Selection object is designed for user interaction. It has a Range property, so it can be used in most places that a Range object can. Recorded macros must use the Selection because they are simply copying what the user is doing. A Range prope…
Using Word 2013, I was experiencing some incredible lag when typing.  Here's what worked for me....
This video shows where to find templates, what they are used for, and how to create and save a custom template using Microsoft Word.
Learn how to make your own table of contents in Microsoft Word using paragraph styles and the automatic table of contents tool. We'll be using the paragraph styles in Word’s Home toolbar to help you create a table of contents. Type out your initial …

830 members asked questions and received personalized solutions in the past 7 days.

Join the community of 500,000 technology professionals and ask your questions.

Join & Ask a Question