Copy link to clipboard
Copied
Adobe DC - I am trying to import a number from Excel that has no dashes into a pdf file that will insert the dashes. Is this possible ? ie 123456789012 in excel and I want it to look like 123-456-7890-12 when in the pdf. Do I need to do a Java script? If yes could you tell me how to write it?
Copy link to clipboard
Copied
No, that won't work. You need to give the values the correct format before
importing them to the PDF.
On Mon, Jul 3, 2017 at 12:33 AM, colettel75944671 <forums_noreply@adobe.com>
Copy link to clipboard
Copied
Sorry, my reply above is not entirely correct. You can do is using a script... For example, to format a 6-digit number as "123-456" you can use this code as the custom Format script:
if (/^\d{6}$/.test(event.value)) event.value = event.value.substring(0,3)+"-"+event.value.substring(3);
Copy link to clipboard
Copied
Thank you, would you please give me the script for the 12 digit format? 111-222-3333-44?
Copy link to clipboard
Copied
Here you go:
if (/^\d{12}$/.test(event.value)) event.value =
event.value.substring(0,3)+"-"+event.value.substring(3,6)+"-"+event.value.substring(6,10)+"-"+event.value.substring(10);
Copy link to clipboard
Copied
Thank You! that works perfect! You Rock!
Copy link to clipboard
Copied
I stumbled accross this thread and I just wanted to thank you for this script. It helped me out as well. Thanks again!
Copy link to clipboard
Copied
Thank you, would you please give me the script for the 12 digit format? 111-222-3333-44?
Copy link to clipboard
Copied
123456789012 in excel and I want it to look like 123-456-7890-12 when in the pdf
Properties : Format : Special : Arbitrary Mask

Copy link to clipboard
Copied
I thought so also, but that doesn't work when you import the data from an external source...
Copy link to clipboard
Copied
Yes, that's right, I forgot this constraint.
Get ready! An upgraded Adobe Community experience is coming in January.
Learn more