Planet PDF Forum Planet PDF Forum
  New Posts New Posts RSS Feed - WordNum equivalent?
  FAQ FAQ  Forum Search   Register Register  Login Login

Hi, welcome to the Foxit Planet PDF Forum. If you have PDF or Adobe Acrobat questions then the right place to ask them is here, in this forum.

WordNum equivalent?

 Post Reply Post Reply
Author
MalkavianBG View Drop Down
New Member
New Member


Joined: 07 Aug 2013
Location: България
Points: 3
Post Options Post Options   Quote MalkavianBG Quote  Post ReplyReply Direct Link To This Post Topic: WordNum equivalent?
    Posted: 12 Aug 2013 at 1:00pm
Hi there, people.
I am realy stucked on my project, cause I need an amount to be spelled in different text field with words in LiveCycle, but it have to be in my local language.
Any ideas pleeeeease ://


Edited by MalkavianBG - 12 Aug 2013 at 1:01pm
Back to Top
aandi View Drop Down
Senior Member
Senior Member


Joined: 07 Jul 2011
Points: 18358
Post Options Post Options   Quote aandi Quote  Post ReplyReply Direct Link To This Post Posted: 12 Aug 2013 at 1:54pm
It can be done, and I've seen examples in English which could give you in the principles you could follow to write the program in your own language.
Back to Top
gkaiseril View Drop Down
Senior Member
Senior Member


Joined: 15 Jul 2011
Location: USA
Points: 4109
Post Options Post Options   Quote gkaiseril Quote  Post ReplyReply Direct Link To This Post Posted: 12 Aug 2013 at 3:30pm
Within the sample files distributed with Acrobat, from 4.0 on, on a CD or DVD is a folder of sample forms and one of those forms is a check form that has this feature.
 
The function provided:
 
function ConvertToHundreds(num)
{
aTens = [ "Twenty", "Thirty", "Forty", "Fifty", "Sixty", "Seventy", "Eighty", "Ninety"];
aOnes = [ "Zero", "One", "Two", "Three", "Four", "Five", "Six", "Seven", "Eight", "Nine",
  "Ten", "Eleven", "Twelve", "Thirteen", "Fourteen", "Fifteen", "Sixteen", "Seventeen", "Eighteen",
  "Nineteen" ];
 
   var cNum, nNum;
   var cWords = "";
   num %= 1000;
   if (num > 99) {
      /* Hundreds. */
      cNum = String(num);
      nNum = Number(cNum.charAt(0));
      cWords += aOnes[nNum] + " Hundred";
      num %= 100;
      if (num > 0)
         cWords += " and "
   }
 
   if (num > 19) {
      /* Tens. */
      cNum = String(num);
      nNum = Number(cNum.charAt(0));
      cWords += aTens[nNum - 2];
      num %= 10;
      if (num > 0)
         cWords += "-";
   }
   if (num > 0) {
      /* Ones and teens. */
      nNum = Math.floor(num);
      cWords += aOnes[nNum];
   }
   return cWords;
}
function ConvertToWords(num)
{
   var aUnits = [ "Thousand", "Million", "Billion", "Trillion", "Quadrillion" ];
   var cWords = (num >= 1 && num < 2) ? "Dollar and " : "Dollars and ";
   var nLeft = Math.floor(num);
   for (var i = 0; nLeft > 0; i++) {
       if (nLeft % 1000 > 0) {
          if (i != 0)
             cWords = ConvertToHundreds(nLeft) + " " + aUnits[i - 1] + " " + cWords;
          else
             cWords = ConvertToHundreds(nLeft) + " " + cWords;
       }
       nLeft = Math.floor(nLeft / 1000);
   }
   num = Math.round(num * 100) % 100;
   if (num > 0)
      cWords += ConvertToHundreds(num) + " Cents";
   else
      cWords += "Zero Cents";
   return cWords;
}
 
You should be able to use this script in LiveCycle by selecting "JavaScript" as the scripting language and placing the code in the top level of the document.
Back to Top
 Post Reply Post Reply
  Share Topic   

Forum Jump Forum Permissions View Drop Down

Forum Software by Web Wiz Forums® version 11.10
Copyright ©2001-2017 Web Wiz Ltd.

This page was generated in 0.078 seconds.