Tek-Tips is the largest IT community on the Internet today!

Members share and learn making Tek-Tips Forums the best source of peer-reviewed technical information on the Internet!

  • Congratulations Chriss Miller on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

Richtextbox

Status
Not open for further replies.

edelwater

Programmer
Jun 29, 2000
203
EU
Has anyone used the richtextbox control? I've got a weird problem, when i copy and paste text from Word i strip out most of the stuff ( i want to leave bits and parts in so i dont remove formatting) :

Code:
var newHtml = rng_RTB0.htmlText; 
	
	newHtml = newHtml.replace(/<script[^>]*>[\w|\t|\r|\W]*<\/script>/gi,''); 
	newHtml = newHtml.replace(/<object.*?<\/object>/gi,''); 
	newHtml = newHtml.replace(/<applet.*?<\/applet>/gi,''); 
	
	newHtml = newHtml.replace(/<table[^>]*./gi,'<table border=1>'); 
	newHtml = newHtml.replace(/<p[^>]*./gi,'<p>'); 
	newHtml = newHtml.replace(/<span[^>]*./gi,'<span>'); 
	newHtml = newHtml.replace(/<tr[^>]*./gi,'<tr>'); 
	newHtml = newHtml.replace(/<td[^>]*./gi,'<td>'); 
	newHtml = newHtml.replace(/<font[^>]*./gi,'<font>');	
	newHtml = newHtml.replace(/<ol[^>]*./gi,'<ol>');	
	newHtml = newHtml.replace(/<li[^>]*./gi,'<li>');	
	newHtml = newHtml.replace(/<o:[^>]*./gi,'');	
	newHtml = newHtml.replace(/<v:[^>]*./gi,'');	
	newHtml = newHtml.replace(/<\x3fxml[^>]*./gi,'');	newHtml = newHtml.replace(/<i[^>]*./gi,'<i>');	
		
	rng_RTB0.pasteHTML(newHtml); 
        alert(newHtml);

The alert in the last line tells me everyhting = ok. However when i look into the page after pasting it says everywhere "font size=+0" .... so ... after the past event has taken place.

My question : what causes the "size=+0" to be added and how can i prevent it?


--------------------------------------
deleau@gmail.com
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top