Rich Text Formatting of Field From Access Database

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
DeanFrancis
Enthusiast
Posts: 19
Joined: Wed Aug 17, 2016 4:45 pm

Rich Text Formatting of Field From Access Database

Post by DeanFrancis » Thu Sep 12, 2019 7:41 pm

I would like to apply rich text formatting to a field pulled from an Access DB. I'm guessing there may be some scripting involved to selectively format different parts of a field, as well as some magic to pull the field itself into the function. Any guidance is appreciated.

Designer-Pro 2017
Access 2010

User avatar
Saso
NiceLabel
NiceLabel
Posts: 2970
Joined: Mon Sep 04, 2006 8:09 am
Contact:

Re: Rich Text Formatting of Field From Access Database

Post by Saso » Fri Sep 13, 2019 2:11 pm

When you configure a field in Access with "formatted text" option, you can format the text in bold, italic and similar. Access will ouput the formatting in HTML-based encoding.
access.png
access.png (11.75 KiB) Viewed 162 times
NiceLabel does not support HTML formatting just now. To use formatted text, you must use RTF object (and consecutively RTF formatting).
As a workaround you can use a VBScript/Python function that will do search & replace and convert HTML formatting into RTF formatting.

The provided label contains a function (RTF_Conversion) that does search & replace for you.
Sorry, I cannot attach the Access file, it's too large.
screenshot.png
screenshot.png (95.64 KiB) Viewed 162 times
Currently, there is one problem with this approach. :?
Access formats the italic text with <em></em> tags. "<em>" is internal NiceLabel's notation for "special character End of Media". NiceLabel will automatically replace "<em>" with binary data for "End of Media" and you cannot prevent it. I will try to find a way around it.

Italic formatting will not work with the provided sample.
Attachments
label.nlbl
(5.25 KiB) Downloaded 19 times
Saso Fleiser
Senior Technical Product Specialist

DeanFrancis
Enthusiast
Posts: 19
Joined: Wed Aug 17, 2016 4:45 pm

Re: Rich Text Formatting of Field From Access Database

Post by DeanFrancis » Fri Sep 13, 2019 5:12 pm

Thank you for putting this together. This seems a bit over my head. Here is an example of the formatting I need with HTML tags.

Code: Select all

<div><font face=Arial size=7><strong>This I</strong></font><font face=Arial size=6>s a test</font></div>
Odd formatting, but this is what the customer wants. For now, I've just used a Rich Text Box, and entered the data for each product manually, but the string is already in the Access database, and it would be nice to change Access fields without having to change the label itself when and if the time comes for updates.
Is there a list of tags for proper formatting from HTML to RTF I could refer to that I could start experimenting with?

Post Reply