Change Fontsize Programitically Follow

0
Avatar
Legacy Poster

How do I change the fontsize of a format programitically, any input would help..

 

BarTender.Application btApp;

BarTender.Format btFormat;

btApp = new BarTender.Application();

 

'Load format

btFormat = btApp.Formats.Open(@"c:\Templates\template.btw", false, "");

 

 

BarTender.DesignObject myTitle;
myTitle = btFormat.Objects.Find("Title");

 

'change the fontsize to 15

myTitle.FontSize = 15;

 

'save format

btFormat.SaveAs(@"c:\Output\"output.btw, true);

1 comments

0
Avatar
Ian Cummings
Moderator
Comment actions Permalink

You need to make use of the DesignObject() that became available in v9.3 onwards:

 

// Declare a BarTender application variable 
BarTender.Application btApp;

// Declare a BarTender document variable 
BarTender.Format btFormat; 

// Declare a BarTender design object variable 
BarTender.DesignObject btObject; 

// Create a new instance of BarTender 
btApp = new BarTender.Application();

// Set the BarTender application visible 
btApp.Visible = true;

// Open a BarTender document 
btFormat = btApp.Formats.Open("c:\\Format1.btw", false, "");

// Set the object variable 
btObject = btFormat.Objects.Find("Text 1");

// Set the text size to 14pt 
btObject.FontSize = 14;

// End the BarTender process 
btApp.Quit(BarTender.BtSaveOptions.btDoNotSaveChanges); 

Please sign in to leave a comment.