Re: CleanUpMicrosoftwordHTML() does'nt do any thing on my editor text. Please help urgent !!

  •  11-03-2008, 7:02 PM

    Re: CleanUpMicrosoftwordHTML() does'nt do any thing on my editor text. Please help urgent !!

     For acheiving the above thing I am doing the following......
     
     
     <script language="javascript">

     var OxO2f01=["ig",

    "\x3C/?[^\x3E]*\x3E",

    "",

    "\x3C\x5C?xml[^\x3E]*\x3E",

    "\x3C/?[a-z]+:[^\x3E]*\x3E",

    "(\x3C[^\x3E]+) class=[^ |^\x3E]*([^\x3E]*\x3E)",

    "$1 $2",

    "(\x3C[^\x3E]+) style=\x22[^\x22]*\x22([^\x3E]*\x3E)",

    "\x3Cspan[^\x3E]*\x3E\x3C/span[^\x3E]*\x3E",

    "\x3Cspan\x3E\x3Cspan\x3E",

    "\x3Cspan\x3E",

    "\x3C/span\x3E\x3C/span\x3E",

    "\x3C/span\x3E",

    "[ ]*\x3E",

    "\x3E",

    "\x3C/?font[^\x3E]*\x3E",

    "\x3C/?span[^\x3E]*\x3E",

    "span",

    "font",

    "css",

    "word",

    "allhtml"];

     

    function execRE(Ox276,Ox277,Ox132){

    var Ox278= new RegExp(Ox276,OxO2f01[0x0]);

    return Ox132.replace(Ox278,Ox277);} ;

     

     

     



    function
    customCleaner(controlID){

     

    var control = document.getElementById(controlID);

    alert("hii");                                                              //If I remove this alert message , this is not called.
     
    var editor = CuteEditor_GetEditor(control);

    var Ox132=editor.GetBodyInnerHTML();

     

     

     

    switch("word"){

     

    case OxO2f01[0x14]: Ox132=execRE(OxO2f01[0x3],OxO2f01[0x2],Ox132) ; Ox132=execRE(OxO2f01[0x4],OxO2f01[0x2],Ox132) ; Ox132=execRE(OxO2f01[0x5],OxO2f01[0x6],Ox132) ; Ox132=execRE(OxO2f01[0x7],OxO2f01[0x6],Ox132) ; Ox132=execRE(OxO2f01[0x8],OxO2f01[0x2],Ox132) ; Ox132=execRE(OxO2f01[0x9],OxO2f01[0xa],Ox132) ; Ox132=execRE(OxO2f01[0xb],OxO2f01[0xc],Ox132) ; Ox132=execRE(OxO2f01[0xd],OxO2f01[0xe],Ox132) ;break ;

    ;;;;

    } ;

     

    editor.SetHTML(Ox132) ;} ;
     
    </script>
     
     
    The above javascript is in my .aspx file. I have three text editors on the aspx page.
     
     
    In the code behind,
     
          I am looping through all the controls, finding the cute eidtor and passing the editor ID to the javascript function
     
      
    RemoveWordHTML is the function in code behind. I am passing Page as the parameter. So this will loop through all the controls and identify the cute editors and calling the above javascript function.


    public
    void RemoveWordHTML(System.Web.UI.Control cntrls)

    {

    CuteEditor.Editor TBText;

     

    foreach (System.Web.UI.Control cntrl in cntrls.Controls)

    {

    if (cntrl != null)

    {

    if (cntrl.GetType().ToString() == "CuteEditor.Editor")

    {

    if (cntrl.ID.ToString().IndexOf("CuteEditor") != -1)

    {

    TBText = (CuteEditor.Editor)cntrl;

    i++;

    string strScript = "<script language=javascript>customCleaner('" + TBText.ClientID + "');</script>";

    if (!Page.ClientScript.IsStartupScriptRegistered("clientScript" + i))

    Page.ClientScript.RegisterStartupScript(this.GetType(), "clientScript" + i, strScript);

     

    }

    }

    }

    if (cntrl.HasControls())

    {

    RemoveWordHTML(cntrl);

    }

    }

    }
     
     
    By doing the above , I am acheiving what I needed. ( Functionaliy of client side CleanUp Tool on server side). 
     
    But only If have some alert message then only javascript function is being called. I think it has something to do with funtion CuteEditor_GetEditor(control); 
     
    can you help me on this ?  Your patience is greatly appreciated !!
              
     
View Complete Thread