Javascript for Excel to Acrobat

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?

Adobe Community Professional
Correct answer by Bernd Alheit | Adobe Community Professional

Use something like this:

Waarde_1.value = "";

 

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

TOPICS
Acrobat SDK and JavaScript, Edit and convert PDFs, General troubleshooting, How to, PDF forms

Views

131

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

Javascript for Excel to Acrobat

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?

Adobe Community Professional
Correct answer by Bernd Alheit | Adobe Community Professional

Use something like this:

Waarde_1.value = "";

 

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

TOPICS
Acrobat SDK and JavaScript, Edit and convert PDFs, General troubleshooting, How to, PDF forms

Views

132

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
Mar 02, 2020 0
Adobe Community Professional ,
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

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...
Mar 02, 2020 0
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

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...
Mar 02, 2020 0
Adobe Community Professional ,
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

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...
Mar 02, 2020 0
Adobe Community Professional ,
Mar 02, 2020

Copy link to clipboard

Copied

Use something like this:

Waarde_1.value = "";

 

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

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...
Mar 02, 2020 0
Mar 02, 2020

Copy link to clipboard

Copied

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

you also Bernd_Alheit

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...
Mar 02, 2020 0
Adobe Community Professional ,
Mar 02, 2020

Copy link to clipboard

Copied

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

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...
Mar 02, 2020 0