Free Support Forum - aspose.cloud

How to remove field code and macro in word document using Aspose.Words Cloud API

Hi,


Can you pls. help us to remove field code in the word document and macros in the word document using ASPOSE cloud api.

Thanks in advance.

Hi there,

Thanks for your inquiry. Please use Document.removeMacros method removes all macros (the VBA project) as well as toolbars and command customizations from the document.

A field in a Word document is a complex structure consisting of multiple nodes that include field start, field code, field separator, field result and field end. Fields can be nested, contain rich content and span multiple paragraphs or sections in a document. The Field class is a “facade” object that provides properties and methods that allow to work with a field as a single object.

The Start, Separator and End properties point to the field start, separator and end nodes of the field respectively.

Could you please share some detail about removing field code query? We will then provide you more information about your query along with code.

Hi,


Thanks for your update.

We are evaluating the ASPOSE REST API using cloud. In that we are not finding the macro removal method. Can you pls. update us on that with some reference or example .i.e., how to remove word macros using REST API (not through the ASPOSE Jar)

Also for the field code,Whatever you have mentioned is exactly the same. These codes we would like remove in the document through ASPOSE REST API.

Note: we have already checked ASPOSE Word product version(i.e., using ASPOSE jar file) and the above options are working for us, Our main question is on how to implement the same through your API.

Thanks in advance.

Hi there,

Thanks for your inquiry. Unfortunately, Aspose.Words for Colud does not support the requested features at the moment. However, I have logged these feature requests as SAASWORDS-197 (to remove macros) and SAASWORDS-198 (to remove all fields from the document) in our issue tracking system. You will be notified via this forum thread once these features are available.

We apologize for your inconvenience.

Thanks for the update. Looking forward to hear from you.

Hi,


Thanks for being patient.

We have good news for you i.e. SAASWORDS-197 and SAASWORDS-198 have now been resolved. You may now please re-test your scenario with Aspose.Words for Cloud. Hope, this helps.

As per SAASWORDS-197, we have added ‘macros Resource’ which represents a list of all macros that are contained in the document.

Resource URI: ~/{file-name}/macros
Example: DELETE https://api.aspose.cloud/v4.0/words/test.docx/macros

As per SAASWORDS-198, we have added ‘fields Resource’ which represents a list of all fields that are contained in the document, section or paragraph.

Resource URI:
  • ~/{file-name}/fields
  • ~/{file-name}/paragraphs/{paragraphIndex}/fields
  • ~/{file-name}/sections/{sectionIndex}/fields
  • ~/{file-name}/sections/{sectionIndex}/paragraphs/{paragraphIndex}/fields

HTTP DELETE example to remove fields from document:
https://apireference.aspose.cloud/words/#/Fields/DeleteFields

Best regards,