Free Support Forum - aspose.com

Problem For <BR></BR> Tag in InsertHTML method

Hi Alexey,

I am facing a problem in Aspose word while printing the HTML formatted text.

I am using Aspose Word version 7.0.0.0

The Sample code is as follows.

private void button18_Click(object sender, EventArgs e)

{

string path = Path.GetDirectoryName(System.Windows.Forms.Application.ExecutablePath);

//Initialize Aspose license.

Aspose.Words.License lic = new Aspose.Words.License();

lic.SetLicense(path + @"\Aspose.Total.lic");

Aspose.Pdf.License lic1 = new Aspose.Pdf.License();

lic1.SetLicense(path + @"\Aspose.Total.lic");

Document doc = new Document();

DocumentBuilder documentBuilder = new DocumentBuilder(doc);

string str = "Norm Group:
Managerial and Professional (Asia Pacific)";

documentBuilder.Writeln("Scenario 1");

documentBuilder.InsertHtml(str);

//Inserting blank lines in document.

documentBuilder.Writeln("");

documentBuilder.Writeln("");

string str1 = "Norm Group:
Managerial and Professional (Asia Pacific) Extra Test";

documentBuilder.Writeln("Scenario 2");

documentBuilder.InsertHtml(str1);

//Saving the word document.

doc.Save("bullets.doc");

//Cutom method to open document directly in ms-word.

StartWord("bullets.doc");

}

Please refer the attached document for further reference.

If u go through the sample code & reference document you may find that there is an issue while rendering HTML line break tag
through

documentBuilder.InsertHtml() method.

The tag will not come to an effect unless & until you have an extra text added after {ending tag}

please refer sample code

Scenario1: is a last tag { no extra text after it } BR tag is not coming to effect

Scenario2: Extra Text the tag is working fine.

This issue is not available in Aspose Word version 6.2.0.0 where all HTML tags are working fine.

Please help us to solve this problem ASAP.

If you will be able to reproduce this problem at your end then how much time it will take to fix this issue ?

Waiting for Your reply......!!!!

Thanks & Regards,

Dwarika

Hi Dwarika,

<?xml:namespace prefix = o ns = "urn:schemas-microsoft-com:office:office" />

Thanks for your inquiry. In your HTML you specified BR tags improperly. BR tags cannot contain child elements. This tag should be self closed like the following
. But in your HTML BR tags are specified as following: , which is improperly.

Best regards,