How to extract plain HTML instead of formatted?

Last post 11-09-2008, 1:56 AM by Kenneth. 7 replies.
Sort Posts: Previous Next
  •  11-04-2008, 5:20 AM 45363

    How to extract plain HTML instead of formatted?

    Hi Adam,
     
    Can you please let me know, Is there any way to get unformatted HTML ? Right now the GetHTML() is returning a formatted HTML by adding the blank space in between, which in my case consuming the space of the database field while saving HTML. I need like this(without space): 
     
    <TABLE style="WIDTH: 100%" cellSpacing=1 cellPadding=1 border=0>
    <TBODY>
    <TR>
    <TD width=241>4:30pm to 6:00pm<BR></TD>
    </TR></TBODY></TABLE>
     
     
  •  11-05-2008, 12:04 AM 45395 in reply to 45363

    Re: How to extract plain HTML instead of formatted?

    Hi sanjay,
     
     
    Try this example:
     

    <%@ Page Language="C#" %>

    <%@ Register Assembly="CuteEditor" Namespace="CuteEditor" TagPrefix="CE" %>
    <!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
    <html xmlns="http://www.w3.org/1999/xhtml">
    <head runat="server">
        <title>Untitled Page</title>
    </head>
    <body>
        <form id="form1" runat="server">
            <div>
                <CE:Editor ID="Editor1" runat="server">
                </CE:Editor>
             Input some text and click the button<br />
                <asp:Button ID="b1" runat="server" OnClientClick="noSpace();return false"  Text="NoSpace"/>
        <asp:Button ID="b2" runat="server" OnClientClick="haveSpace();return false" Text=HaveSpace /><br />
           <asp:Label ID="Label1" runat="server" ></asp:Label>
            </div>
        </form>
    </body>
    </html>

    <script>
    function noSpace ()
    {
    var editor1 = document.getElementById('<% = Editor1.ClientID%>');
    var content = editor1.GetDocument().body.innerHTML;
    var label1=document.getElementById('<% = Label1.ClientID%>');
    label1.innerText=content;
    }
    function haveSpace ()
    {
    var editor1 = document.getElementById('<% = Editor1.ClientID%>');
    var content = editor1.GetHTML();
    var label1=document.getElementById('<% = Label1.ClientID%>');
    label1.innerText=content;
    }
    </script>

     

     
    Regards,
     
    Ken
  •  11-05-2008, 1:56 AM 45399 in reply to 45395

    Re: How to extract plain HTML instead of formatted?

     
    Thanks Ken for quick reply. I have tried your solution, this is fine when we are in Normal and Preview tab, it is showing the unformatted HTML but there is an issue when we are in HTML tab of editor in this case it is returning encoded HTML  like :

    &lt;table cellspacing="2" cellpadding="2" width="500" border="0"&gt;<BR>&nbsp;&nbsp;&nbsp; &lt;tbody&gt;<BR>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;
     
    and when we render this HTML again it displays the HTML itself in the Normal view and in Preview mode in Mozilla and Safari it is giving same formatted HTML. Please let me know some solution.
     
    One other main issue is, in Mozilla and Safari whenever we grab the HTML from Normal(design) view it is adding the style to the Table having dotted border and from HTML and Preview it is fine with border 0. This is also happening in your api demo:
     
    http://cutesoft.net/example/JavaScript-API.aspx
     <table style="border: 1px dotted #7f7c75;" bgcolor="#ffffff" border="0" cellpadding="4" cellspacing="4">

    Please reply soon, as we are reporting issues from our clients on this.
     
    Thanks
     

     
     
  •  11-05-2008, 11:14 AM 45430 in reply to 45399

    Re: How to extract plain HTML instead of formatted?

    Hi
     
    I have experienced the table border thing too. If you do

    ed.ExecCommand(
    "ToggleBorder");
     
    before the getHTML line then the border style will disappear. If you are having problems with this command in the HTML view you can switch views before getting the HTML. 

    ed.ExecCommand("tabedit");

    This will goto normal view or thinking about it......
    If the HTML is fine in the preview view, then switch it to the preview view and then get the HTML, then you wont need to worry about the toggleborder bit.
     
    Hope this helps.
     
  •  11-06-2008, 4:40 AM 45453 in reply to 45430

    Re: How to extract plain HTML instead of formatted?

    Thanks Andy. it works fine for me.
     
    But regarding the the above first no space(unformatted) html issue, I am still facing  the issue if I switch to Edit mode the encoded HTML issue is resolved now but I still getting the formatted result from HTML and Preview mode. Please help me on this.
     
    Thanks
  •  11-06-2008, 5:15 AM 45455 in reply to 45453

    Re: How to extract plain HTML instead of formatted?

    Ahhhh now that I cannot help with. I dont think you will have much luck with this one........
     
    I`m just a cutesoft user, so its back to their tech support maybe they have some more suggestions.
     
     
  •  11-06-2008, 11:20 PM 45491 in reply to 45455

    Re: How to extract plain HTML instead of formatted?

     
    Hi Ken/Adam,
     
    I am expecting some solution from your side. Please provide me some solution.
     
    Thanks
  •  11-09-2008, 1:56 AM 45538 in reply to 45491

    Re: How to extract plain HTML instead of formatted?

    Hi sanjay,
     
    We are investigating this issue and will get back to you as soon as possible.
     
     
    Regards,
     
    Ken
View as RSS news feed in XML