Replace Strings
Back to
Related topics
Looking for Winshuttle Composer Plugins?
The Replace Strings plug-in is used to search for given strings in a document, replace those strings with other specified strings, and finally write the document back to a SharePoint document library or to a file system location.
Note: This plugin only supports text type content files (i.e. txt or xml file). It will not work with binary files; for example, Word or Excel files.
Value Pair | Description |
destinationfolder | The name of the destination folder in the specified SharePoint site. Note that if you want to place the document into the root of the document library, this value will be the name of the document library. NOTE: If this option is specified, destinationname and destinationsite must also be specified. |
destinationname | The name to give to the file in the destination document library. NOTE: If this option is specified, destinationfolder and destinationsite must also be specified. |
destinationpath | The full path in the file system where the file should be written. Note that this value must include everything, including the name of the file. |
destinationsite | The full URL to the destination SharePoint site. NOTE: If this option is specified, destinationname and destinationfolder must also be specified. |
replace[index] | The replacement string for the given index. |
search[index] | The search string for the given index. |
sourcepath | The source document. This can be either a full path in SharePoint to a document in a document library, or it can be a full path to a file in the file system. |
Example:
- sourcepath - c:\template\invoice.xml
- destinationpath - c:\invoices\invoice[Number].xml
- search0 - Customer Name
- replace0 - [Customer Name]
- search1 - Customer Address
- replace1 - [Customer Address]
This example reads the file from c:\template\invoice.xml in the file system, replaces all strings with the value of $$Customer Name$$ with the value of SharePoint column Customer Name, replaces all strings with the value of $$Customer Address$$ with the value of the SharePoint column Customer Address, then finally writes it to a file in the c:\invoices directory with a file name of invoice, then the value of the SharePoint column Number with .xml as the file extension.
Example:
- sourcpath - http://prod/finance/InvoiceTemplates/invoice.xml
- destinationsite - http://prod/public
- destinationfolder - Invoices
- destinationname - invoice[Number].xml
- search0 - $$Customer Name$$
- replace0 - [Customer Name]
- search1 - $$Customer Address$$
- replace1 - [Customer Address]
- This example reads the file from http://prod/finance/InvoiceTemplates/invoice.xml in a SharePoint document library, replaces all strings with the value of $$Customer Name$$ with the value of SharePoint column Customer Name, replaces all strings with the value of $$Customer Address$$ with the value of the SharePoint column Customer Address, then finally writes it to a file in the http://prod/publicSharePoint site in the Invoices document library, with the name invoice, then the value of the SharePoint column Number with .xml as the file extension.