Formatting text

Last modified

Overview

This section describes how to reformat text fields, using an example of forcing upper case text.

Formatting text

Upper Case

Generally, text fields are formatted properly but, if you need to make a text field always in caps, from the Properties dialog, select Format > Custom > Edit and insert the javascript code shown below:

File:test/insolvency/230_21+PDF+templates/050_Adjusting+the+PDF/030_Formatting+text/PDF_Text.png

Title Case

To force 'Title Case', use the following script in place of the above example:

function toTitleCase(str) {
    return str.replace(/\w\S*/g, function(txt){return txt.charAt(0).toUpperCase() + txt.substr(1).toLowerCase();});
}
event.value = toTitleCase(event.value);

Removing Spaces

To strip spaces from a text field, use the following script:

event.value = event.value.replace(/[\" "\r]/gm, "") ;

This is useful where the data field has spaces, but the result has to be formatted across a number of boxes for individual characters with the span function.

Page statistics
338 view(s) and 7 edit(s)
Social share
Share this page?

Tags

CCH Insolvency

Comments

You must to post a comment.

Attachments

 

 | Cookie Policy | Copyright | Privacy Policy Terms of Use | Contact Us |