Exit
  • Global community
    • Language:
      • Deutsch
      • English
      • Español
      • Français
      • Português
  • 日本語コミュニティ
  • 한국 커뮤니티
0

Adobe DC - custom format 12 numbers to include dashes

New Here ,
Jul 02, 2017 Jul 02, 2017

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
3.1K
Translate
Report
Community guidelines
Be kind and respectful, give credit to the original source of content, and search for duplicates before posting. Learn more
community guidelines
Community Expert ,
Jul 02, 2017 Jul 02, 2017

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>

Translate
Report
Community guidelines
Be kind and respectful, give credit to the original source of content, and search for duplicates before posting. Learn more
community guidelines
Community Expert ,
Jul 02, 2017 Jul 02, 2017

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

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

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

Translate
Report
Community guidelines
Be kind and respectful, give credit to the original source of content, and search for duplicates before posting. Learn more
community guidelines
Community Expert ,
Jul 02, 2017 Jul 02, 2017

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

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

Thank You! that works perfect! You Rock!

Translate
Report
Community guidelines
Be kind and respectful, give credit to the original source of content, and search for duplicates before posting. Learn more
community guidelines
New Here ,
Sep 08, 2021 Sep 08, 2021
LATEST

I stumbled accross this thread and I just wanted to thank you for this script. It helped me out as well. Thanks again!

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

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

Translate
Report
Community guidelines
Be kind and respectful, give credit to the original source of content, and search for duplicates before posting. Learn more
community guidelines
Community Expert ,
Jul 03, 2017 Jul 03, 2017

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


Acrobate du PDF, InDesigner et Photoshopographe
Translate
Report
Community guidelines
Be kind and respectful, give credit to the original source of content, and search for duplicates before posting. Learn more
community guidelines
Community Expert ,
Jul 03, 2017 Jul 03, 2017

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

Translate
Report
Community guidelines
Be kind and respectful, give credit to the original source of content, and search for duplicates before posting. Learn more
community guidelines
Community Expert ,
Jul 03, 2017 Jul 03, 2017

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


Acrobate du PDF, InDesigner et Photoshopographe
Translate
Report
Community guidelines
Be kind and respectful, give credit to the original source of content, and search for duplicates before posting. Learn more
community guidelines