How to determine line count in single multiline textbox
I have data that comes out of a sql db text field that already has line breaks and paragraph breaks. I would like to determine how many lines this will be (w/ line wrapping on) so that I can say if over 20 lines font = 12 pt. etc. How do you determine how many lines there are in a multiline textbox? In .net a textbox can be called w/ .linecount to get the # of lines.
How can I accomplish this in Crystal Reports?
Any help would be appreciated.
Dave
That would work if we had full lines of Text. The problem is that we have line breaks and paragraphs which would prevent lines from being full. Here is an example:
My name is Dave.
I went to the store today and bought some bread, lunch meat, juice,
and wine.
Signed by:
David
08/01/2008
The middle section could be x lines long. But as it grows I need to shrink the font since there is a finite amount of height for the textbox.
Thanks for the idea,
Dave
Similar Messages
-
Determine line count with wordwrap without Textcomponent visible
Hi,
I read a lot of post here that contains code that return number of line occupied by a wrapped text in JTextArea/JTextPane.
However, the code only work if the text component is visible and already on screen.
What I want is calculate the number of line count of wrapped text in those component even before the component is visible.
Currenly, the line count always return 0 because component yet to display on screen.
Can someone tell me how to do this ? thanx.I've been struggling with this for JTextArea. This seems to work. tp is the JTextArea and I get width from the preferred size.
public int getLines(float width) {
View view = tp.getUI().getRootView(tp).getView(0);
view.setSize(width, (float)Short.MAX_VALUE);
int preferredHeight = (int)view.getPreferredSpan(View.Y_AXIS);
int lineHeight = tp.getFontMetrics( tp.getFont() ).getHeight();
return preferredHeight / lineHeight;
} -
How to determine line # from printstack() with cc compiler on Solaris 10
Hi,
printstack() when called produces a stack trace per the following:
/lib/libc.so.1:0xc5364
/lib/libc.so.1:0xb9e64
/platform/sun4u-us3/lib/libc_psr.so.1:memcpy+0x660 [ Signal 11 (SEGV)]
/opt_outside_local_disk/opt/zim/bin/program_name:function_name+0x160
How does one determine what the line # is in the C program for the above offset 0x160?
Thanks in advance.
JoeHi Joe,
I don't know what is the best way, but here is a 3-steps procedure to find the line.
I inserted a printstack(2) line in my program, and got this output:
/export/home/nikm/SunStudioProjects/4Queens/NQueens'main+0x711 [0x4023f9]I use Sun Studio 12 update 1 to compile my program.
It includes Performance Analyzer tools, and one of its utilities, "er_src", can help to find the line.
First of all, let's run it with "-disasm" option to find the line number, that corresponds to the address 4023f9:
nikm@OS-Dec2008:~$ er_src -disasm main /export/home/nikm/SunStudioProjects/4Queens/NQueens | grep 4023f9
[137] 4023ed: jle .+0xc [ 0x4023f9 ]
[141] 4023f9: movq 0x11280(%rip),%rsiBasically, that's it, we have the line number - it is 141.
Let's verify that this is correct:
nikm@OS-Dec2008:~$ er_src -src main /export/home/nikm/SunStudioProjects/4Queens/NQueens | grep -n '141\.'
214: 141. return total_pos;Well, it points to the line after the printstack(2) statement. Let's verify this:
nikm@OS-Dec2008:~$ er_src -src main /export/home/nikm/SunStudioProjects/4Queens/NQueens | head -214 | tail -5
137. if (debug > 0) {
138. printstack(2);
139. }
140.
141. return total_pos;
nikm@OS-Dec2008:~$ That's it. The line is 138, and printstack(2) actually points to the next line.
Thanks.
Nik
Edited by: NikMolchanov on Aug 29, 2009 10:10 PM
Edited by: NikMolchanov on Aug 29, 2009 10:11 PM -
How to determine line number on Table control in BDC
Hi,
I am uploading changes for CG02 using BDC. I have to change data to specification type which are listed in a table control having some of the fields as IDCAT, IDTYPE, LANG, ORD, IDENT etc.
For a particular substance number, there can be variable number of idtypes. Since there were 8 Idtypes already created for the substance number I was working with while recording and I created 9th Idtyep(Z_SARADOT#) while recording (Using SHBD), I am getting the code like ...'ESTRI-IDTYPE(09)....ESTRI-IDCAT(09).....'RCGRIIOT-IDENT(09)' which indicate that while recording, the values were added on 9th line of table control.
Now this line number can vary for other substance number. How can I know
(1) The last line of table control
(2) Line number based on Value of field
Example - here I want to know line number corresponding to IDTYPE Z_SARADOT# if it was created so that I can change the value of field IDENT of the table control.
The piece of code I got after recording is:
perform bdc_field using 'ESTRI-IDTYPE(09)'
'NUM'.
perform bdc_field using 'ESTRI-IDCAT(09)'
'Z_SARADOT#'.
perform bdc_field using 'RCGRIIOT-IDENT(09)'
'1175'.
Please help friends.
Thanks & Regards,
SuryaThere are around 800 Substance numbers and for each substance number there are around 10 IDtype. So It would be a costly processing.
If there no other way doing it?
I think, I need to follow this way as We can not determine the line number untill BDC is running. -
How to Determine the "Total" Page Count on HP 2575 All-in-one printer?
Looking at how to determine the "Total" Page Count on HP 2575 All-in-one printer? I've seen directions for other HP printers but can't seem to find any for the HP 2575 All-in-one printer. I am trying to find approximately how many pages my printer has printed since I've owned it. Any help is much appreciated.
The manual says you should be able to use the Embedded Web Server to view statistics.
Say thanks by clicking the Kudos Thumbs Up to the right in the post.
If my post resolved your problem, please mark it as an Accepted Solution ...
I worked for HP but now I'm retired! -
I am trying to figure out how to enter 1E23*Exp(153.08*x) on the formula line in Eval Single-Variable Scalar vi.
Thanks for your helpjust type in "exp" instead of "Exp"
Chilly Charly (aka CC)
E-List Master - Kudos glutton - Press the yellow button on the left... -
How to allocate space for headers in reports through line size r line count
hi ,
may i know how to allocate space for a header ( we do the same for footer through line-count ( footer space ) ) through line size or line count in reports...
thanks in advance..Hi..,
There is no need to reserve any space for the header. TOP-OF-PAGE can by default allocates the space for the header.
If you still having confusion just go ahead with this link. This is the research on same thing in defferent way.
[Link|lines reservation for TOP-OF-PAGE & END-OF-PAGE;
Thanks,
Naveen.I -
How to get file line count.
Hey guys,
How to get file line count very fast? I am using BufferedReader to readLine() and count. But when dealing with big file, say several GB size, this process will be very time consuming.
Is there any other methods?
Thanks in advace!What I'd do is you create an infofetcher, register a listener, implement gotMore() and have that scan for '\n'
Some might suggest getting rid of the listener/sender pattern or use multiple threads to make ii faster. This might help a little, but only if your I/O is super-duper speedy.
you are welcome to use and modify this code, but please don't change the package or take credit for it as your own work.
InfoFetcher.java
============
package tjacobs.io;
import java.io.IOException;
import java.io.InputStream;
import java.util.ArrayList;
import java.util.Iterator;
* InfoFetcher is a generic way to read data from an input stream (file, socket, etc)
* InfoFetcher can be set up with a thread so that it reads from an input stream
* and report to registered listeners as it gets
* more information. This vastly simplifies the process of always re-writing
* the same code for reading from an input stream.
* <p>
* I use this all over
public class InfoFetcher implements Runnable {
public byte[] buf;
public InputStream in;
public int waitTime;
private ArrayList mListeners;
public int got = 0;
protected boolean mClearBufferFlag = false;
public InfoFetcher(InputStream in, byte[] buf, int waitTime) {
this.buf = buf;
this.in = in;
this.waitTime = waitTime;
public void addInputStreamListener(InputStreamListener fll) {
if (mListeners == null) {
mListeners = new ArrayList(2);
if (!mListeners.contains(fll)) {
mListeners.add(fll);
public void removeInputStreamListener(InputStreamListener fll) {
if (mListeners == null) {
return;
mListeners.remove(fll);
public byte[] readCompletely() {
run();
return buf;
public int got() {
return got;
public void run() {
if (waitTime > 0) {
TimeOut to = new TimeOut(waitTime);
Thread t = new Thread(to);
t.start();
int b;
try {
while ((b = in.read()) != -1) {
if (got + 1 > buf.length) {
buf = IOUtils.expandBuf(buf);
int start = got;
buf[got++] = (byte) b;
int available = in.available();
//System.out.println("got = " + got + " available = " + available + " buf.length = " + buf.length);
if (got + available > buf.length) {
buf = IOUtils.expandBuf(buf, Math.max(got + available, buf.length * 2));
got += in.read(buf, got, available);
signalListeners(false, start);
if (mClearBufferFlag) {
mClearBufferFlag = false;
got = 0;
} catch (IOException iox) {
throw new PartialReadException(got, buf.length);
} finally {
buf = IOUtils.trimBuf(buf, got);
signalListeners(true);
private void setClearBufferFlag(boolean status) {
mClearBufferFlag = status;
public void clearBuffer() {
setClearBufferFlag(true);
private void signalListeners(boolean over) {
signalListeners (over, 0);
private void signalListeners(boolean over, int start) {
if (mListeners != null) {
Iterator i = mListeners.iterator();
InputStreamEvent ev = new InputStreamEvent(got, buf, start);
//System.out.println("got: " + got + " buf = " + new String(buf, 0, 20));
while (i.hasNext()) {
InputStreamListener fll = (InputStreamListener) i.next();
if (over) {
fll.gotAll(ev);
} else {
fll.gotMore(ev);
InputStreamListener.java
====================
package tjacobs.io;
public interface InputStreamListener {
* the new data retrieved is in the byte array from <i>start</i> to <i>totalBytesRetrieved</i> in the buffer
public void gotMore(InputStreamEvent ev);
* reading has finished. The entire contents read from the stream in
* in the buffer
public void gotAll(InputStreamEvent ev);
InputStreamEvent
===============
package tjacobs.io;
* The InputStreamEvent fired from the InfoFetcher
* the new data retrieved is from <i>start</i> to <i>totalBytesRetrieved</i> in the buffer
public class InputStreamEvent {
public int totalBytesRetrieved;
public int start;
public byte buffer[];
public InputStreamEvent (int bytes, byte buf[]) {
this(bytes, buf, 0);
public InputStreamEvent (int bytes, byte buf[], int start) {
totalBytesRetrieved = bytes;
buffer = buf;
this.start = start;
public int getBytesRetrieved() {
return totalBytesRetrieved;
public int getStart() {
return start;
public byte[] getBytes() {
return buffer;
ParialReadException
=================
package tjacobs.io;
public class PartialReadException extends RuntimeException {
public PartialReadException(int got, int total) {
super("Got " + got + " of " + total + " bytes");
} -
How to determine fixed line of table control using BDC program ?
Dear All,
I create program using BDC that contains table control.
Unfortunately the table control line of BDC program will depend on the resolution of our PC setting.
Sometime I have 2 lines, sometime 3 lines (in different PC).
How to determine fixed line of table control?
So it will never be confusing me whether I have 2 or 3 lines.
Thnx - Regards,
(Taufik K.)Hi Taufik,
Check the table CTU_PARAMS and field DEFSIZE for setting fixed line of a table control.
CALL TRANSACTION 'VA01' USING it_bdcdata
OPTIONS FROM OPT
MESSAGES INTO it_mesg.
opt of type ctu_params.
WA_CTU_PARAMS-DISMODE = 'N'. "no screen mode
WA_CTU_PARAMS-UPDMODE = 'S'. "synchronus update
WA_CTU_PARAMS-NOBINPT = 'X'.
WA_CTU_PARAMS-NOBIEND = 'X'.
WA_CTU_PARAMS-DEFSIZE = 'X'. "Default size
Default size will play good role in terms of resoultion. in one system in table control you can see 10rows, but in others system it will show 20 records. it depends on resoultion. but when you set the default size then it will take same (default screen size) in all the systems when you run BDC.
Reward if helps.
Regards,
Senthil
Message was edited by: senthil kumar -
How to remove dotted lines in a single column using javascript?
Hi,
In InDesign document,i want to remove the dotted lines in a single column using javascript.here i want to remove only the dotted lines has presented at the end of text in a cell.kindly help me if anyone has idea regarding this.
Thanks in advance!
Vimala LHi,
Those dotted lines have added in the document by manually. The dotted lines have presented in all the columns but in a single column i need to remove it.
Thanks,
Vimala L -
How to get logical JTextArea line count
Hi,
I would like to get the logical JTextArea line count. The existing
getLineCount method returns the line count based on "\n", which
is not what I want.
Any ideas?
Thanks,
PinI found the following solution in the forum and it works.
I haven't tested for all cases though...
public static int getLineCount (JTextArea _textArea)
boolean lineWrapHolder = _textArea.getLineWrap();
_textArea.setLineWrap(false);
double height = _textArea.getPreferredSize().getHeight();
_textArea.setLineWrap(lineWrapHolder);
double rowSize = height/_textArea.getLineCount();
return (int) (_textArea.getPreferredSize().getHeight() / rowSize);
Thanks,
Pin -
How to determine count for the number of rows
Appreciate if any of you could think of a way of determining the count for the number of rows in the subquery without having to run another query.
SELECT *FROM
(SELECT rownum, rn, rlp_id, rlp_notes, cad_pid, status, jurisdiction_id, s.state_abbr, rlp_address, rlp_route_id, rlp_route_section, psma_version FROM ipod.relevant_land_parcels r, state s WHERE s.state_pid = r.state_pid(+) AND rlp_route_id = 'SM1' AND status = 'CURRENT')WHERE rn > 200 AND rn < 216
And I want to import this into.net and C# environment.Something like this,.....????
SQL> select * from emp;
EMPNO ENAME JOB MGR HIREDATE SAL COMM DEPTNO
7369 SMITH CLERK 7902 17/12/1980 800,00 20
7499 ALLEN SALESMAN 7698 20/02/1981 1600,00 300,00 30
7521 WARD SALESMAN 7698 22/02/1981 1250,00 500,00 30
7566 JONES MANAGER 7839 02/04/1981 2975,00 20
7654 MARTIN SALESMAN 7698 28/09/1981 1250,00 1400,00 30
7698 BLAKE MANAGER 7839 01/05/1981 2850,00 30
7782 CLARK MANAGER 7839 09/06/1981 2450,00 10
7788 SCOTT ANALYST 7566 19/04/1987 3000,00 20
7839 KING PRESIDENT 17/11/1981 5000,00 10
7844 TURNER SALESMAN 7698 08/09/1981 1500,00 0,00 30
7876 ADAMS CLERK 7788 23/05/1987 1100,00 20
7900 JAMES CLERK 7698 03/12/1981 950,00 30
7902 FORD ANALYST 7566 03/12/1981 3000,00 20
7934 MILLER CLERK 7782 23/01/1982 1300,00 10
14 rows selected
SQL>
SQL> select max(rw) from
2 (
3 select empno , row_number () over (order by empno) rw from emp
4 where job='CLERK'
5 )
6 /
MAX(RW)
4Greetings...
Sim -
How to determine most recent date from the date column of internal table
Dear friends
would you like to tell me. how i determine the most recently changed record by looking at date and time from internal table i am not supposed to sort the table by date and time... I must check date and time with other records date and time to determine which record is most recently changed...
here the scenario is.
id idnumber chdate chtime
1 123456 20060606 135312
2 123456 20060606 135900
3 123456 20060606 132300
4 123457 20060606 140000
5 123457 20060606 142500
in the above scenario i must keep in my mind that the most recently changed record is identical to its idnumber i can say that:
the record should be fetched this way
id idnumber chdate chtime
3 123456 20060606 132300
5 123457 20060606 142500
because here the id 3 is the most recently changed in the idnumber 123456
where id 5 is the most recently changed in the idnumber 123457
please help me to determin how i am supposed to carry out this task any suggestion, code will be great help of mine.
regards
NaimAfter testing my suggestion above, I realized that it doesn't work because the delete adjacent actually will keep the first one and delete the rest. I'm working with Srinivas's code a bit now, I think it is almost what you want. I am under the impression that you dont' want to HIGHest date/time, but just the last record of the sequence, if this is the case, then this code will help. Here we will assign an index to each record per the idnumber, that way we can sort it and get the lastest record.
report zrich_0001.
types: begin of itab_type,
id type i,
idnumber type i,
chdate like sy-datum,
chtime like sy-uzeit.
types: end of itab_type.
types: begin of itab_type2,
id type i,
idnumber type i,
index type i,
chdate like sy-datum,
chtime like sy-uzeit.
types: end of itab_type2.
data: itab type table of itab_type with header line,
itab2 type table of itab_type2 with header line,
prev_rec type itab_type.
data: v_id type i.
start-of-selection.
itab-id = 1.
itab-idnumber = 123456.
itab-chdate = '20060606'.
itab-chtime = '135312'.
append itab. clear itab.
itab-id = 2.
itab-idnumber = 123456.
itab-chdate = '20060606'.
itab-chtime = '135900'.
append itab. clear itab.
itab-id = 3.
itab-idnumber = 123456.
itab-chdate = '20060606'.
itab-chtime = '142500'.
append itab. clear itab.
itab-id = 4.
itab-idnumber = 123457.
itab-chdate = '20060606'.
itab-chtime = '140000'.
append itab. clear itab.
itab-id = 5.
itab-idnumber = 123457.
itab-chdate = '20060606'.
itab-chtime = '120000'.
append itab.
clear itab.
<b> data: counter type i.
* Assign an index to each row per idnumber
loop at itab.
on change of itab-idnumber.
if sy-tabix > 1.
clear counter.
endif.
endon.
clear itab2.
move-corresponding itab to itab2.
counter = counter + 1.
itab2-index = counter.
append itab2.
endloop.
* Sort it and get rid of older records.
sort itab2 by idnumber ascending
index descending.
delete adjacent duplicates from itab2 comparing idnumber.</b>
read table itab2 with key idnumber = '123456'.
write:/ itab2-chdate, itab2-chtime.
read table itab2 with key idnumber = '123457'.
write:/ itab2-chdate, itab2-chtime.
Regards,
Rich Heilman -
To determine the count when range is present in the select option
hai!
i want to know how we can determine the count(number of values) when range is present in the select option.
helpful answers will be rewarded.
thanks & regards,
raghavendra kulkarni.refer my reply in the other thread
select <field>
from <master table>
into table itab
where <key field> in <range/select-option> .
describe table itab lines v_lines.
or
count = sy-dbcnt.
Regards,
ravi -
Multiple small stories with variable line counts assigned to different editors
I have a "best practice" question for you more experienced InCopy users about what workflow you recommend for my specific issue. I am experienced in InDesign, but am a InCopy newbie. I want to make sure I'm not missing a solution because my lack of experience with InCopy may be causing me not to see the forest for the trees.
Short version: What is the best way to allow multiple editors access to each of multiple small stories separately (one story per editor), but to allow the line count of each story to be variable each week, while adjusting the rest of the stories along with it on the page (see image below)?
Details: My publishing company's workflow is on CS6 with editors working in Word, and we're upgrading to CC2014 with InCopy. We have 7 in-house editors, and all files on an in-house server. We have quick deadlines (some are 15 minutes from editor writing copy to transmitting publication to subscribers). In the example below, we have 10 sections, and I have all seven editors writing different sections at the same time. A final editor has control over fitting the final page. My INDD files to test the new workflow use an assignment-based workflow. I understand I can place each of these sections as their own story, under the same assignment, so a different editor can have them checked out. However, each section does not have the same line count from week to week. Markets with more activity will get more lines.
In our current workflow, we have multiple rough Word docs pulled into one master doc with a script, that the final editor edits to fit, so each section can be a different number of lines as long as the total is the same. Then production staff load it in. When we upgrade, we can use a hybrid workflow where the final editor just loads that final Word doc into one InCopy story and edits it to fit.
It would be great if I just didn't understand how to make the text height variable for the story each editor is typing, and auto-adjust so the next story starts below where the story above it ends, and you all had an idea how I can do it!
Thanks! NancyI disagree to Seshu's answer to question 1.
Correct answer of question 1 is C and <u><b>not A.</b></u>
Sorry I didn't find time to check the rest.
<u>To the examinee</u>
I wouldn't assume all answers from SDN-ers are correct if my certification exam was knocking the door! I would rather try and find out the correct answers myself from the system instead of mugging these answers without any understanding of the technology involved! Find out the answers yourself from the system...that way it will help you to understand why the answer is 'C' and not 'A'...just knowing the answer is 'C' is not good enough...one has to understand "why" its 'C' and not 'A'. Hope you get my point! Good luck.
Maybe you are looking for
-
My itunes won't open as it says it has been installed incorrectly. It can't find MSVCR80.dll. Help! I tunes was not installed correctly . Please reinstall. Error 7 (Windows error 126) i have tried uninstalling itunes and reinstalling but itunes won't
-
How do I get my iWork'09 3rd party Keynote themes into Keynote 6.0?
1. I had iWork '09 installed on my computer from the old installation disk. It was not clear at the keynote that I would receive the updates for free as I already owned them. I was expecting to see the updates when I opened up the App Store, but t
-
Flashing question mark with added frustration
I have a Mac Book Pro 17inch, 6 months old. After 3 months it had to go off for a new hard drive because the original simply stopped working. I've had it back for 4 weeks and today the spinning wheel appeared, I shut down with the power key, tried to
-
Third-Party Application for Historical Reporting
As we migrate from our current version of UCCX Premium 7.0(1)SR05ES06_Build063 to version 8.5. We will be migrating the data over to new hardware. We are concerned about reporting. We currently have a lot of custom reports and we are uncertain how
-
I am working on a Siteminder co-existance/swap out. This has worked well so far with a custom auth module set to check for sm_user header and the Siteminder Agent for Web Server 6.1 protecting the amserver web-app. I have however come across a proble