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

Free Support Forum - aspose.com

Converting all content control tags to HTML input buttons in content control hierarcy

Hi there,

I have a requirement to convert a word document to html with all content control tags converted to the clickable buttons. I am doing same by fetching all nodes of type content control and then iterating over them, while iterating using documentBuilder i am moving to the the node and insertingHTML for html button.But i am witnessing a issues:

When i am moving to the node and inserting html, button seem to be inserted after the content inside the Tag. Thus, the button is appearing at the end of the content control tag. This looks weird and unrecognized if there is hierarchy of content content control tags. I have tried multiple things using Sibling and Child nodes but there is no visible way which appear to be working in all cases.

Is there a way in aspose to insertHTML around a node?

Thanks

@aayushag85,

Thanks for your inquiry. Please ZIP and attach following resources here for our reference. We will then provide you more information about your query along with code.

  • Your input Word document.
  • Your input HTML that you want to insert into content control.
  • Please attach the output HTML file that shows the desired behavior.

test2.JPG (172.0 KB)
Body_From_Sample_Template.docx_section3.zip (9.2 KB)

Hey please find attached html and image showing the problematic region.
Note:

I am extracting all components like header,footers, sections as different words/html files.
I am inserting HTMLbuttons both at start and end of the content control tag with value as id of content control tag in word document.
testTag2.1 is inside TestTag2. When i am using moveTo using sibling then testTag2 gets to right place and testTag2.1 moves to wrong position. Similarly if i use moveTo using first child then testTag2 moves to wrong position and testTag2.1 remains at right position (as shown in image).Sample_Template.zip (38.2 KB)

@aayushag85,

Thanks for sharing the detail. Unfortunately, Aspose.Words does not export the HTML button into output HTML. In your case, we suggest you please bookmark the content of StructuredDocumentTag instead of inserting buttons around it. Hope this helps you.