in our sharepoint application page, we have a richtextbox control, where you can copy-pase word text, and it will translate it into the HTML
The problem that the generated HTML code is not W3C compliant, and has some SPAN included in P, or in I etc.
When I try to insert this genreated html to my Word document, I get a XmlSchemaValidationException. If the code is "clean", the insert works well.
Is there a work around?
- Code: Select all
while (nodes.Count > 0)
{
ICompositeObject node = nodes.Dequeue();
foreach (IDocumentObject child in node.ChildObjects)
{
if (child.DocumentObjectType == DocumentObjectType.TextBox)
{
Spire.Doc.Fields.TextBox txt = child as Spire.Doc.Fields.TextBox;
txt.Body.AddParagraph().AppendHTML([b]MyHtml[/b])
.......................
1) Utilisateur: 0#.w|ogf\administrator
2) Url: http://frvmspappdev1/Pages/CreationAvis ... sDecesID=7
3) Message: System.Xml.Schema.XmlSchemaValidationException: The element 'i' in namespace 'http://www.w3.org/1999/xhtml' has invalid child element 'div' in namespace 'http://www.w3.org/1999/xhtml'. List of possible elements expected: 'http://www.w3.org/1999/xhtml:a http://www.w3.org/1999/xhtml:br http://www.w3.org/1999/xhtml:span http://www.w3.org/1999/xhtml:bdo http://www.w3.org/1999/xhtml:object http://www.w3.org/1999/xhtml:applet http://www.w3.org/1999/xhtml:img http://www.w3.org/1999/xhtml:map http://www.w3.org/1999/xhtml:iframe http://www.w3.org/1999/xhtml:tt http://www.w3.org/1999/xhtml:i http://www.w3.org/1999/xhtml:b http://www.w3.org/1999/xhtml:u http://www.w3.org/1999/xhtml:s http://www.w3.org/1999/xhtml:strike http://www.w3.org/1999/xhtml:big http://www.w3.org/1999/xhtml:small http://www.w3.org/1999/xhtml:font http://www.w3.org/1999/xhtml:basefont http://www.w3.org/1999/xhtml:em http://www.w3.org/1999/xhtml:strong http://www.w3.org/1999/xhtml:dfn http://www.w3.org/1999/xhtml:code http://www.w3.org/1999/xhtml:q http://www.w3.org/1999/xhtml:samp http://www.w3.org/1999/xhtml:kbd http://www.w3.org/1999/xhtml:var http://www.w3.org/1999/xhtml:cite http://www.w3.org/1999/xhtml:abbr http://www.w3.org/1999/xhtml:acronym http://www.w3....
at System.Xml.XmlValidatingReaderImpl.InternalValidationCallback(Object sender, ValidationEventArgs e)
at System.Xml.Schema.XsdValidator.ValidateChildElement()
at System.Xml.Schema.XsdValidator.ValidateElement()
at System.Xml.Schema.XsdValidator.Validate()
at System.Xml.XmlValidatingReaderImpl.Read()
at System.Xml.XmlLoader.LoadNode(Boolean skipOverWhitespace)
at System.Xml.XmlLoader.LoadDocSequence(XmlDocument parentDoc)
at System.Xml.XmlDocument.Load(XmlReader reader)
at spr₵.ᜀ(String A_0, XmlSchema A_1)
at spr₵.ᜈ(String A_0)
at spr₵.ᜀ(IBody A_0, String A_1, Int32 A_2, Int32 A_3)
at spr₵.ᜀ(IBody A_0, String A_1, Int32 A_2, Int32 A_3, IParagraphStyle A_4, ListStyle A_5)
at Spire.Doc.Documents.Paragraph.AppendHTML(String html)
at OGF.AvisDeces.Components.Presenters.AvisDecesCreationPresenter.InsertText(IDocument document, String body1)
at OGF.AvisDeces.Components.Presenters.AvisDecesCreationPresenter.GenerateDocument()