Skip to content

Instantly share code, notes, and snippets.

@bjoerntx
Last active October 23, 2017 20:06
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save bjoerntx/cda88fb3bb3701ce6b25ed80e8611b2c to your computer and use it in GitHub Desktop.
Save bjoerntx/cda88fb3bb3701ce6b25ed80e8611b2c to your computer and use it in GitHub Desktop.
using System;
using TXTextControl.ReportingCloud;
namespace MyCoreApp
{
class Program
{
static void Main(string[] args)
{
var ReportName = "Sales Report";
// create dummy data
Report invoice = new Report() { Name = ReportName };
// create a new ReportingCloud instance
ReportingCloud rc = new ReportingCloud("username", "password");
// set the merge data
MergeBody body = new MergeBody() { MergeData = invoice };
// create the document
var results = rc.MergeDocument(body,
"gallery_repeating-blocks.tx",
ReturnFormat.RTF);
// convert the byte array to a string (return format is RTF)
var document = System.Text.Encoding.UTF8.GetString(results[0]);
if(document.Contains(ReportName)) {
Console.WriteLine("Document has been successfully created!");
Console.WriteLine(document);
}
else {
Console.WriteLine("Something went wrong!");
}
}
}
public class Report
{
public string Name { get; set; }
}
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment