TextLineList usage?

TextLineList usage?

Forum member · Jan 17, 2007
Here is the problem I am trying to solve: I have a utility method that calls Font.getTextLines() and returns to me a TextLineList. I am assuming that the TextLineList will jam as many words as possible onto each TextLine, up to the width (provided in the method call). However, there is no way to access each line from the TextLineList class ???? Is there some other way to do what I am looking for?

Re: TextLineList usage?

Support · Jan 18, 2007
Hello, Are trying to access the text on each line using the TextLineList class? If yes, it is not possible to access the text on each line. In that case you can use Label page element and set the width of the Label equal to the required width to fit the text. You can find out the width required to fit certain text using the getTextWidth() method of the font class which takes the string and the font size. If the text is going to be multiple lines, then you can use the TextArea page element and based on the text, you can find out the height required to fit the text using the getRequriedHeight() method and then reset the height of the TextArea. Thanks, ceTe Software Support Team

Re: TextLineList usage?

Forum member · Jan 18, 2007
Is there a way, given a big String and a width, to break that text into a collection of lines -- where each line would contain the max chars that could be fitted on each line (for the given width)?

Re: TextLineList usage?

Support · Jan 18, 2007
Hello, Yes, you can use the TextArea page element and add the string to the TextArea. You can define the width for the TextArea and it will behave exactly similar to what you are looking for. Following is the link to the Help Documentation on our web site that shows use of TextArea page element. Thanks, ceTe Software Support Team

Re: TextLineList usage?

Forum member · Jan 18, 2007
Questions on TextArea: I create a text area of a specific size, add a bunch of text to it. * I can call getOverflowText() to get the text that will *not* be visible given the TextArea size, correct? If not, how can I get this? * Can I then call getText() to get only the text that will be displayed in the TextArea? If not, how can I get this? thanks scott

Re: TextLineList usage?

Support · Jan 18, 2007
Hello Scott, Yes, if the text does not fit within the defined size of the TextArea you can capture the overflow text using the getOverflowTextArea() method. Following is the code snippet to add the overflow text: TextArea textArea = new TextArea(myText.toString(), 0, 0, 200, 200); do { Page page = new Page(); page.getElements().add(textArea); document.getPages().add(page); textArea = textArea.getOverflowTextArea(); } while (textArea != null); Thanks, ceTe Software Support Team

Re: TextLineList usage?

Forum member · Jan 18, 2007
>> Yes, if the text does not fit within the defined size of the >> TextArea you can capture the overflow text using the >> getOverflowTextArea() method. I am NOT looking for the TextArea, I am looking for the String. My question was: Can I call getOverflowText() to get the *String* that will *not* be visible given the TextArea size? If not, how can I get this? I also need the *String* that *will* be visible -- that does *not* include the *String* returned from getOverflowText() -- how can I get this? For example, here is a String: "I`m really am not in a position to describe the mechanics of the orders and to get into the details,' said one, 'Because it really does say something about the intelligence activities involved. But I will say that the probable-cause determinations we`re talking about are subject to review and approval by the (court).'" So lets say that only the first sentence will fit in the area defined. TextArea thisPage = new TextArea(hpi, 0, 0, pageWidth, remainingHeight, font, fontSize); String overflow = thisPage.getOverflowText(); When I call ta.getOverflowText() I want the following returned: "But I will say that the probable-cause determinations we`re talking about are subject to review and approval by the (court).'" Then, I want to call a method to get the text that IS visible in the area defined -- which in this example would be the following: "I`m really am not in a position to describe the mechanics of the orders and to get into the details,' said one, 'Because it really does say something about the intelligence activities involved." Is there a solution to this problem? >> Following is the code snippet to add the overflow text: This is not the solution I am looking for, I am not doing the whole overflow thing here. I do not want a PageElement and I do not have access to the Page. I want the *String*

Re: TextLineList usage?

Support · Jan 18, 2007
Hello Scott, In order to get the remaining string you will have to use the getOverflowText() method of the TextArea page element which returns the remaining text that does not fit the mail TextArea. What results do you get when using the getOverflowText() method? Thanks, ceTe Software Support Team