Programatically Override Data Text File Follow

Legacy Poster

I'm in the process of upgrading our current batch print software. All of our old .btw files were created to look for a specific text file for their data. I was wondering if there was something in the SDK to override this behavior, i.e. is there a way to keep the btw files as-is and send the data I want printed as some kind of C# object that'll be printed in lieu of the information that's in the text file?


Domingo Rodriguez
Comment actions Permalink

For database text files, BarTender allows you at print time, via the .NET Print SDK, to replace the existing text file connection with a different file. Would that perhaps help? See below code:


Setting a Text File Database Connection's File Name A Text File database connection can be used to source objects on a label format. The text file contents may need to vary depending on territory, situation, customer, etc. To support this, the Print SDK supports dynamically changing the text file used for the database connection.  

The following example demonstrates how to set a Text File database connection's file name:


In C#:

using Seagull.BarTender.Print.Database;

// Application Code

// ...

Engine btEngine = new Engine();

// Start a BarTender print engine


// Open a label format

LabelFormatDocument btFormat = btEngine.Documents.Open(@"c:\MyLabel.btw");

// Set the TextFile database connection file name

((TextFile)btFormat.DatabaseConnections["TextFileDB"]).FileName = @"c:\NutritionInformationEurope.txt";

// Print the label format document


// Stop the engine


Please sign in to leave a comment.