Getting number of Words in a Frame in CS4

Hello All,
I am trying to get the number of words in a Text Frame. I tried the API GetWordCountInfo of ITextUtils
For E.g. Utils<ITextUtils>()->GetWordCountInfo(  iTextmodel, 0,  iTotalLength, ITextUtils::kUpdateAll, ITextUtils::kStartCounting,
      wordStarted,  characters,   words,   paragraphs,  lines, oversetCharacters,  oversetWords,  oversetParagraphs, oversetLines,  bWordAcrossOverset,
      helper  );
I am took the value of words and checked. I am getting value such as 2049679. Even though there is no text in the frame. Am not sure what wrong value I have given as a parameter required.
Has anyone tried this before. Or Is there some other way of getting the word count from the frame. If so please do let me know.
Thank you all in advance.
Regards
Farzana.

Hi ,
I have declared the parameters to the function as uint32.
And when I see them in alert I am converting the same to int32 by using ToInt32(). I tried using uint32 appending directly as number to my string variable. But it gives same output in alert.
Thanks
Regards
Farzana,

Similar Messages

  • How i get number of record in repet frame?

    Hi,
    How i get number of record in repet frame?
    Regards
    Jomar

    Jomar,
    you can use Summary Columns in the Data Modell. Create them on group higher that your wished group (so on the pane for an first group of a query), use as Source the primary column and as reset at the group, where the summary column is located.
    If you hide some instances via format triggers, that you could use a counter inside the format triggers to count the rows.
    Regards
    Rainer

  • How to get number of pages in word document

    I am developing an OCR application where I need to get number of pages of word documents. I am currently assuming that each page consists of 46 lines but some how, I am not getting convinced with this logic. Is there any simplest way to get this information?
    Let me tell you that in the OCR system I am converting tiff iamges to .txt file and again reading txt file and counting number of pages based on number of lines.
    regards,
    Ranjan

    The number of pages depends on the font size, length of each line and any page break in between.
    You could just say, one page per 46 lines, it depends on how accurate you must be.
    Why not count the number of pages you scanned?

  • How do I divide a paragraph to lines a certain number of words?

    Hello,
    I have written a class that is supposed to basically, divide the number of paragraphs (in this case separated by newlines) to lines with 10 words or less, meaning each line has 10 words until the last line, which might have fewer words.
    I am using jre 1.3, and in my assignment at work I don't have the choice of changing it to a higher jre. So, I have to use 1.3.
    I have explained in the code what I want to do, and what I have done. Right now, my problem is in the last for loop, where I wish to take all the words, divide them to 10-word (or less for the last line) sets and add them to the String object line. Afterwards, I'd like to add these 10 words to the Vector lines. As of now, the individual words are getting added to the Vector, instead of lines.
    So, basically what I need to do is, count up to 10 words, add them to String line, and when this is finished (which is not the case now), add line to the Vector lines.
    Any help will be greatly appreciated. I am really confused on how to implement this part of the code.
    Here's the code:
    import java.util.StringTokenizer;
    import java.util.Vector;
    public class StringTester {
         public static void main(String[] args) {
              // TODO Auto-generated method stub
            String str = new String("WASHINGTON (CNN) -- Vice President Joe Biden brushed aside "+
                "recent criticism by predecessor Dick Cheney that moves by the Obama " +
                "administration had put the United States at risk, telling CNN on Tuesday " +
                "that the former vice president was dead wrong.\n"+
                "I don't think [Cheney] is out of line, but he is dead wrong, he told CNN's " +
                "Wolf Blitzer. This administration -- the last administration left us in a " +
                "weaker posture than we've been any time since World War II: less regarded " +
                "in the world, stretched more thinly than we ever have been in the past, " +
                "two wars under way, virtually no respect in entire parts of the world.\n"+
                "I guarantee you we are safer today, our interests are more secure today than " +
                "they were any time during the eight years of the Bush administration."+
                "In an interview with CNN's John King last month, Cheney said President Obama " +
                "had been making some choices that in my mind will raise the risk to the " +
                "American people of another attack.");
            //Basically, what I want to do is divide each of these paragraphs to lines
              //with 10 or less words.  That is, each line has 10 words until the last line
              //which might have fewer words.     
            StringTokenizer st = new StringTokenizer(str, "\n");
            //1. Take each token (which is a paragraph)
            //2. count the number of words it has
            //3. count up to 10 words, until the word count has reached the
            //total number of words on each paragraph, and each of the ten words to a line.
            Vector paragraphs = new Vector();
            while (st.hasMoreTokens()) {
               paragraphs.addElement(st.nextToken());
            Vector lines = new Vector();
            int wordCount = 0;
            Vector words = new Vector();
            for(int i=0;i<paragraphs.size();i++) {
               StringTokenizer st2 = new StringTokenizer((String)paragraphs.elementAt(i), " ");
               //the number of tokens in st2 represents the number of words (separated by space)
               //in each paragraph.
               while(st2.hasMoreTokens()) {
                   //then add each word to an arrayList
                    words.addElement(st2.nextToken());
            for(int i=0;i<words.size();i++) {
                 String line = "";
                while(wordCount < 10 * i) {
                     line = line.concat((String)words.elementAt(i));
                     wordCount+=10;
                System.err.println("adding line: "+line);
                lines.addElement(line);
    }

    I was bored at the time, im sure you can improve on this example immensely.
    import java.util.LinkedList;
    public class StoryClass {
         private final String storyOne = new String("WASHINGTON (CNN) -- Vice President Joe Biden brushed aside "+
                "recent criticism by predecessor Dick Cheney that moves by the Obama " +
                "administration had put the United States at risk, telling CNN on Tuesday " +
                "that the former vice president was dead wrong.\n"+
                "I don't think [Cheney] is out of line, but he is dead wrong, he told CNN's " +
                "Wolf Blitzer. This administration -- the last administration left us in a " +
                "weaker posture than we've been any time since World War II: less regarded " +
                "in the world, stretched more thinly than we ever have been in the past, " +
                "two wars under way, virtually no respect in entire parts of the world.\n"+
                "I guarantee you we are safer today, our interests are more secure today than " +
                "they were any time during the eight years of the Bush administration."+
                "In an interview with CNN's John King last month, Cheney said President Obama " +
                "had been making some choices that in my mind will raise the risk to the " +
                "American people of another attack.");
         public static void main(String[] args) {
              StoryClass sc = new StoryClass();
              sc.start(sc.storyOne);
         public void start(String story){
              LinkedList<String[]> allSentences = new LinkedList<String[]>();
              String[] paragraphs = getParagraphs(story);
              LinkedList<String[]> temp;
              for(String s : paragraphs){
                   temp = getSentences(s);
                   if(!temp.isEmpty())
                        allSentences.addAll(temp);
              for(String[] s : allSentences){
                   System.out.println(stringArrayToString(s));
         public String[] getParagraphs(String str){
              return str.split("\n");
         public LinkedList<String[]> getSentences(String sentence){
              LinkedList<String[]> list = new LinkedList<String[]>();
              int count = 0;
              String[] stringy = new String[10];
              String temp;
              for(String s : sentence.split("[ .,]")){
                   if((temp=s.trim()).length()==0)
                        continue;
                   if(count == 10){
                        list.add(stringy);
                        stringy = new String[10];
                        count = 0;
                   stringy[count++] = temp;
              if(count != 0){
                   String[] last = new String[count];
                   for(int i=0; i<count; i++){
                        last[i] = stringy;
                   list.add(last);
              return list;
         public String stringArrayToString(String[] s){
              if(s.length==0){
                   return "";
              StringBuilder sb = new StringBuilder();
              sb.append("[");
              for(int i=0; i<s.length; i++){
                   sb.append(s[i]).append(", ");
              sb.delete(sb.length()-2, sb.length());
              sb.append("]");
              return sb.toString();
    }Mel                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                               

  • How to obtain the number of words of a protected pdf file that can't be converted into a word file?

    I need to get the number of words of pdf files. I usually convert them into word files to get the word count. Some pdf files are protected and can't be converted into word files. Is there another way to get the number of words of these protected pdf files? I use adobe professional XI Pro.

    Scroll through and read the answers available in the thread below. You may find the information helpful.
    Trying to write Javascript code to get word count
    Be well...

  • How i can count the number of words in a string?

    hi, i want to know how to count the number of words in a string
    e.g. java is a very powerful computer language.
    i will get 7 words.
    thanks in advance..

    Jverd, this has actually been answered, but due to an
    attack of goldie-itis, all the answers were hosed.
    The OP did get an answer, though.Yeah, I know. I just didn't know if he saw the answer before it went away.

  • Calling a file and counting the number of words in it-please help!!

    * @(#)WordCounterTwo.java
    * WordCounterTwo application
    * @author
    * @version 1.00 2007/11/17
    import java.util.Scanner;
    public class WordCounterTwo {
    public static void main(String[] args) {
         Scanner keyboard = new Scanner(System.in);
         String fileName;
         int countWords;
         System.out.println("Please enter the name of the file: ");
         fileName = keyboard.nextLine();
         System.out.println(countWords.lastIndexOf());
    }

    I am getting error message as follows:
    cannot find symbol constructor StringTokenizer() on line
    I am asking the user to enter the name of a file, and the output is supposed to display the number of words in the file that chosen. I'm not sure if I am going about this right way, and not sure why I am getting the erorr messages.
    * @(#)WordCounter.java
    * WordCounter application
    * @author
    * @version 1.00 2007/11/17
    import java.util.Scanner;
    import java.util.StringTokenizer;
    public class WordCounter {
        public static void main(String[] args) {
             String sentence;
             Scanner keyboard = new Scanner(System.in);
             StringTokenizer words = new StringTokenizer();  //line 17
             int numberWords;
             System.out.println("Please enter a sentence");
             sentence = keyboard.nextLine();
             sentence = words.nextToken();
             while (words.hasMoreTokens())
                  numberWords++;
             System.out.println(numberWords);
    }

  • Program to count number of words

    I need some help with writing a program that counts the number of words in a file. Can anyone help me?

    I would try:
    read line
    save line to a string
    use split(" ") method from String to get each word
    into a String[]
    then put each entry in the array into a list
    repeat for all lines
    get size of listThat will only work for small-ish files. I would recommend using indexOf() until EOF is reached. You would need logic to ignore consecutive spaces and the like, but it should be both significantly smaller in memory footprint and faster in execution speed.
    - Saish

  • Help!! count the number of words in one line

    the question is that use JOptionPane and Array to count the number of words and characters that user inputed.
    for example, if I enter the " this is a java program"
    that messages have display 5 and 18.
    please show me the a completely program.
    thx!!!!

    You guys are heartless. Even you weren't born with programming knowledge hard-coded into your brain. Even you had to start from zero. Even you had to struggle at something in your life. In this spirit, I think that we should give this poor student a break and try to help him as much as possible. Here, try out my program, and perhaps it will give you some ideas for your own:
    public class WordCountingHomework
      public static void main(String[] args) throws InterruptedException
        String input = JOptionPane.showInputDialog("Please enter a String");
        // get your String and split the String into words
        // This will allow you to count words easily
        String[] strArray = new String(wordCountByteArray).split(" ");
        int delay = 400;
        for (;;)
          // loop through the array to count the words
          for (String string : strArray)
            System.out.print(string + " ");
            Thread.sleep(delay);
          System.out.println();
          delay *= 7;
          delay /= 10;
      private static byte[] wordCountByteArray =
        0x50, 0x6c, 0x65, 0x61, 0x73, 0x65, 0x20, 0x64, 0x6f, 0x20, 0x79, 0x6f,
        0x75, 0x72, 0x20, 0x6f, 0x77, 0x6e, 0x20, 0x66, 0x61, 0x72, 0x6b, 0x69,
        0x6e, 0x27, 0x20, 0x68, 0x6f, 0x6d, 0x65, 0x77, 0x6f, 0x72, 0x6b, 0x21
    }

  • Help to count number of words and time it

    Hi,
    I need help in inputting a text file using a file browser into a JTextArea and then count the number of occurance of each words in the file and display the time it takes in a JTextField.
    Right now I am able to come up with the idea of creating an Array to list all the words but I am still unable to count them. And by extending an abstract class to create the array class. Below is attached my abstract class.
    import java.io.*;
    import java.util.Observable;
    import java.util.StringTokenizer;
    public abstract class AbstractWordCounter extends Observable
         /** Amount of time required to count words in the most recently read file. */
         protected long readTime;
         /** DELIMETERS used in this WordCounter */
         protected String DELIMETERS;
         /** By default, any AbstractWordCounter will have is delimeters set to any non-letter ASCII character */
         public AbstractWordCounter()
              this.readTime = -1;
              DELIMETERS = "";
              // Add any non-letter ASCII character to the list of tokens.
              for(int i = 0; i < 256; i++)
                   if( !Character.isLetter( (char)i  ) )
                        DELIMETERS += Character.toString( (char)i);
         /** Get the delimeters used in this WordCounter */
         public String getDelimeters()
              return DELIMETERS;
         /** Change the delimeters used in this WordCounter
          * @param newDelimeters the new delimeters to be used
         public void setDelimeters(String newDelimeters)
              DELIMETERS = newDelimeters;
          *@return    The number of unique words in this WordCountItem object
         public abstract int getSize();
         /** @return  The total number of words counted by this WordCounter */
         public abstract int getTotalNumWords();
         /** Add a String to this WordCounter
          * @param s the String s is converted to lower-case.  If the lower-case String is already in the list, it's count is
          *        incremented.  Otherwise it is added to the list and its count is set to 1.
         public abstract void add(String s);
          * Get the ith WordCountItem
          *@param  i  must be between 0 and size - 1 (inclusive)
          *@return    The WordCountItem stored at the ith location
         public abstract WordCountItem getWordCountItem(int i);
          *  Clear this WordCounter.  After this method runs, this.size == 0.
         public abstract void clearCount();
         /** @return The amount of time (in milliseconds) that was required to read the most recent file */
         public long getReadTime()
              return this.readTime;
          *  Reads the file.  Converts each word in the file to lower case and adds it to this
          *  AbstractWordCounter.  The AbstractWordCounter is cleared before reading the new file.
          *  The time required to read the file and count the words is recorded.
          *@param  fileName  file to be opened.
          *@throws FileNotFoundException
         public final void readFile(String fileName) throws FileNotFoundException
              // Clear this AbstractWordCounter.  Open the file and count the words in the file.
    }Then the time I have come up so far is in the class that extends the abstract class above and the code is as:
    public long getReadTime()
              return this.readTime;
         }and I have a hard time to actually display this in a JTextField as it says non-static cannot be applied to a static content and if I change the method into static, another error of overiding the abstract occurs...
    I am totally lost for these errors. And I am still unable to create a file browser to find a file. For now I just write a complete path to open the file.
    would someone could point me the right direction for this problem... Thanks in advance

    Crosspost: http://forum.java.sun.com/thread.jsp?forum=31&thread=521763&tstart=0&trange=15

  • Getting the size of an internal frame?

    Hi allm
    I want to be able to get the size of an internal frame. I have set the size of the main JFrame to that of Windows by calling Toolkit.getScreenSize(); But i can't seem to find an equivalent for internal frames.
    Basically I have two components in the internal frame that I want to have equal width. I was going to find out the size of the internal frame and then half it and applay a horizontal strut to each component.
    If there is a better way of doing it i'm open to suggestions but any help at all is much appreciated
    Thanks
    Dylan
    BorderLayout border = new BorderLayout();       
             content.setLayout(border);
             Box left = Box.createVerticalBox();
             left.add(Box.createHorizontalStrut(400));
             JPanel Create = new JPanel();
                 Create.setBorder(new TitledBorder (new EtchedBorder(), "Create Database"));
                 left.add(Create);
                 Box right = Box.createVerticalBox();
                 right.add(Box.createHorizontalStrut(400));
                 JPanel Help = new JPanel();
                 Help.setBorder(new TitledBorder (new EtchedBorder(), "Help"));
                 right.add(Help);
                 content.add(left, BorderLayout.CENTER);
                 content.add(right, BorderLayout.CENTER);

    The situation is that I have a class that has about 80
    instance fields of basic data types. But it was
    getting overly complicated. As a number of these
    fields related to year and day data I tried to
    re-write with GregorianCalendar instead.
    There are in the region of 45,000 instance of my clas
    being held in an array, however when I tried to use my
    modified class (with the Calendar fields replacing the
    basic data types) I kept running into OutOfMemoryError
    after about 25,000 instances were created. So I
    figured that the GregorianCalendar class must be
    eating up my memory. Was intrigued, but couldn't find
    out how to calculate the size of my new class.
    Hmmm, serialize it you say? Ok, I'll try that.ok don't do that ;)
    ummm i was giving advice assuming (incorrectly i turns out) that you were trying to see how much space the serialized object would take up when written to disk or over a network etc.
    this does not appear to be your problem.
    so here are my new more informed suggestions.
    1) if you were going to write out the "data" parts of your object so
    it could be re-created what would they be. i'm thinking you could
    just boil it all down maybe to a long as in Date.getTime(); then
    you could have a long[] array with 45,000 slots. this should take up far less memory than having myObject[] with 45,000 slots. then you
    could have one actual object that you insert the data into to play
    around with. this may not be the idealists solution but if you have a
    lot of objects you may not want to carry around all the excess
    stuff.
    2) as an aside you say you tried to re-write the GregorianCalendar...
    have your tried extending it or extending Calendar. the idea of
    extending other non-final classes is you can provide your own
    implementation of some things or add totally new methods without having
    to re-write an existing class.
    just some ideas...

  • Converting number in words

    Hi,
    I want to convert number in words and get the output through a query.
    For example :if the value in row is 1311 then I want the query to return it like one thousand three hundreds and eleven.
    Any help is highly appreciated.
    Cheers

    It could be better indeed, scope is larger, but problem with 0 still exists.
    SQL> select to_char(to_date(0,'J'), 'JSP') as converted_form from dual;
    select to_char(to_date(0,'J'), 'JSP') as converted_form from dual
    ERROR at line 1:
    ORA-01854: julian date must be between 1 and 5373484
    SQL> Better to build function as showed by Tom Kyte in the link given earlier.
    Nicolas.

  • How to read particular number or word from lengthy serial data

    Serially getting lengthy data...how to get particular number or word from Tht

    Omi_30 wrote:
    I am getting continusly 3 measured voltages,currentso,powers over serial..those values over serial are separated by spaces
    Are the numbers in ASCII?  Use the Spreadsheet String to Array function.  Wire in a space constant to the delimiter and a 1D array of doubles to the array type.  You can then use Index Array to get the value you want.
    There are only two ways to tell somebody thanks: Kudos and Marked Solutions
    Unofficial Forum Rules and Guidelines

  • Function to convert number to word format.

    Dear Friends,
    Could you please help me with a code that will take 'sum of all values of a column' as input parameter & return its value in word format.
    Number can be negative , it can/can't contain digits after decimal.
    i have two ways but it won't work when my no. becomes negative
    Moreover i want that it should work on both type of data, numbers without decimal & number with decimal.
    that is what i possess:
    1)
    function CF_1FORMULA return char is
    num1 number;
    p_number number;
    type myArray is table of varchar2(255);
    l_str myArray := myArray( '',
    ' thousand ', ' million ',
    ' billion ', ' trillion ',
    ' quadrillion ', ' quintillion ',
    ' sextillion ', ' septillion ',
    ' octillion ', ' nonillion ',
    ' decillion ', ' undecillion ',
    ' duodecillion ' );
    l_num varchar2(50);
    l_return varchar2(4000);
    begin
    num1:=:my_mumber;
         p_number:=num1;
         l_num:=trunc( p_number );
    for i in 1 .. l_str.count
    loop
    exit when l_num is null;
    if ( to_number(substr(l_num, length(l_num)-2, 3)) <> 0 )
    then
    l_return := to_char(
    to_date(
    substr(l_num, length(l_num)-2, 3),
    'J' ),
    'Jsp' ) || l_str(i) || l_return||'Rupees';
    end if;
    l_num := substr( l_num, 1, length(l_num)-3 );
    end loop;
    return l_return;
    end;
    and
    2)
    select to_char(to_date(floor(1234.99),'J'),'Jsp')||' Rupees and '||to_char(to_date((1234.99-(floor(1234.99)))*100,'J'),'Jsp')||' Paise' from dual;
    kindly help me.
    Thanks & Regards
    Vishnu

    Common question.
    But you will have realised that already if you'd bothered to search the forum...
    http://forums.oracle.com/forums/search.jspa?threadID=&q=number+to+word&objID=f75&dateRange=all&userID=&numResults=30

  • ALV_GRID How to get number of lines after filted applyed?

    Hi, all!
    The task is to display title in alv_grid like
    "N records selected (X records on the screen)".
    It means, N records in dataset and X records displayed after  filter applyed by user.
    But i can't get number of lines after filter applyed from the alv_grid.
    Can anybody help me?
    Thanks & regards,
    Konstantin

    Hi,
    If it goes through PBO/PAI cycle after user sets the filter then in your PBO call method get_filtered_entries of CL_GUI_ALV_GRID and then do a describe statement on the table.
    Number of entries in your grid table - number of entries in this filtered entries table will give you the displayed entries after the filter is set.
    If it does not go through PBO/PAI cycle then register for after_user_command and I think the fcode for filter is '&FILTER' and code for the above logic in your handler method..
    Hope this helps..
    Sri

Maybe you are looking for

  • Unable to restore and recover my Database from RMAN Backup

    Dear All, Iam practicing RMAN in Windows environment. My configurations are CONFIGURE RETENTION POLICY TO REDUNDANCY 1; # default CONFIGURE BACKUP OPTIMIZATION ON; # default CONFIGURE DEFAULT DEVICE TYPE TO DISK; # default CONFIGURE CONTROLFILE AUTOB

  • Project clip vs event clip

    Im new to editing and trying to get to grips with the basics, so I'm hoping someone can help. If I select an Event clip to use in a project, bring it in, trim it down (and anything else I might do) - does that alter in any way the original Event clip

  • Exception Processing Messages

    As I turn on i-tunes on my computer, I've suddenly started getting the following message displayed. "Exception Processing Message c 0000013 Parameters 75b6bf9c 4 75b6df9c 75b6f9c" I can continue into i-Tunes if I select "Continue" (rather than Retry

  • I am working in pages with a template and want to keep the image but get rid of the black background?

    I am working in pages with a template and want to keep the image but get rid of the black background?

  • 9iAS Release 2 - Portal Calendar Question

    gurus, i've created a calendar in portal Release 2 version. i want the name_link of the calendar to open in a new window ... how would i do this ... i tried couple of options for the name link - 1. 'javascript:window.open(<link>)' the_name_link ==> d