Last active
October 23, 2017 20:06
-
-
Save bjoerntx/cda88fb3bb3701ce6b25ed80e8611b2c to your computer and use it in GitHub Desktop.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
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