Problem with HTML2RTF - when using tables/lists pasted from Word

Last post 01-18-2010, 6:23 AM by sh83. 1 replies.
Sort Posts: Previous Next
  •  01-15-2010, 10:50 AM 58196

    Problem with HTML2RTF - when using tables/lists pasted from Word

    Hi,
     
    I am evaluating the editor for a work project, and everything is great apart from a problem we are having.
     
    We need our users to be able to copy & paste from Word - text, bulleted lists and tables only.  This is then converted to RTF and saved in the database.  When a user pastes a table and bulleted list from Word in Firefox, the bulleted list is lost and when the RTF conversion is called we get the following error (the error also happens if you just have a list, or just have a table.  It doesn't appear if they paste formatted normal text):
     
    Error:
    Length cannot be less than zero.
    Parameter name: length
     
    Stack trace:
     at System.String.InternalSubStringWithChecks(Int32 startIndex, Int32 length, Boolean fAlwaysCopy)
    at System.String.Substring(Int32 startIndex, Int32 length)
    at CuteEditor.Convertor.HTMLNode.ParseStyleString(String style, CssType type, String forstr)
    at CuteEditor.Convertor.HTMLNode.ParseCss(Params param)
    at CuteEditor.Convertor.HTMLNode.ParseCss()
    at CuteEditor.Convertor.HTMLNode.set_Parent(HTMLNode value)
    at CuteEditor.Convertor.HTMLNode.Add(HTMLNode node)
    at CuteEditor.Convertor.HTMLTree.a()
    at CuteEditor.Convertor.HTMLTree..ctor(String html)
    at CuteEditor.Convertor.RTF.HTML2RTF..ctor(String html)
     
    In Internet Explorer 8, this doesn't happen if the user clicks "OK" to the "Do you want to clean the code before pasting from Word?" prompt when they paste - but this prompt doesn't appear in Firefox.  How can we get this prompt in Firefox? I think it will make the error above will disappear.  Is there a way to force it to happen without the user seeing the prompt?  We have tried calling CleanUpMicrosoftWordHTML() before the conversion to RTF takes place but this hasn't helped.
     
    We are pasting from Word 2007, and it can be recreated by copying a table (2 cols x 2 rows with no formatting) or list from Word into the http://cutesoft.net/example/editRTF.aspx example in Firefox.
     
     
    Thanks in advance for any help you can give.
  •  01-18-2010, 6:23 AM 58231 in reply to 58196

    Re: Problem with HTML2RTF - when using tables/lists pasted from Word

    Seem to have solved it myself, by doing the following when the user tries to save their input:
     
    - Calling EditorUtility.ConvertWordToHTML(user's input as string) to clean up the HTML
    - Then calling RTF.HTML2RTF(clean user input as string) to get the RTF value using the cleaned HTML.
View as RSS news feed in XML