We help IT Professionals succeed at work.
Get Started

Remove Word formatting

424 Views
Last Modified: 2012-06-21
I have an ASP form that users fill out.  Everthing is saved properly into a SQL Server 2005 database.

If somebody copies and pastes information from a Word document, when I display the page - all the formatting is off.  

Sentences are broken off in the middle of the sentence and taken to the next line, no line break when one is needed between paragraphs etc...

Is there a way to strip out all the stuff Microsoft Word documents contain.  Here is an example of the stuff I want to have removed:


<P style="LINE-HEIGHT: normal; MARGIN: 0in 0in 10pt" class=MsoNormal><SPAN style="FONT-FAMILY: 'Arial','sans-serif'; FONT-SIZE: 12pt"><?xml:namespace prefix = o ns = "urn:schemas-microsoft-com:office:office" /><o:p></o:p></SPAN></P>
<P style="LINE-HEIGHT: normal; MARGIN: 0in 0in 0pt; mso-layout-grid-align: none" class=MsoNormal><SPAN style="FONT-FAMILY: 'Arial','sans-serif'; COLOR: #333333; FONT-SIZE: 10pt">READING the news recently reminded me of a sentence we repeatedly typed in my junior high </SPAN><SPAN style="FONT-FAMILY: 'Arial','sans-serif'; COLOR: #333333; FONT-SIZE: 10pt">school typing course:&nbsp; "Now is the time for all good men to come to the aid of their country."&nbsp; <BR></SPAN><SPAN style="FONT-FAMILY: 'Arial','sans-serif'; COLOR: #333333; FONT-SIZE: 10pt"><BR>A modified version of that familiar sentence is an appropriate rallying call for all...

With this removed, I can create my page in ASP and place the actual text between <p></p>

The end result I want is just to have the text:

READING the news recently reminded me of a sentence we repeatedly typed in my junior high school typing course: "Now is the time for all good men to come to the aid of their country.  A modified version of that familiar sentence is an appropriate rallying call for all...

How can this be accomplished?

Thanks in advance for your help!
Comment
Watch Question
Top Expert 2010
Commented:
This problem has been solved!
Unlock 1 Answer and 3 Comments.
See Answer
Why Experts Exchange?

Experts Exchange always has the answer, or at the least points me in the correct direction! It is like having another employee that is extremely experienced.

Jim Murphy
Programmer at Smart IT Solutions

When asked, what has been your best career decision?

Deciding to stick with EE.

Mohamed Asif
Technical Department Head

Being involved with EE helped me to grow personally and professionally.

Carl Webster
CTP, Sr Infrastructure Consultant
Ask ANY Question

Connect with Certified Experts to gain insight and support on specific technology challenges including:

  • Troubleshooting
  • Research
  • Professional Opinions
Did You Know?

We've partnered with two important charities to provide clean water and computer science education to those who need it most. READ MORE