Allergens-like function with 2 different formatting

Issues related to label design (working with databases, data processing, RFID encoding etc.) and printing (from NiceLabel Express, NiceLabel Pro, NiceForm and NicePrint)

Moderators: Georges, milos, NiceLabel Support Team

Post Reply
ricardo
Enthusiast
Posts: 11
Joined: Mon Nov 14, 2011 8:14 pm
Location: Porto, Portugal
Contact:

Allergens-like function with 2 different formatting

Post by ricardo » Mon Jun 08, 2020 8:25 pm

Hi.
Recently we got a challenge to print a list of ingredients complying with allergens EU nutrition designations, but this same list of ingredients also has specific items that have to be in italic (scientific animal species in latin).

So, on the same RTF field I have to format allergens in BOLD and scientific names in ITALIC.

Any clue how to achieve this using database?

User avatar
Mytch
NiceLabel Support
NiceLabel Support
Posts: 146
Joined: Fri Jul 13, 2018 10:26 pm
Location: Milwaukee, Wisconsin
Contact:

Re: Allergens-like function with 2 different formatting

Post by Mytch » Mon Jun 08, 2020 10:39 pm

ricardo,

All you need is another column containing the 'italics' values just like the Food Allergens sample:
C:\Users\Public\Documents\NiceLabel 2019\Designer\Pro\Samples\Food\Food Allergens

Then you can modify RTF_FormattedIngredients and just run your ingredients through the FormatAllergensFromExcel function twice:

Code: Select all

aPath = Left(LabelFileName, InstrRev(LabelFileName,"\"))
bold = FormatAllergensFromExcel([Products.Ingred],aPath&"\DB.xlsx","Allergens","Allergen","bold")
Result = FormatAllergensFromExcel(bold,aPath&"\DB.xlsx","Italics","Italics","italic")
There's probably some 'easier' one-liner for this too.. but in the sample above, this assumes you are just going to bold all words in the Excel sheet named Allergens with the column Allergen. And then you will take that output and italicize all words in the Excel sheet named Italics in the column named Italics. You can manage your data and naming how you'd like.

Here is an example:
2020-06-08_15h37_16.png
2020-06-08_15h37_16.png (102.04 KiB) Viewed 71 times
Regards,
Mytch

Post Reply