Products Technologies Demo Docs Blog Support Company

ReportingCloud: New Endpoint to Find and Replace Text

We just released a new endpoint to the ReportingCloud Web API: https://api.reporting.cloud/v1/document/findandreplace This new endpoint can be used to find any text in any text part of a document including the main text, headers and footers and text frames. The endpoint POST method accepts an array of string arrays with pair values to find and replace strings in a template. The following code, that uses the ReportingCloud .NET wrapper, finds and replaces the string Invoice with ReplacedText…

ReportingCloud: New Endpoint to Find and Replace Text

We just released a new endpoint to the ReportingCloud Web API:

https://api.reporting.cloud/v1/document/findandreplace

This new endpoint can be used to find any text in any text part of a document including the main text, headers and footers and text frames. The endpoint POST method accepts an array of string arrays with pair values to find and replace strings in a template.

The following code, that uses the ReportingCloud .NET wrapper, finds and replaces the string Invoice with ReplacedText and Invoice2 with ReplacedText2 in the complete document.

ReportingCloud rc = new ReportingCloud("username", "password");

FindAndReplaceBody body = new FindAndReplaceBody();
body.FindAndReplaceData = new List<string[]> {
    new string[] { "Invoice", "ReplacedText" },
    new string[] { "Invoice2", "ReplacedText2" }
    };

byte[] bDocument = rc.FindAndReplaceDocument(body, "invoice.tx", ReturnFormat.HTML);
string sHtmlDocument = System.Text.Encoding.UTF8.GetString(bDocument);

Console.WriteLine(sHtmlDocument.Contains("ReplacedText"));

For mail merge purposes, usually merge fields are used and those templates are merged using the endpoint document/merge. But in several scenarios or templates from legacy applications, simple find and replace processes are very useful.

Start today with ReportingCloud and sign up for a free trial account.

Happy coding!

Stay in the loop!

Subscribe to the newsletter to receive the latest updates.

Cloud

Are we moving to the cloud? This question is changing from "if" to "when" and "how". Text Control ReportingCloud brings complete reporting functionality to the cloud so all developers can use it, irrespective of the platform or language they're using. Its highly RESTful API can be used to merge Microsoft Word compatible templates with JSON data from all clients including .NET, Javascript, PHP, Node.JS, jQuery, Ruby, Python, Android, Java and iOS.

See Cloud products

Related Posts

CloudReportingRelease

ReportingCloud Monthly Payment Available

We just released ReportingCloud monthly subscriptions that will be auto-renewed, if not cancelled.


CloudReleaseReportingCloud

ReportingCloud: Setting the Culture for Date and Currency Fields

We just released a new property to define the culture for the merge process to handle date and currency field values.


ASP.NETCloudConference

Visit Text Control at BASTA! 2017

Next week, we are exhibiting at the 20th anniversary edition of BASTA!, one of the largest .NET focused developer conferences in Germany.


CloudConferenceMail Merge

More Impressions from DWX Developer Week 2017

The DWX Developer Week 2017 was a huge success. We really enjoyed the powerful atmosphere talking to so many enthusiastic developers about our products, technologies and services. On the last day,…


CloudConferenceMail Merge

DWX Developer Week 2017: First Impressions

We are currently exhibiting at Germany's largest conference: DWX Developer Week. We are giving away our Text Control yo-yos, raffling off an XBox One and talking about our reporting libraries, our…