[JS] [CS3] Finding the longest instance of a paragraph style

I'm pretty new to JS but I'm trying to write a script that will return the longest instance of each paragraph style in a manuscript (which has been imported into InDesign). Currently, my script lists all the paragraph styles found in the document and puts them in a new document. My next thought was to loop through the style names array and find the longest instance.
Could anyone point me in the right direction on how to do this?
Any help is much appreciated. I'm learning a lot reading this forum.

Your question is slightly ambiguous. Do you mean you are looking for the longest instance of a paragraph in that paragraph style? That's the most likely meaning. Or are you looking for the longest run of text in that style? Because that's what you'll find if you're not careful in your script.
The essence of the script would be:
1. Setup a FindText for the paragraph style in question (or each style if you're looping through them all).
setupFindText(); // use function to setup the find -- search this forum on setupFindText to find it
app.findTextPreferences.appliedParagraphStyle = myStyle; // where myStyle is the style in question
2. Issue the find getting all the references into a variable.
var myFinds = app.documents[0].findText();
3. Loop through all the finds to locate the longest paragraph.
var longestLength = 0;
var longestPara = null;
for (var j = myFinds.length - 1; j >= 0; j--) {
     myParas = myFinds[j].paragraphs;
     for (var k = myParas.length - 1; k >= 0; k--) {
          myPara = myParas[k];
          if (myPara.length > longestLength) {
               longestLength = myPara.length;
               longestPara = myPara;
4. Make sure that longestPara is not null (no instances found); If not, then longestPara is a reference to the longest instance
Dave

Similar Messages

  • I need help writing a script that finds the first instance of a paragraph style and then changes it

    I need help writing a script that finds the first instance of a paragraph style and then changes it to another paragraph style.  I don't necessarily need someone to write the whole thing, by biggest problem is figuring how to find just the first instance of the paragraph style.  Any help would be greatly appreciated, thanks!

    Hi,
    Do you mean first instance of the paragraph style
    - in a chosen story;
    - on some chosen page in every text frames, looking from its top to the bottom;
    - in a entire document, looking from its beginning to the end, including hidden layers, master pages, footnotes etc...?
    If story...
    You could set app.findTextPreferences.appliedParagraphStyle to your "Style".
    Story.findText() gives an array of matches. 1st array's element is a 1st occurence.
    so:
    Story.findText()[0].appliedParagraphStyle = Style_1;
    //==> this will change a paraStyle of 1st occurence of story to "Style_1".
    If other cases...
    You would need to be more accurate.
    rgds

  • How to find the longest record in a table?

    Hello,
    Is there a function to find the longest record in a table? Or is there a data dictionary that would tell you which record contains the longest data?
    I have a table with five columns and one million records. I want to find the record (5 columns combined) with the longest data. Thank you.

    Dear watson2000!
    The function "VSIZE" tells you the number of bytes in the internal representation of a column which means the size of a value within a column. An example of vsize can be found here:
    [http://www.adp-gmbh.ch/ora/sql/vsize.html]
    So I think you should try it with this query to get the size of the longest record:
    SELECT MAX(VSIZE(column1)) +
           MAX(VSIZE(column2))  +
           MAX(VSIZE(column3))  +
           MAX(VSIZE(column4))  +
           MAX(VSIZE(column5)) AS "Maximum Row"
    FROM your_table;To identify the longest record try like this:
    SELECT rowid
    FROM   your_table
    GROUP BY rowid
    HAVING  (MAX(VSIZE(column1)) +
             MAX(VSIZE(column2)) +
             MAX(VSIZE(column3)) +
             MAX(VSIZE(column4)) +
             MAX(VSIZE(column5))) = (SELECT MAX(VSIZE(column1)) +
                                          MAX(VSIZE(column2))  +
                                          MAX(VSIZE(column3))  +
                                          MAX(VSIZE(column4))  +
                                          MAX(VSIZE(column5))
                                   FROM your_table;)I hope that these two queries could be of help to you.
    yours sincerely
    Florian W.
    Edited by: Florian W. on 23.04.2009 20:53

  • How to Find the Current Instance Id in Oracle 10g

    Hi,
    how to find the current instance id in oracle 10g studio,
    I have the below code :
    if (InstanceScreenFlow.processInstance.id.id.indexOf(text : ins.id) < 0) {
    /// do something
    it is saying that "'processInstance' is not a function"
    Thanks,
    Brijesh Kumar Singh.

    Why not just pass in the "id" predefined variable into your screenflow? Once you do that you'll be able to refer to it as "id.id" anywhere inside your screenflow.
    Dan

  • In which folder can I find the abap instance profile?

    Hi,
    In which folder can I find the abap instance profile?
    This is the parameter that I want to change:
    "profile parameter em/address_space_MB = 250 in the instance profile"
    Greets
    Stefan

    Hi Michal,
    my actual problom is, that during the Java-Add-In-Installation an error appears. (CJS-20057)
    j2ee-engine (dvebmgs00) do not start during this installation.
    I also change the value of max. heap size and try a rebase as it is shown in note 129813.
    nothing chances.
    this error appears all the time.
    can anybody help me please?
    Thanks.
    Greets
    Stefan

  • Cannot find the specified instance ???

    "If the instance has recently been initiated, the invocation data may not have been delivered to the engine yet. Refresh your browser window or try again in a few seconds."
    I am getting the above error when i try to execute a BPEL process that does some DML operation on the database.
    I doubt whether this relates to the database.
    Please suggest.
    Thanks,
    Rosh

    Hi Marcelo!
    I'm having the exact same problem. I've upgraded AS and BPEL PM from 10.1.3.1 to 10.1.3.3 As I found out in another thread (Cannot find the specified instance the problem could be in not running the upgrade sql script, but I did that.
    When I initiate my process the number of Open Instances and closed instances remains 0. I've tried by deploying my process to default domain and a new domain I've created but it doesn't matter.
    The message in my domain.log file is this:
    <2008-01-22 13:52:32,976> <WARN> <MyTestDomain.collaxa.cube> <BaseCubeSessionBean::logWarning> Error while invoking bean "finder": [com.collaxa.cube.engine.core.InstanceNotFoundException: Instance not found in datasource.
    The process domain was unable to fetch the instance with key "fa5790576a57cd77:-67b0033:117a188c804:-7fea" from the datasource.
    Please check that the instance key "fa5790576a57cd77:-67b0033:117a188c804:-7fea" refers to a valid instance that has been started and not removed from the process domain.
    ORABPEL-02152
    Instance not found in datasource.
    The process domain was unable to fetch the instance with key "fa5790576a57cd77:-67b0033:117a188c804:-7fea" from the datasource.
    Please check that the instance key "fa5790576a57cd77:-67b0033:117a188c804:-7fea" refers to a valid instance that has been started and not removed from the process domain.
         at com.collaxa.cube.engine.data.AdminFinder.lookupInstanceByConversationId(AdminFinder.java:287)
         at com.collaxa.cube.ejb.impl.FinderBean.lookupInstanceByConversationId(FinderBean.java:200)
         at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method)
         at sun.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:39)
         at sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:25)
         at java.lang.reflect.Method.invoke(Method.java:585)
         at com.evermind.server.ejb.interceptor.joinpoint.EJBJoinPointImpl.invoke(EJBJoinPointImpl.java:35)
         at com.evermind.server.ejb.interceptor.InvocationContextImpl.proceed(InvocationContextImpl.java:119)
         at com.evermind.server.ejb.interceptor.system.DMSInterceptor.invoke(DMSInterceptor.java:52)
         at com.evermind.server.ejb.interceptor.InvocationContextImpl.proceed(InvocationContextImpl.java:119)
         at com.evermind.server.ejb.interceptor.system.JAASInterceptor$1.run(JAASInterceptor.java:31)
         at com.evermind.server.ThreadState.runAs(ThreadState.java:646)
         at com.evermind.server.ejb.interceptor.system.JAASInterceptor.invoke(JAASInterceptor.java:34)
         at com.evermind.server.ejb.interceptor.InvocationContextImpl.proceed(InvocationContextImpl.java:119)
         at com.evermind.server.ejb.interceptor.system.TxNotSupportedInterceptor.invoke(TxNotSupportedInterceptor.java:43)
         at com.evermind.server.ejb.interceptor.InvocationContextImpl.proceed(InvocationContextImpl.java:119)
         at com.evermind.server.ejb.interceptor.system.DMSInterceptor.invoke(DMSInterceptor.java:52)
         at com.evermind.server.ejb.interceptor.InvocationContextImpl.proceed(InvocationContextImpl.java:119)
         at com.evermind.server.ejb.InvocationContextPool.invoke(InvocationContextPool.java:55)
         at com.evermind.server.ejb.StatelessSessionEJBObject.OC4J_invokeMethod(StatelessSessionEJBObject.java:87)
         at FinderBean_RemoteProxy_4bin6i8.lookupInstanceByConversationId(Unknown Source)
         at com.oracle.bpel.client.Locator.lookupInstance(Locator.java:448)
         at displayInstance.jspService(_displayInstance.java:123)
         at com.orionserver.http.OrionHttpJspPage.service(OrionHttpJspPage.java:59)
         at oracle.jsp.runtimev2.JspPageTable.service(JspPageTable.java:462)
         at oracle.jsp.runtimev2.JspServlet.internalService(JspServlet.java:594)
         at oracle.jsp.runtimev2.JspServlet.service(JspServlet.java:518)
         at javax.servlet.http.HttpServlet.service(HttpServlet.java:856)
         at com.evermind.server.http.ResourceFilterChain.doFilter(ResourceFilterChain.java:65)
         at oracle.security.jazn.oc4j.JAZNFilter$1.run(JAZNFilter.java:396)
         at java.security.AccessController.doPrivileged(Native Method)
         at javax.security.auth.Subject.doAsPrivileged(Subject.java:517)
         at oracle.security.jazn.oc4j.JAZNFilter.doFilter(JAZNFilter.java:410)
         at com.evermind.server.http.ServletRequestDispatcher.invoke(ServletRequestDispatcher.java:623)
         at com.evermind.server.http.ServletRequestDispatcher.forwardInternal(ServletRequestDispatcher.java:370)
         at com.evermind.server.http.ServletRequestDispatcher.unprivileged_forward(ServletRequestDispatcher.java:259)
         at com.evermind.server.http.ServletRequestDispatcher.access$100(ServletRequestDispatcher.java:51)
         at com.evermind.server.http.ServletRequestDispatcher$2.oc4jRun(ServletRequestDispatcher.java:193)
         at oracle.oc4j.security.OC4JSecurity.doPrivileged(OC4JSecurity.java:283)
         at com.evermind.server.http.ServletRequestDispatcher.forward(ServletRequestDispatcher.java:198)
         at com.collaxa.cube.fe.DomainFilter.doFilter(DomainFilter.java:131)
         at com.evermind.server.http.EvermindFilterChain.doFilter(EvermindFilterChain.java:15)
         at oracle.security.jazn.oc4j.JAZNFilter$1.run(JAZNFilter.java:396)
         at java.security.AccessController.doPrivileged(Native Method)
         at javax.security.auth.Subject.doAsPrivileged(Subject.java:517)
         at oracle.security.jazn.oc4j.JAZNFilter.doFilter(JAZNFilter.java:410)
         at com.evermind.server.http.ServletRequestDispatcher.invoke(ServletRequestDispatcher.java:621)
         at com.evermind.server.http.ServletRequestDispatcher.forwardInternal(ServletRequestDispatcher.java:370)
         at com.evermind.server.http.HttpRequestHandler.doProcessRequest(HttpRequestHandler.java:871)
         at com.evermind.server.http.HttpRequestHandler.processRequest(HttpRequestHandler.java:453)
         at com.evermind.server.http.AJPRequestHandler.run(AJPRequestHandler.java:302)
         at com.evermind.server.http.AJPRequestHandler.run(AJPRequestHandler.java:190)
         at oracle.oc4j.network.ServerSocketReadHandler$SafeRunnable.run(ServerSocketReadHandler.java:260)
         at com.evermind.util.ReleasableResourcePooledExecutor$MyWorker.run(ReleasableResourcePooledExecutor.java:303)
         at java.lang.Thread.run(Thread.java:595)
    I'd appreciate any suggestions on this.
    Thanks!
    BB

  • Improve the implementation of graphic and paragraph styles

    The implementation of Graphic and Paragraph Styles should be more consistent:
    You can currently edit the attributes of paragraph styles (e.g., point size) but not of graphic styles (outer glow). With graphic styles, you have to overwrite the existing style rather than edit it.
    Graphic Styles have the concept of "breaking the link" whereas Paragraph Styles don't.
    Add the ability to select objects based on a paragraph style (yes, you can select based on Attribute, but not all objects with a specific paragraph style).
    Combine graphic and paragraph styles. For example, I want a style with a 12 pt font and an outer glow.

    Same thing happening here.
    You can though first create some type with a 12 point stroke , then define a new paragraph style, and even though it says 10pt will apply 12pt.
    If you have not looked into graphic styles, that might be a better option for stokes. You can
    Move the fill on top of the stroke (allows you to use a different color for stroke, so the orignal sahep of type doe not get squeezed)
    Use multiple strokes aroudn type
    Set the corner options to round
    For appearance & graphic style, the secret to type is to first set your type fill and stroke to none (this removes the stylization at the character level), then apply strokes and fills in the appearance palette at the type level only. This way the stylization won't fight with each other.

  • Sort by or find the longest word in a varchar2 field

    Oracle Database 10g Enterprise Edition Release 10.2.0.4.0 - 64bi
    PL/SQL Release 10.2.0.4.0 - Production
    CORE     10.2.0.4.0     Production
    TNS for HPUX: Version 10.2.0.4.0 - Production
    NLSRTL Version 10.2.0.4.0 - Production
    drop table event;
    create table event  (event_title_nm varchar2(1000));
    SET DEFINE OFF;
    Insert into EVENT
       (EVENT_TITLE_NM)
    Values
       ('CREATING A NEW CLASS WORD FOR INDICATOR, - _IN');
    Insert into EVENT
       (EVENT_TITLE_NM)
    Values
       ('Unknown Title');
    Insert into EVENT
       (EVENT_TITLE_NM)
    Values
       ('MASAL REASON TEXT');
    Insert into EVENT
       (EVENT_TITLE_NM)
    Values
       ('Note/Attachment Modifications and Amendments');
    Insert into EVENT
       (EVENT_TITLE_NM)
    Values
       ('Installation (replaces change request  66)');
    Insert into EVENT
       (EVENT_TITLE_NM)
    Values
       ('Unknown Title');
    Insert into EVENT
       (EVENT_TITLE_NM)
    Values
       ('Installation (replaces change request  66)');
    Insert into EVENT
       (EVENT_TITLE_NM)
    Values
       ('List Item Identifier Change');
    Insert into EVENT
       (EVENT_TITLE_NM)
    Values
       ('USER_ID in WORKFLOW_TASK_ASSIGNMENT');
    COMMIT;I would like to select or order by the length of the longest word in the field
    word defined as continous characters.
    so my output would be for the first two returned
    event_title_nm
    USER_ID in WORKFLOW_TASK_ASSIGNMENT
    Note/Attachment Modifications and Amendmentsbecause WORKFLOW_TASK_ASSIGNMENT is the largest word
    and Note/Attachment is the second largest.
    the reason I was trying to find thiis is that I'm displaying this value on a web page and I need to figure out the longest
    continuous word because the css will not wrap a the text in the middle of a word. so it ends up pushing my entire div below where I would like it to go.
    Edited by: pollywog on Oct 25, 2011 8:43 AM

    pollywog wrote:
    Oracle Database 10g Enterprise Edition Release 10.2.0.4.0 - 64bi
    PL/SQL Release 10.2.0.4.0 - Production
    CORE     10.2.0.4.0     Production
    TNS for HPUX: Version 10.2.0.4.0 - Production
    NLSRTL Version 10.2.0.4.0 - Production
    drop table event;
    create table event  (event_title_nm varchar2(1000));
    SET DEFINE OFF;
    Insert into EVENT
    (EVENT_TITLE_NM)
    Values
    ('CREATING A NEW CLASS WORD FOR INDICATOR, - _IN');
    Insert into EVENT
    (EVENT_TITLE_NM)
    Values
    ('Unknown Title');
    Insert into EVENT
    (EVENT_TITLE_NM)
    Values
    ('MASAL REASON TEXT');
    Insert into EVENT
    (EVENT_TITLE_NM)
    Values
    ('Note/Attachment Modifications and Amendments');
    Insert into EVENT
    (EVENT_TITLE_NM)
    Values
    ('Installation (replaces change request  66)');
    Insert into EVENT
    (EVENT_TITLE_NM)
    Values
    ('Unknown Title');
    Insert into EVENT
    (EVENT_TITLE_NM)
    Values
    ('Installation (replaces change request  66)');
    Insert into EVENT
    (EVENT_TITLE_NM)
    Values
    ('List Item Identifier Change');
    Insert into EVENT
    (EVENT_TITLE_NM)
    Values
    ('USER_ID in WORKFLOW_TASK_ASSIGNMENT');
    COMMIT;I would like to select or order by the length of the longest word in the field
    word defined as continous characters.
    so my output would be for the first two returned
    event_title_nm
    USER_ID in WORKFLOW_TASK_ASSIGNMENT
    Note/Attachment Modifications and Amendmentsbecause WORKFLOW_TASK_ASSIGNMENT is the largest word
    and Note/Attachment is the second largest.
    the reason I was trying to find thiis is that I'm displaying this value on a web page and I need to figure out the longest
    continuous word because the css will not wrap a the text in the middle of a word. so it ends up pushing my entire div below where I would like it to go.
    Edited by: pollywog on Oct 25, 2011 8:43 AMORDER BY LENGTH(EVENT_TITLE_NM)

  • Installer cannot find the database instance

    I am installing SCSM 2012 R2, but when I try to connect to the database it gives incorrect instance names. We have two instances, one is the default and one is a named instance. But instead of showing the named instance name it says "Default2".
    Its exactly what's happening in this blog:
    http://adinermie.wordpress.com/2014/03/26/service-manager-2012-r2-installation-fails-to-identify-sql-server-instance-and-throws-access-denied-error/
    Even in the setup logs it is listing instances that are incorrect. It says "ServerName\ServerName, port" instead
    of "ServerName\InstanceName, Port".  The blog author didn't have a real solution except to re-install SQL.
    Is this a bug? And suggestions?
    - Get on the floor, do that dinosaur

    I ran the command line install and it was successful.
    I created the same circumstances in my lab while the install was going to see if I could re-create the situation, and I did. It appears that the GUI installer gets confused by the name of the named instance - MSSQLSERVER2. In the drop down it shows Default2
    and the error is "Access to SQLServer\SQLServer2 is denied." So I'm guessing that the installer just sees the MSSQLSERVER portion of MSSQLSERVER2, assumes its a default instance and looks for the server named instance which doesn't exist rather than the named
    instance.
    Bottom line is that the installer has a few kinks.
    - Get on the floor, do that dinosaur

  • [JS CS3] Referencing a missing font in a paragraph style

    I'm stuck on trying to figure out how to reference a font name in a paragraph style if the font is missing. I've got:<br /><br />for (myCounter=0; myCounter<app.documents.item(0).paragraphStyles.length; myCounter ++) {<br />   myParagraphStyle=app.documents.item(0).paragraphStyles.item(myCounter);<br />   if (myParagraphStyle.name.indexOf("[")!=0){<br />      if (myParagraphStyle.appliedFont.name == myFindFontName){<br />         myParagraphStyle.appliedFont = app.fonts.item(myChangeFontName);                            }}}<br /><br />The "myParagraphStyle.appliedFont.name" reference works properly as long as the font used in the paragraph style is present on the system. If the font is missing, then InDesign doesn't seem to "know" its name for me to reference in this manner.<br /><br />Does anyone know a way to do this? Thanks.

    Bummer! Thanks for letting me know, so I can stop banging my head against the wall trying to figure it out.
    Your approach with the dummy font is clever, but won't help me in this case. I'm trying to automate the "Find Font" process for a group of users. They've used a particular group of fonts for thousands of files, and are switching to a different family of fonts. They want to have ONLY the new family installed. So I wanted to create a script they could run the first time they open each file that would find each old font and replace it with the new font. My script works great for all the text in the file, but not the Paragraph and Character styles.
    Can anyone think of another approach? I'm out of ideas on this one.

  • [CS2/CS3 JS] Finding the first character of each paragraph

    Hi,
    Can anybody help with my script below:
    for (h=0; myParaCount>h; h++){
    myChars = myStory.paragraphs.item(h).contents;
    if (myChars.characters.item(0) == "l" && myChars.characters.item(0).appliedCharacterStyle == CharStyleWin){
    myStory.paragraphs.item(h).appliedParagraphStyle = "L-B";
    This script is supposed to test if the first character is an "l" with my character style "Wingdings" applied to it. I could not test whether the character style is "Wingdings" or not. What could be wrong with my script. Thanks.

    // You need to have a textFrame selected
    var myFrame = app.selection[0];
    var myParaCount = myFrame.paragraphs.length;
    // There must exist a paragraphStyle name L-B
    var myApplyStyle = app.activeDocument.paragraphStyles.item("L-B")
    for (h=0; h < myParaCount; h++){
    var myChar = myFrame.paragraphs.item(h).characters.firstItem();
    // check if first char is "l" and if its applied charstyle name is CharStyleWin
    if (myChar.contents == "l" && myChar.appliedCharacterStyle.name == "CharStyleWin"){
    myFrame.paragraphs.item(h).appliedParagraphStyle = myApplyStyle;
    /* Edited at 11.21 */

  • Cannot find the specified instance exception

    Hello,
    I am having a problem with my Bpel process.
    when I post to XML, i am getting the following:
    <Fault env="http://schemas.xmlsoap.org/soap/envelope/" >
    <faultcode>env:Server</faultcode>
    <faultstring>java.lang.IllegalStateException: Cannot call setRollbackOnly() current thread is NOT associated with a transaction</faultstring>
    </Fault>
    what does this mean ?
    why is it happening ?
    How can resolve this issue ?
    This is urgent,
    Thanks everyone,
    AJ

    sorry, it took a while to respond. are you still facing the issue? this sounds like, there was some system exception where the j2ee container terminated/ended the jta transaction but the exception reached to bpel engine layer where bpel engine trying to set rollback only on an already ended transaction hence this error. the root issue is why the j2ee container ended that jta transaction, is there any other exceptions before this exception in the log file. i assume some kind of timeout or system exceptions happened before reaching the setRollbackOnly call.

  • Linkage problem : cannot find the linkage instance

    Hello everyone,
    I'm trying to create a linkage to swap movie clip dynamically. I already create a linkage and after my movie clip symbol actuall say Export: contact_idea. But when I try to attachMovie("contact_idea"). It does nothing. Is there anyway that I can test that the linkage is actuall linked?
    Thanks

    Thank you very much for your reply. But I still have the problem.
    This is my situation.
    on my stage _root stage I have a movie clip named "head". In movie clip head also have movieclips, "part", and "MC_Holder" which play simultaneously. In "part" movieclip, I have a button which is supposed to be clicked and play "MC_Holder" movieclip which I have the problem.
    this is my code in my button in "part" movieclip
            _root.head.MC_Holder.gotoAndPlay("48");
            _root.head.MC_Holder.removeMovieClip();
            _root.head.MC_Holder.attachMovie("contact_idea","newidea",this.getNextHighestDepth());
            _root.head.MC_Holder.gotoAndPlay("48");
    _root.head is the movieclip in root which doesn't have any problem calling it.
    "contact_idea" is the linkage in my library, which I stated earlier that I linked it already and it displayed a symbol Export: contact_idea.
    Thank you very much for all of you.

  • I am trying to write a grep search for the first instance of a word in a paragraph.

    How can I identify only the first instance of 'FREE' in a paragraph and apply a style to it, without also styling the 2nd or more instance of the word?
    Thanks

    (?i)^(.+?)FREE should find the first instance in a paragraph. The (?i) makes the search case insensitive in case it wasn't typed as all caps, the ? inside the second grouping makes the shortest match for cases when there is more than one instance in a paragraph, and I've not added any quotes since I presumed those aren't actually in the text.
    I would deal with the formatting by typing FREE exactly as you want it someplace on the pastebord, then copy to the clipboard. Change to $1~c which replaces the found string with the text found in the first subexpression (.+?), which is the stuff before the first FREE, and the the formatted contents of the clipboard for the FREE.

  • Finding the position of the end of a line in a JTextPane

    I'm trying to make a JTextPane which expands horizontally if the text being typed in it reaches the right hand edge. To do this I need to know the position in the Document of the end of the current line.
    I've managed to write a method which expands the JTextPane vertically using getEndPosition() in AbstractDocument.
    There is an endLineAction in the DefaultEditorKit which moves the Caret to the end of the line but I don't want to move the Caret, just find the position of the end of the line. I did have a method before which moved the Caret to the end of the line, stored the position and moved it back but that wasn't suitable.
    I suspected the answer was to do with the View but I can't figure out how the View relates to the JTextPane or Document.
    Can anyone help?

    Well, personally I don't think its a good idea to keep changing the size of the text pane as text is being typed and I doubt the solution will be as easy as you think.
    As you type the text will automatically wrap so it will be a little late trying to change the width after the text has wrapped, which means you would need to increase the width "before" text is typed. But then you have another problem because you don't know how much to increase the width by since a single character could be typed or a string of text could be pasted into the text area (people always forget about pasting when doing stuff like this).
    Also if text is removed you would need to iterate through all the line to find the longest line and reset the width.
    Anyway the only way to know the width would be to play with the modelToView() method. If you want to find the end of the current line then you can use the Element.
    Check out my [Text Utilities|http://www.camick.com/java/blog.html?name=text-utilities] class which might give you some ideas on how to use the Element class and modelToView() method.
    which has example of using the above Class and method that might give you some ideas.

Maybe you are looking for

  • BPM roles not avaialable in BPM workspace

    Hi , I am facing an issue with the BPM workspace. I deployed my BPM process in my SOA server. But I am not able to view the roles defined in my BPM application in BPM workspace. I can muanuaaly add the role under Application Roles in Fusion Middlewar

  • DVD from VHS tape

    being new to the Mac G5, can someone help me to convert analog VHS videotape to DVD's?

  • How do I automatically keep settings unchecked in the 'save as' dialog box?

    Hey guys, I use Illustrator CS6. Every day I modify and then save lots of graphics in illustrator. I do a lot of "saving as" with files so that I can see what is selected in the Illustrator options panel. I have to make sure that: -Create pdf compati

  • ISE Guest webauth error

    Using central web auth 802.1x on a 3560 to ISE.  I get to the web portal fine and was able to login with the guest account and change the password.  Now when I get redirected to the portal everytime I login I get "Your session has expired.  Please lo

  • Adobe Interactive Forms via Mail and PI.

    Hi All, We are currently implementing an adobe interactive forms scenario (offline) at our customer. The initial scenario was the folllowing 1. PDF is generated on the CRM system and downloaded towards the clients PC 2. PDF is adjusted by enduser 3.