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
621 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
[X]
Welcome to Experts Exchange

Add your voice to the tech community where 5M+ people just like you are talking about what matters.

  • Help others & share knowledge
  • Earn cash & points
  • Learn & ask questions
  • 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
MS Dynamics Made Instantly Simpler

Make Your Microsoft Dynamics Investment Count  & Drastically Decrease Training Time by Providing Intuitive Step-By-Step WalkThru Tutorials.

 
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

Guide to Performance: Optimization & Monitoring

Nowadays, monitoring is a mixture of tools, systems, and codes—making it a very complex process. And with this complexity, comes variables for failure. Get DZone’s new Guide to Performance to learn how to proactively find these variables and solve them before a disruption occurs.

Question has a verified solution.

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

It was really hard time for me to get the understanding of Delegates in C#. I went through many websites and articles but I found them very clumsy. After going through those sites, I noted down the points in a easy way so here I am sharing that unde…
Real-time is more about the business, not the technology. In day-to-day life, to make real-time decisions like buying or investing, business needs the latest information(e.g. Gold Rate/Stock Rate). Unlike traditional days, you need not wait for a fe…
The viewer will learn how to make their project stand out over others by learning how to change colors and shapes, add spaces, change directions, and add bullets to their charts.
In a previous video Micro Tutorial here at Experts Exchange (http://www.experts-exchange.com/videos/1358/How-to-get-a-free-trial-of-Office-365-with-the-Office-2016-desktop-applications.html), I explained how to get a free, one-month trial of Office …

751 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