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

Javascript for Excel to Acrobat

New Here ,
Mar 02, 2020 Mar 02, 2020

Copy link to clipboard

Copied

Good day,

I'm troubled with some issues regarding Excel cells that needs to filled in by javascript code that's filled in the acrobat tab Custom calculated script. Normally I use this script for a pricelist thats been made up in excel. This code is: 

 

var Waarde_1 =   this.getField("Waarde_1");

 

followed by: 

 

Waarde_1.value = "....";

 

This works fine with the price lists, but the data for new documents, technical specifications, contains more detailed information and sometimes complete sentences. I always get a syntax error. How can I best do this?

TOPICS
Acrobat SDK and JavaScript

Views

488

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
community guidelines

correct answers 2 Correct answers

Community Expert , Mar 02, 2020 Mar 02, 2020

HI,

 

The technical specifications are strings and therefore have to be enclosed in quotes "".

 

For example:

Waarde_1.value ="Not filled in";

 

Regards

 

Malcolm

Votes

Translate

Translate
Community Expert , Mar 02, 2020 Mar 02, 2020

Use something like this:

Waarde_1.value = "";

 

Waarde_4.value = "T137-31,5";

Votes

Translate

Translate
Community Expert ,
Mar 02, 2020 Mar 02, 2020

Copy link to clipboard

Copied

HI,

 

Are you able to provide a sample document, so that we can see what you are trying to do and where the problem might be, I am having issues understanding what you are doing and therefore what the problem is.

 

Regards

 

Malcolm

Votes

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
community guidelines
New Here ,
Mar 02, 2020 Mar 02, 2020

Copy link to clipboard

Copied

Hey Malcolm, and Bernd,

 

I'll try to explain with below which is the same order i do normally for pricelists. in that case Waarde_no. is  Price_productno. This goes via the code below that is generated with excel. The values (such sT137-31,5 or Not filled in) are the output of numerous calculations in Excel. 

 

I want to create a more designed quotation instead of a simple MS Word letter with pricing. The design for this was made in Indesign. Samples of what i'm doing are shown below.

 

 part1 code.png

part2 code.png

 

The codes are copy pasted in the javascript-editor.

 

acrobat-sample.png


What bothers me  is that it works fine when it comes on pricinglist as shown below, the only thing is different are that these are numbers only.pricelist-sample.png

Votes

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
community guidelines
Community Expert ,
Mar 02, 2020 Mar 02, 2020

Copy link to clipboard

Copied

HI,

 

The technical specifications are strings and therefore have to be enclosed in quotes "".

 

For example:

Waarde_1.value ="Not filled in";

 

Regards

 

Malcolm

Votes

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
community guidelines
New Here ,
Mar 02, 2020 Mar 02, 2020

Copy link to clipboard

Copied

LATEST

Thank you Malcolm! This works! How little small things can do the trick... once again many thanks.

you also Bernd_Alheit

Votes

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
community guidelines
Community Expert ,
Mar 02, 2020 Mar 02, 2020

Copy link to clipboard

Copied

Use something like this:

Waarde_1.value = "";

 

Waarde_4.value = "T137-31,5";

Votes

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
community guidelines
Community Expert ,
Mar 02, 2020 Mar 02, 2020

Copy link to clipboard

Copied

Use this:
var Waarde_1 = this.getField("Waarde_1");

Votes

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
community guidelines