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
617 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
Master Your Team's Linux and Cloud Stack!

The average business loses $13.5M per year to ineffective training (per 1,000 employees). Keep ahead of the competition and combine in-person quality with online cost and flexibility by training with Linux Academy.

 
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

3 Use Cases for Connected Systems

Our Dev teams are like yours. They’re continually cranking out code for new features/bugs fixes, testing, deploying, testing some more, responding to production monitoring events and more. It’s complex. So, we thought you’d like to see what’s working for us.

Question has a verified solution.

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

Suggested Solutions

Today I had a very interesting conundrum that had to get solved quickly. Needless to say, it wasn't resolved quickly because when we needed it we were very rushed, but as soon as the conference call was over and I took a step back I saw the correct …
A long time ago (May 2011), I have written an article showing you how to create a DLL using Visual Studio 2005 to be hosted in SQL Server 2005. That was valid at that time and it is still valid if you are still using these versions. You can still re…
In this video, we show how to convert an image-only PDF file into a PDF Searchable Image file, that is, a file with both the image (typically from scanning) and text, which is created in an automated fashion with Optical Character Recognition (OCR) …
Office 365 is currently available in five editions. Three of them are for business use: Office 365 Business Essentials, Office 365 Business, and Office 365 Business Premium. Two of them are for home/personal use: Office 365 Home and Office 365 Perso…

816 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

Need Help in Real-Time?

Connect with top rated Experts

7 Experts available now in Live!

Get 1:1 Help Now