<br/> HTML tag is not working in InsertHTML API with the plain text

Hi ,

I am facing a problem with “br” HTML tag in rendering in a word document. Following is the code that I am using to write s1 and s2 with one line break. s1 has
tag at the end . But both the strings are getting concatenated without any space. Please help me to resolve my problem. Please let me know if my code is wrong anywhere.

The output should be :

<font class="Apple-style-span" face="Arial">Some text 1 </font>
<font class="Apple-style-span" face="Arial">Some Text 2</font>
protected void BtnGenerateDocument_Click(object sender, EventArgs e)
{
    Document doc = new Document();
    DocumentBuilder builder = new DocumentBuilder(doc);
    string s1 = "<style>ol,ul,p{margin:0px;}</style><span id=" + "\"customSpanWithFontStyles\" style=\"font-size:8pt; font-family:Arial;\">Some text 1 </span><span class=\"Apple-style-span\" style=\"background-color: rgb(255, 255, 0); \"><br/></span>";
    string s2 = "<style>ol,ul,p{margin:0px;}</style><span id=\"customSpanWithFontStyles\" style=\"font-size:8pt; font-family:Arial;\">Some Text 2</span>";
    builder.InsertHtml(s1 + s2);

    doc.Save(PathOfFile + "DocumentBuilderAndSave Out.docx");
}

Thanks,
Deepti Jain

Hello

Thanks for your request. I managed to reproduce the problem on my side. Your request has been linked to the appropriate issue. You will be notified as soon as it is fixed.

But as a workaround you can try removing <style> tag from the beginning of the html string.

// Open document
Document doc = new Document();
DocumentBuilder builder = new DocumentBuilder(doc);

string s1 = "<span id=\"customSpanWithFontStyles\" style=\"font-size:8pt; font-family:Arial;\">Some text 1</span><br/>";
string s2 = "<span id=\"customSpanWithFontStyles\" style=\"font-size:8pt; font-family:Arial;\">Some Text 2</span>";

builder.InsertHtml(s1 + s2);

doc.Save("C:\\Temp\\out.docx");

All styles you can try putting to the separate string and insert at the beginning of the document.

Best regards,

The issues you have found earlier (filed as WORDSNET-5525) have been fixed in this .NET update and this Java update.

This message was posted using Notification2Forum from Downloads module by aspose.notifier.