Adobe DC - custom format 12 numbers to include dashes

New Here ,
Jul 02, 2017

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?

TOPICS
Acrobat SDK and JavaScript, Windows

Views

665

Likes

Translate

Translate

Report

Report
Community Guidelines
Be kind and respectful, give credit to the original source of content, and search for duplicates before posting. Learn more

Adobe DC - custom format 12 numbers to include dashes

New Here ,
Jul 02, 2017

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?

TOPICS
Acrobat SDK and JavaScript, Windows

Views

666

Likes

Translate

Translate

Report

Report
Community Guidelines
Be kind and respectful, give credit to the original source of content, and search for duplicates before posting. Learn more
Jul 02, 2017 0
Most Valuable Participant ,
Jul 02, 2017

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>

Likes

Translate

Translate

Report

Report
Community Guidelines
Be kind and respectful, give credit to the original source of content, and search for duplicates before posting. Learn more
Reply
Loading...
Jul 02, 2017 0
Most Valuable Participant ,
Jul 02, 2017

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);

Likes

Translate

Translate

Report

Report
Community Guidelines
Be kind and respectful, give credit to the original source of content, and search for duplicates before posting. Learn more
Reply
Loading...
Jul 02, 2017 0
New Here ,
Jul 02, 2017

Copy link to clipboard

Copied

Thank you, would you please give me the script for the 12 digit format? 111-222-3333-44?

Likes

Translate

Translate

Report

Report
Community Guidelines
Be kind and respectful, give credit to the original source of content, and search for duplicates before posting. Learn more
Reply
Loading...
Jul 02, 2017 0
Most Valuable Participant ,
Jul 02, 2017

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);

Likes

Translate

Translate

Report

Report
Community Guidelines
Be kind and respectful, give credit to the original source of content, and search for duplicates before posting. Learn more
Reply
Loading...
Jul 02, 2017 1
New Here ,
Jul 02, 2017

Copy link to clipboard

Copied

Thank You! that works perfect! You Rock!

Likes

Translate

Translate

Report

Report
Community Guidelines
Be kind and respectful, give credit to the original source of content, and search for duplicates before posting. Learn more
Reply
Loading...
Jul 02, 2017 0
New Here ,
Jul 02, 2017

Copy link to clipboard

Copied

Thank you, would you please give me the script for the 12 digit format? 111-222-3333-44?

Likes

Translate

Translate

Report

Report
Community Guidelines
Be kind and respectful, give credit to the original source of content, and search for duplicates before posting. Learn more
Reply
Loading...
Jul 02, 2017 0
Adobe Community Professional ,
Jul 03, 2017

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

Capture 1.png

Likes

Translate

Translate

Report

Report
Community Guidelines
Be kind and respectful, give credit to the original source of content, and search for duplicates before posting. Learn more
Reply
Loading...
Jul 03, 2017 1
Most Valuable Participant ,
Jul 03, 2017

Copy link to clipboard

Copied

I thought so also, but that doesn't work when you import the data from an external source...

Likes

Translate

Translate

Report

Report
Community Guidelines
Be kind and respectful, give credit to the original source of content, and search for duplicates before posting. Learn more
Reply
Loading...
Jul 03, 2017 0
Adobe Community Professional ,
Jul 03, 2017

Copy link to clipboard

Copied

Yes, that's right, I forgot this constraint.

Likes

Translate

Translate

Report

Report
Community Guidelines
Be kind and respectful, give credit to the original source of content, and search for duplicates before posting. Learn more
Reply
Loading...
Jul 03, 2017 0