Hello Spire,
My task: Convert a html/docx document to a docx/html document. I found in Spire help how's that done and implemented it successfully. My problem though, is that upon html -> doc conversion, I need to process some custom html tags and to produce from them some corresponding word doc objects. In particular, I need to insert "merge fields" in the html document and upon conversion to produce the corresponding merge fields in the resulting word document.
Questions:
1. Is there a native Spire way to achieve the above stated problem by providing some specific metadata (tags, comments, etc.) in the html, which the Spire convertor takes into account and produces a doc file with merge fields.
!!!IMPORTANT!!! I run the following experiment: I created a doc file with a merge field by using MS Word. Then I saved it as an html. The merge field was serialized in the html document as following:
<!--[if supportFields]><span style='mso-element:field-begin'></span><span
style='mso-spacerun:yes'> </span>MERGEFIELD FirstName <span style='mso-element:
field-separator'></span><![endif]--><span style='mso-no-proof:yes'>«FirstName»</span><!--[if supportFields]><span
style='mso-no-proof:yes'><span style='mso-element:field-end'></span></span><![endif]-->
Then I opened the html file with MS Word and converted it back to docx. In the newly created docx file, the merge field was restored successfully by the metadata provided in the comments in the html document. I rerun the same procedure programmatically by using Spire.Doc assembly. However, after the html -> doc conversion all merge field comments were lost.
2. If Spire Doc convertor has no support for converting merge fields in both directions (docx -> html, html -> doc), is there some alternative means for me as a developer to intercept the Spire conversion procedure and plug in my own code for custom converting particular doc objects/html tags.
Looking forward to hear from you!
Best Regards
Ivan