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
614 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
 
LVL 3

Author Comment

by:john M
ID: 35142106
Please read the document attacted
thanks
ee1.docx
0
Find Ransomware Secrets With All-Source Analysis

Ransomware has become a major concern for organizations; its prevalence has grown due to past successes achieved by threat actors. While each ransomware variant is different, we’ve seen some common tactics and trends used among the authors of the malware.

 
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

Maximize Your Threat Intelligence Reporting

Reporting is one of the most important and least talked about aspects of a world-class threat intelligence program. Here’s how to do it right.

Join & Write a Comment

A few years ago I was very much a beginner at VBA, and that very much remains the case today.  I'll do my best to explain things as I go in the hope that other beginners can follow.  If you just want to check out a tool that creates a Select Case fu…
Calculating holidays and working days is a function that is often needed yet it is not one found within the Framework. This article presents one approach to building a working-day calculator for use in .NET.
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…
This Experts Exchange video Micro Tutorial shows how to tell Microsoft Office that a word is NOT spelled correctly. Microsoft Office has a built-in, main dictionary that is shared by Office apps, including Excel, Outlook, PowerPoint, and Word. When …

747 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

13 Experts available now in Live!

Get 1:1 Help Now