Is it possible to perform multiple actions over a document before executing the save_as

Right now we have a new need, remove the header and footer from every single page of a word document, I’ve tried this:

request_save_options_data = HtmlSaveOptionsData.new(
  FileName: "#{file_name_without_extension}.html",
  ImagesFolder: 'images/',
  SaveFormat: 'html',
  ExportHeadersFootersMode: 'None'
)
request = SaveAsRequest.new(name: file_name, save_options_data: request_save_options_data, folder: folder_name)
@words_api.save_as(request)

Using the ExportHeadersFootersMode: 'None' but it is still saving the doc with the footers and headers.

I’ve seen we can use this Delete all HeaderFooter objects from a Word document online|Documentation
but I’m not sure how to combine both things in the same request, or if I should save the doc in aspose first, then execute the delete_headers_footers_online and last use the save_as to convert it to HTML.

I’m doing that on this way:

    request = SaveAsRequest.new(name: file_name, save_options_data: request_save_options_data, folder: folder_name)
    @words_api.delete_headers_footers_online(request)
    @words_api.save_as(request)

but it shows this error ArgumentError - Incorrect request type which is expected.

What is the correct approach to accomplish this? it is still probably that we need to use other methods to improve our ingestion process, so the headers and footers won’t be our only issue so far, we’ll probably need to play around with math formulas, images, tables, sub and super indexes, etc

@altose87

Please double check that your input DOCX has valid HeadersFooters. As my sample document is working fine as expected, it does not include HeadersFooters when I set ExportHeadersFootersMode to None.

Yes it seems that what we are calling HeadersFooters are just paragraph elements in that document, I can see that the page numbers are removed which is good.

Is there another way to remove those items? let’s say something like, remove the first and last element on each page

@altose87

Please check ReplaceText, if it suits your requirements.