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

Free Support Forum - aspose.com

Problem with Inserting HTML at bookmarks

I am using evaluation version of Aspose Words 6.1.0,

I am replacing the bookmarks in the templates with HTML content like this...

string DocItemTextHTML = "" +

"

" +

"

" +

"

" +

"

" +

"

" +

"

" +

"

" +

"

" +

"

" +

"

" +

"

" +

"

" +

"

" +

"

" +

"

" +

"

" +

"

" +

"

" +

"

" +

"

No# Req. Description Results ActualResults Grade Date
Number Name Test Criteria Test 1    
" +

"";

Bookmark bookDocDocItemText = docDocItem.Range.Bookmarks["SpecItemText"];

bookDocDocItemText.Text = ""; //error getting here

builderDocItem.MoveToBookmark("SpecItemText");

builderDocItem.InsertHtml(DocItemTextHTML);

builderDocItem.EndBookmark("SpecItemText");

if the HTML content is like above, i am getting an err....

but when i am attaching
tag or
after the body tag/before table tag in the above HTML, I am not getting any error, it working fine..

but my requirement is, i should not add any text or
tags after the body tag or before the table tag...

i am not able to find why the error is coming when the HTML starts like

...... and why the error is not coming when the HTML starts like table description
.................

Any sugestions would be appreciated...

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

Thanks for your request. Could you please clarify what kind of error do you get? Also, please attach your document for testing. I will try to reproduce the problem and provide you more information.

Best regards.

Hi Alexey,

Thanks for your response,

I written the code like,

string DocItemNameHTML = "Document Item";

string DocItemImage = Server.MapPath("./Images/Blue hills.jpg");

string DocItemTextHTML = "" + // I am not written any thing b/w tag and

tag

"

" +

"

" +

"

" +

"

" +

"

" +

"

" +

"

" +

"

" +

"

" +

"

" +

"

" +

"

" +

"

" +

"

" +

"

" +

"

" +

"

" +

"

" +

"

" +

"

Test# Req. TestDescription ExpectedResults ActualResults Pass/Fail Performed By / Date
Qual Item Number Related Spec Item=Item Number and Name Test Description Acceptance Criteria Test Result  
" +

"";

Document docDocItem = new Document(@"D:\Test\templates\SpecItem.dot");

DocumentBuilder builderDocItem = new DocumentBuilder(docDocItem);

Bookmark bookDocDocItem = docDocItem.Range.Bookmarks["SpecItemName"];

bookDocDocItem.Text = "";

builderDocItem.MoveToBookmark("SpecItemName");

builderDocItem.InsertHtml(DocItemNameHTML);

builderDocItem.EndBookmark("SpecItemName");

Bookmark bookDocDocItemText = docDocItem.Range.Bookmarks["SpecItemText"];

bookDocDocItemText.Text = ""; //I am getting error here

builderDocItem.MoveToBookmark("SpecItemText");

builderDocItem.InsertHtml(DocItemTextHTML);

builderDocItem.EndBookmark("SpecItemText");

// addedsome code here

Now it's not working.. getting error like Object reference not found.. Please found attachment for error screen shot

when i am writting HTML like

string DocItemTextHTML = "Document Item Text<br>" + // added some text after tag

"

" +

"

" +

"

" +

"

" +

................. // Same above HTML

now its working fine....

but my requirement is i should not add any text after tag..

please suggest me solving this problem...

Test# Req.

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

Thank you for additional information. I cannot reproduce the problem on my side. Could you please attach your document here for testing?

Best regards.