Get Embedded Data From Label Follow

0
Avatar
Legacy Poster

Hello there,

 

I'm currently building software for printing of label designs for a client, and thus far the software has been working perfectly. However, a new requirement has made itself apparent. The client's label designs requires certain text within a text field on a label to be highlighted in bold. Originally, the label designs were making use of the Single Line / Multi Line text fields, but obviously to achieve the new requirement we are having to move onto HTML/RTF fields.

 

That being said, I can populate the contents of a text field in a label using the SDK quite easily. Constructing the HTML and passing it into the label design when printing is a breeze, but ideally I need the software to inherit the formatting style of the text field as it is defined in the label design (when created in Bartender). For instance:

 

The client modifies a HTML text field, and updates the embedded data to look like so:

 

<html><head><style type='text/css'>body { font-family: 'Tahoma'; font-size: '10pt'; }</style></head><body>DATA</body></html>

They have chosen to format the text field with Tahoma 10pt font. Now, in my software, I am assigning the HTML value of the text field, but this obviously overwrites whatever default embedded data the client had assigned against the text field, thus removing the font information.

 

My question is, is there a way to collect the default embedded data of the substring in the label format, so that (using the example above) I could replace the term 'DATA' with html content, and retain the rest of the formatting. I have tried to do this using the Value field of the substring, but it does not work:

 

String currentData = labelFormat.SubStrings["MyField"].Value;
String adjustedData = currentData.Replace("DATA", "Some <b>data</b> here");
labelFormat.SubStrings.SetSubString("MyField", adjustedData);

 

Thanks in advance,

 

Chris

3 comments

0
Avatar
Domingo Rodriguez
Moderator
Comment actions Permalink

What about using a Prefix and Suffix in the HTML container in BarTender? You can use them by opening the properties of the Markup Language container, now choosing your Data Source on the left node and the "Transforms" tab on the Right node. You can now create a Prefix of e.g. <html><head><style type='text/css'>body { font-family: 'Tahoma'; font-size: '10pt'; }</style></head><body> and a Suffix of </body></html>. At print time, you will really just need to assign the variable data to be printed.

0
Avatar
Legacy Poster
Comment actions Permalink

Thanks for the reply. I'm pretty sure that would work actually, although I have resolved to supplying the client with a new font setting in the software to auto-format the contents of the field. The client has many different label designs and it's much easier for me to simply handle the HTML encoding aspect from the software side when printing, than having them update each label design to individually update the font information.

 

Thank you anyway.

0
Avatar
Domingo Rodriguez
Moderator
Comment actions Permalink

Okay,

 

Thanks for the update!

Please sign in to leave a comment.