File - Search and Replace Text

Overview

The 'File - Search and Replace Text' flow action provides the capability to search for text fragments within Microsoft Word and PDF documents and replace with alternative text.

To redact text as opposed to replacing text with alternative text, review the 'Redact PDF' article. 

Example Flow

Please refer to the following article showcasing the 'File - Search and Replace Text' Power Automate action: Populate a Word or PDF Document using Power Automate

Credit Count

This action consumes 1 credit per operation.

Note, different Encodian actions can consume different number credits. Please always check the action specific documentation and read What is an Encodian Action for a full description of how credits are consumed.

Parameters

The default 'File - Search and Replace Text' flow action parameters are detailed below:

  • File Type: The type of file to process (DOCX or PDF)
  • Filename: The filename (including the file extension)
  • File Content: A Base64 encoded representation of the PDF file to be processed.
  • Phrases: An array of phrases (See below for further details)

Phrases

For each phrase; the 'Search Text' value will be replaced with the 'Replacement Text' value. By default; Text fragments are located by finding matching instances of the 'Search Text' parameter, to use a regular expression search simply set the 'Is Expression' value to true so that the 'Search Text' parameter will be treated as a regular expression and not a free text search.

Multiple phrases can be included within a single operation. To add more than one phrase click the 'Add new item' button:

  • Phrase
    • Search Text: The text or expression to use to locate matching text fragments. 
    • Is Expression: Set whether the 'Search Text' parameter should be treated as free text or regular expression.
    • Replacement Text: The text which should be used to replace the text fragments.
    • Font: Specify the name of the font, if the font cannot be found the default 'Arial' font will be used
    • Font Colour: Set the HTML colour of the font, the default colour is set to '#000000'
    • Font Size: Set the HTML colour of the font, the default colour is set to '#000000'
    • Background Colour: Set the HTML colour of the font background, the default colour is set to '#FFFFFF'
    • Underline: Set whether the font should be underlined.
    • Word Spacing: Set the word spacing value in pts.
    • Line Spacing: Set the line spacing value in pts. 

Font Support

Currently, only standard Windows fonts are supported, please refer to the following article to explore standard Windows fonts: Windows 10 Font List

Carriage Returns / Line Breaks / Section Breaks

For DOCX only; You can use metacharacters in the 'Replacement Text' field to include &p for a paragraph break, &b for a section break, &m for a page break, and &l for a line break.

For example;

Inserts the following;

Expression Creation

We recommend using the https://regexr.com/ site for regular expression creation and testing. 

File Contents

Please refer to the Obtaining the 'File Contents' Parameter article for guidance on how to obtain the 'File Content' parameter ready to provide to an Encodian flow action. 

Advanced Parameters

The advanced 'File - Search and Replace Text' flow action parameters are detailed below:

Return Parameters

The 'File - Search and Replace Text' flow action returns the following data. 

Standard Return Values

  • Filename - The filename of the document.
  • FileContent - The processed PDF document content.
  • OperationId - The unique ID assigned to this operation.
  • HttpStatusCode - The HTTP Status code for the response.
  • HttpStatusMessage - The HTTP Status message for the response.
  • Errors - An array of error messages should an error occur.
  • Operation Status - Indicates whether the operation has been completed, has been queued or has failed.
Have more questions? Submit a request

0 Comments

Please sign in to leave a comment.
Powered by Zendesk