We're sorry Aspose doesn't work properply without JavaScript enabled.

Free Support Forum - aspose.com

<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 :
Some text 1
Some Text 2

protected void BtnGenerateDocument_Click(object sender, EventArgs e)
{
Document doc = new Document();
DocumentBuilder builder = new DocumentBuilder(doc);
string s1 = “ol,ul,p{margin:0px;}<span id=” +
"“customSpanWithFontStyles” style=“font-size:8pt; font-family:Arial;”>Some text 1
";
string s2 =
“ol,ul,p{margin:0px;}<span id=“customSpanWithFontStyles” style=“font-size:8pt; font-family:Arial;”>Some Text 2”;
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 tag from the beginning of the html string.

// Open document

Document doc = new Document();

DocumentBuilder builder = new DocumentBuilder(doc);

string s1 = "Some text 1
"
;

string s2 = "Some Text 2";

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.