s
>let me rephrase my question
>how do you unbold a string in code
>
lcHTML= loSel.CreateRange.HTMLText
returns the selected string (eg '
This is bold'
>
>what do you have to do to save it back UNBOLDED?
Are you grabbing the HTML or the text? If you get HTML and it doesn't include the
tags, you need to navigate up to the parent element and grab its innerHTML and go from there.
+++ Rick ---
>
>Peter
>
>>Hi Peter,
>>
>>If it works what is the problem? <g>
>>
>>The most common tasks like bold, italic, underline etc. all have built in functionality so you don't need to do anything to embed text into the selection to change the markup - it just happens.
>>
>>You only need to write code for custom markup that isn't tied to hotkeys.
>>
>>One problem with your code is that the IE control always upper cases all tag names (ie. ) so you will NEVER see a in your markup text, even if you inserted it yourself. IE will always return all HTML out of the DOM which means it's been reformatted to 'DOM' format which is tags upper cased and HTML run together. In fact, doesn't exist either - IE converts that to if I remember right.
>>
>>So simply stepping through the code you posted will show you exactly what you're getting back and what you're replacing. It almost certainly means you're not replacing anything because you're searching for the wrong thing <g>...
>>
>>+++ Rick ---
>>
>>>I need to edit html in a web control in a vfp form;
>>>I have bold,italic,underline, highlight,forcolor button above the web control.
>>>i set the edit flag to allow IE editing
>>>the setting works as intended, meaning clicking on BOLD does bold the current selection. reselecting the bold section and pressing BOLD again doe unbold
>>>here is my code>
>>>>>>
>>>LOCAL x1,x2,loSel,lcNew,lcHTML,loRange
>>>
>>>x1=[<b>]
>>>x2=[</b>]
>>>WITH thisform.pgf1.page2.owB.Document
>>> loSel= .Selection
>>> lcHTML= loSel.CreateRange.HTMLText
>>> IF UPPER(x1)$UPPER(lcHTML)
>>> lcNew= STREXTRACT(lcHtml,x1,x2,1,1)
>>> else
>>> lcNew= x1+lcHtml+x2
>>> ENDIF
>>> loRange=loSel.CreateRange
>>> loRange.PasteHTML(lcNew)
>>>ENDWITH
>>>
>>>
>>>what am I doing wrong??
>>>
>>>Thanks