How to modify text insertion position in HTML in a JEditorPane

Hi all,
Thanks in advance if anyone knows the type of code I need to look at to solve my problem.
It involves the insertion point (in the actual HTML) when editing text in a JEditorPane using type html/txt.
for example, lets say you start to add text by typing in a JEditorPane which already contains some text.
The html is:
<html><head></head>
<body>
<span>inside</span>
</body>
</html>
which represents visually:
inside
The user places the caret (by pointing and clicking the mouse) after the word 'inside'.
The user types the word 'outside'.
The resulting html will look like this:
<html><head></head>
<body>
<span>insideoutside</span>
</body>
</html>
I would very much prefer it to look like this:
<html><head></head>
<body>
<span>inside</span>outside
</body>
</html>
Does anyone know how to influence the position of insertion in this way?
Thanks again,
sean

Success!!!
In a tiny bit of a hacky way.
I will share my path to success. Though I am sure it could be improved. The solution (except for the minor hack to get it to work at all) is quite simple.
And it did indeed involve the use of the DocumentFilter.
So, to recap, My objective was to prevent the user from causing the addition of text within a certain span tag in my HTML when editing visual through a JEditorPane.
Specifically, in my HTML I have a number of span tags identified through a type attribute. My span tags look like this:
<span type="reserved">hello</span>
I wanted to prevent the user from being able to type (visually) to cause either this:
<span type="reserved">next text hello</span>
or
<span type="reserved">hello new text</span>
or
<span type="reserved">he new text llo</span>
Initially, I had used a Caret listener, and moved the caret along, which, besides being hugely ugly, wouldn't fix the main problem of, even when the user starts typing after the word 'hello' on the visual pane, the text would be appended within the span tag, and not outside. Even though if I were to check my position (with the following code) I would be told it wasn't associated with the span attribute at all
          Element elem = hdoc.getCharacterElement(pos);
          AttributeSet a = elem.getAttributes();
          AttributeSet spanAttributeSet = (AttributeSet)a.getAttribute(HTML.Tag.SPAN);
          // if spanAttributeSet is not null, then we properly found ' a span '.
          // now we need to discover if it is one of OUR spans
          if (spanAttributeSet != null)
                { // blah .... do something
                }Regardless of what it told me with the above code, if i were to type in at that position (just after the hello) it would be added to the span tag. Which is what I didn't want.
But the discovery of the DocumentFilter was what I needed to look at. Although, I had a very strange problem of having to reassign the document filter several times to the editorPane (later checks would see it as null). I don't know why I have this problem, but I have made a work-around by ensuring the DocumentFilter is still assigned by reassigning it every time the user moves the caret in the editorpane. Not nice, but prevents my filter from being ignored.
The real solution:
Using the DocumentFilter, I was able to solve both my problems of , not allowing the user to type inside the word 'hello', and preventing the text typed after the 'hello' being appended inside the span tag by the Document model.
This is my code:
           myFilter = new DocumentFilter(){
                public void insertString(DocumentFilter.FilterBypass fb, int offset, String string, AttributeSet attrs) throws BadLocationException
                     System.out.println("in insert string");
                       if (isCaretOnReservedObject((HTMLDocument)fb.getDocument(), offset))
                            throw new BadLocationException("Reserved position", offset);
                       else
                                Object val = attrs.getAttribute(HTML.Attribute.TYPE);
                            if (val!=null && val.equals("reserved"))
                                 super.insertString(fb, offset, string, null);
                            else
                                 super.insertString(fb, offset, string, attrs);
                @Override
                public void remove(DocumentFilter.FilterBypass fb,
                        int offset,
                        int length)
                 throws BadLocationException
                     super.remove(fb, offset, length);
                  public void replace(DocumentFilter.FilterBypass fb,
                         int offset,
                         int length,
                         String text,
                         AttributeSet attrs)
                  throws BadLocationException
                       if (isCaretOnReservedObject((HTMLDocument)fb.getDocument(), offset))
                            throw new BadLocationException("Reserved position", offset);
                       else
                                Object val = attrs.getAttribute(HTML.Attribute.TYPE);
                            if (val!=null && val.equals("reserved"))
                                 super.replace(fb, offset, length, text, null);
                            else
                                 super.replace(fb, offset, length, text, attrs);
           ((AbstractDocument)this.getInternalJEditorPane().getDocument()).setDocumentFilter(myFilter);
     protected boolean isCaretOnReservedObject(HTMLDocument hdoc, int pos)
          boolean retval = false;
          Element elem = hdoc.getCharacterElement(pos);
          AttributeSet a = elem.getAttributes();
          AttributeSet spanAttributeSet = (AttributeSet)a.getAttribute(HTML.Tag.SPAN);
          // if spanAttributeSet is not null, then we properly found ' a span '.
          // now we need to discover if it is one of OUR spans
          if (spanAttributeSet != null)
               Object type = spanAttributeSet.getAttribute(HTML.Attribute.TYPE);
               if (type != null && type.equals("reserved"))
                    // for our logging, we get the ref, which holds the source
                    // of our value later
                    System.out.println(elem + ": the value is: " + spanAttributeSet.getAttribute("ref"));
                    retval = true;
          return retval;
     }And now, when I attempt to type on the word 'hello', nothing happens (great!), and when I type after it, it is not assigned the span tag attribute, and we later find it (when outputting html) at the outside of the span tag.
I don't know if there is a better way to do this, but it looks and works fairly cleanly so far.
And thanks to stas for your reply...... Maybe this is what you meant. . it certainly was the attributes I needed to fiddle with here, and it gave me an extra hint of what to look for when researching the problem.
Edited by: svaens on Sep 28, 2009 6:56 PM
forgot to add dependency to code snippet
Edited by: svaens on Sep 28, 2009 9:34 PM
fix bug

Similar Messages

  • How to pass text from flash to html?

    how to pass text from flash to html?

    This is a wonderful sample i found online.
    pls run using a server so that it can display properly
    http://active.tutsplus.com/tutorials/actionscript/flash-html-javascript-externalinterface/

  • Strange behaviour on text insert into a HTML pane

    Hi all,
    I am trying to fix a problem on inserting a span tag into an existing html page (in an EDITABLE JEditorPane).
    The behaviour:
    Assuming the cells in a table (3 rows, 2 columns) are numbered from 1 to 6, with cell one being the top left most, cell 2 top right, cell 3 middle left, etc.
    1. Inserting the text "<span></span>" in cell 4 causes during any attempt to later type into cell 5 the characters to be appended instead into cell 4, directly after the close span tag.
    2. The insertion in the first place behaves strange. If I have the caret positioned for cell 5 so that I can insert there
    (via the function void javax.swing.text.html.HTMLEditorKit.insertHTML(HTML Document doc, int offset, String html, int popDepth, int pushDepth, Tag insertTag) )
    even though the caret position is visible in cell 5, the insertion seems to take place in cell 4.
    I can sort of compensate for this by adding 1 to the offset. However, then when inserting into a line of text, for example, "the quick red fox jumped over the lazy dog"
    I insert directly before the 'j' in 'jumped', the insertion looks like this "the quick red fox j<span>..</span>umped over the lazy dog"
    So that is no solution.
    IMPORTANT! Just to prove it is not the span tag causing the trouble, if this span tag already exists in a cell on 'Load' of the html file, the strange behaviour is not observed.
    Something is going wrong here. It is me? Or is it a bug?
    Please help!!
    Here is a test app, and the test html you can use (place in current directory).
    Please test like this:
    1. run application (the html should be loaded into the pane)
    2. the span tag is programmed to automatically insert at cell 4 (by using the +1 method on the insert)
    3. another span tag was already existing in the html file, at cell 8
    4. Attempt to type into cell 5
    result: the text appears instead at cell 4
    5. Type into cell 9
    result: the text correctly is entered into cell 9
    See the difference!!
    Help!
    The test java app:
    package small.test;
    import java.awt.BorderLayout;
    import java.awt.Container;
    import java.io.File;
    import java.io.FileReader;
    import java.io.IOException;
    import java.io.StringReader;
    import javax.swing.JEditorPane;
    import javax.swing.JFrame;
    import javax.swing.JPanel;
    import javax.swing.JScrollPane;
    import javax.swing.SwingUtilities;
    import javax.swing.text.JTextComponent;
    import javax.swing.text.html.HTML;
    import javax.swing.text.html.HTMLDocument;
    import javax.swing.text.html.HTMLEditorKit;
    import javax.swing.text.html.parser.ParserDelegator;
    public class HtmlInsertTest extends JEditorPane
         public HtmlInsertTest()
         public static void main(String args[])
              JFrame frame = new JFrame("Loading/Saving Example");
              Container content = frame.getContentPane();
              frame.setSize(600, 600);
              final HtmlInsertTest editorPane = new HtmlInsertTest();
              editorPane.setEditable(true);
              JScrollPane scrollPane = new JScrollPane(editorPane);
              content.add(scrollPane, BorderLayout.CENTER);
              editorPane.setEditorKit(new HTMLEditorKit());
              JPanel panel = new JPanel();
              content.add(panel, BorderLayout.SOUTH);
              frame.setSize(600, 600);
              doLoadCommand(editorPane);
              editorPane.insertHTML("<span>inserted text</span>", 84);
              frame.setVisible(true);
         public static String getHTML()
              return
              "<!DOCTYPE HTML PUBLIC \"-//W3C//DTD HTML 4.0 Transitional//EN\">"+
              "<HTML>"+     "<HEAD>"+
              "     <META HTTP-EQUIV=\"CONTENT-TYPE\" CONTENT=\"text/html; charset=utf-8\">"+
              "     <TITLE></TITLE>"+          
              "</HEAD>"+
              "<BODY LANG=\"en-AU\" DIR=\"LTR\">"+
              "<P STYLE=\"margin-bottom: 0cm\">This is a test xhtml document. "+
         "     </P>"+
         "     <P STYLE=\"margin-bottom: 0cm\">"+
         "     </P>"+
         "     <P STYLE=\"margin-bottom: 0cm\">Here is a table:</P>"+
         "     <P STYLE=\"margin-bottom: 0cm\">"+
         "     </P>"+
         "     <p></p>"+
               "     <TABLE WIDTH=100% BORDER=1 BORDERCOLOR=\"#000000\" CELLPADDING=4 CELLSPACING=0>"+
         "          <TR VALIGN=TOP>"+
         "               <TD WIDTH=50%>"+
         "                    <P>It has</P>"+
         "               </TD>"+
         "               <TD WIDTH=50%>"+
         "                    <P>2 columns</P>"+
         "               </TD>"+
         "          </TR>"+
         "          <TR VALIGN=TOP>"+
         "               <TD WIDTH=50%><P>And 4 rows</P></TD>"+
         "               <TD WIDTH=50%><P></P></TD>"+
         "          </TR>"+
         "          <TR VALIGN=TOP>"+
         "               <TD WIDTH=50%><P></P></TD>"+
         "               <TD WIDTH=50%><P></P></TD>"+
         "          </TR>"+
         "          <TR VALIGN=TOP>"+
         "               <TD WIDTH=50%><P></P></TD>"+
         "               <TD WIDTH=50%><P><span>existing text</span></P></TD>"+
         "          </TR>"+
         "          <TR VALIGN=TOP>"+
         "               <TD WIDTH=50%><P></P></TD>"+
         "               <TD WIDTH=50%><P></P></TD>"+
         "          </TR>"+
         "     </TABLE>"+
         "     <P STYLE=\"margin-bottom: 0cm\">"+
         "     </P>"+
         "     <P STYLE=\"margin-bottom: 0cm\">"+
         "     </P>"+
         "     <P STYLE=\"margin-bottom: 0cm\">"+
         "     </P>"+
         "     <P STYLE=\"margin-bottom: 0cm\">We will test the drag and drop"+
         "     functionality with this document. "+
         "     </P>"+
         "     <P STYLE=\"margin-bottom: 0cm\">It will be loaded with the hlml editor.</P>"+
         "     <P STYLE=\"margin-bottom: 0cm\">"+
         "     </P>"+
         "     <P STYLE=\"margin-bottom: 0cm\">"+
         "     </P>"+
         "     </BODY>"+
         "     </HTML>";
         public static void doLoadCommand(JTextComponent textComponent)
              StringReader reader = null;
              try
                   System.out.println("Loading");
                   reader = new StringReader(getHTML());
                   // Create empty HTMLDocument to read into
                   HTMLEditorKit htmlKit = new HTMLEditorKit();
                   HTMLDocument htmlDoc = (HTMLDocument)htmlKit.createDefaultDocument();
                   // Create parser (javax.swing.text.html.parser.ParserDelegator)
                   HTMLEditorKit.Parser parser = new ParserDelegator();
                   // Get parser callback from document
                   HTMLEditorKit.ParserCallback callback = htmlDoc.getReader(0);
                   // Load it (true means to ignore character set)
                   parser.parse(reader, callback, true);
                   // Replace document
                   textComponent.setDocument(htmlDoc);
                   System.out.println("Loaded");
              catch (Exception exception)
                   System.out.println("Load oops");
                   exception.printStackTrace();
              finally
                   if (reader != null)
                        reader.close();
         public void insertHTML(String text, int offset)
              SwingUtilities.invokeLater(new insertAction(this, text, offset));
         class insertAction implements Runnable
              String text = "";
              int offset = 0;
              JEditorPane jEditorPane1 = null;
              public insertAction(JEditorPane _jEditorPane1, String _text, int _offset)
                   jEditorPane1 = _jEditorPane1;
                   text = _text;
                   offset = _offset;
              @Override
              public void run()
                   HTMLDocument doc = (HTMLDocument)jEditorPane1.getDocument();
                   HTMLEditorKit kit = (HTMLEditorKit)jEditorPane1.getEditorKit();
                   try
                        System.out.println("reading from string reader");
                        kit.insertHTML(     doc,
                                          offset,//+1
                                          text,
                                          0,//0
                                          0,//0
                                          HTML.Tag.SPAN);
                        System.out.println(jEditorPane1.getText());
                   catch (Exception e)
                        System.out.println("error inserting html: " + e);
    }Edited by: svaens on Jul 16, 2009 6:34 PM
    fix another stuffed up attempt at a SSCCE.

    Well, I know nothing about HTML in JEditorPanes. I have never been able to figure out how insertions work.
    My comment was a warning to others. Some people (like me) avoid answering posting of this type for reasons given in the JavaRanch link. Others will answer anyway. Other might first check the other site to see if they are wasting there time, but they can only do that if a link was posted with the original question.
    The only suggestion I have is to repost the question, (since this posting is now completely off topic) making sure to then respond to this posting stating that a fresh question has been asked so you don't get a discussion going on in two places.

  • How to edit text inserted into a gif

    I have a gif image.  I opened the image.  I insert text the with horizontal text tool.
    After inserting I can move the text around, but I can’t edit the text, can’t add or change characters, can’t change color.
    Is there a way to do that?

    BOILERPLATE TEXT:
    Note that this is boilerplate text.
    If you give complete and detailed information about your setup and the issue at hand,
    such as your platform (Mac or Win),
    exact versions of your OS, of Photoshop (not just "CS6", but something like CS6v.13.0.6) and of Bridge,
    your settings in Photoshop > Preference > Performance
    the type of file you were working on,
    machine specs, such as total installed RAM, scratch file HDs, total available HD space, video card specs, including total VRAM installed,
    what troubleshooting steps you have taken so far,
    what error message(s) you receive,
    if having issues opening raw files also the exact camera make and model that generated them,
    if you're having printing issues, indicate the exact make and model of your printer, paper size, image dimensions in pixels (so many pixels wide by so many pixels high). if going through a RIP, specify that too.
    A screen shot of your settings or of the image could be very helpful too,
    etc.,
    someone may be able to help you (not necessarily this poster, who is not a Windows user).
    Please read this FAQ for advice on how to ask your questions correctly for quicker and better answers:
    http://forums.adobe.com/thread/419981?tstart=0
    Thanks!

  • How to read text from PDF and HTML

    I have got solution to read text form .txt file but did'nt get code for PDF and HTML.
    I dont want to convert PDF to txt.
    Please help me ...

    reading from a file is always the same. using the same strategy used for a .txt will allow you to read a .pdf file.
    Offcourse in itself it will be useless becuase pdf files have a special internal structure.
    html files are identical to txt files.
    What are you trying to accomplisch with the files you are reading ?

  • How to get text's position in htmlText

    Dear All:
    I include some text into htmlText from a xml file and the
    text has serval paragraph,I want to add
    one grey rectangle background to every paragraph and need to
    get coordinate of ever paragraph.
    who can tell me how to realize it ?I'll appreciate for any
    reply.
    Best Regards
    Jacky

    Dear All:
    I include some text into htmlText from a xml file and the
    text has serval paragraph,I want to add
    one grey rectangle background to every paragraph and need to
    get coordinate of ever paragraph.
    who can tell me how to realize it ?I'll appreciate for any
    reply.
    Best Regards
    Jacky

  • ESS form change permanent address - how to modify text?

    We would like to change the default / delivered  text in the SAP delivered ESS form "Change Permanent Address".
    Currently it seems to translate very poorly from German to English.
    How do we alter the "change permanent address" text...specifically the part that that reads"  ... in so10? 
    "FORM AREA FOR EMPLOYEE" ...
    Thanks,
    Matt

    solved.
    found change of address form id here:
    http://help.sap.com/erp2005_ehp_05/helpdata/en/45/619a91e2d01feee10000000a1553f7/frameset.htm
    entered into SFP transaction (installed adobe life cycle manager).
    opened ISR_HRASR_SHAD, MADE changes.

  • How to open an Applet from a text link in a HTML Page

    Hi There
    How to open an Applet from a text link
    in a HTML page
    For example I have a HyperLink "Open Applet"
    When a user clicks that link i want to open a
    Applet in a AWT Window.
    How can i do this
    Will any one help me?
    -Ramya

    u can use javascript for that
    <SCRIPT language="javascript">
    function loadAppNow() {
    document.write("<APPLET ......></APPLET>")
    </SCRIPT>
    LoadApplet
    this will overwrite the applet on current window
    There are many good ways other than document.write to open in same window. I don't remember the syntax right now.
    Plz. refer to javascript tutorial for that.
    even you can insert the applet while retaining previous contents. its quite easy actually.
    regards....bhart

  • JEditorPane: transforming between caret position in html and text/plain

    Hi all,
    I've done quite a bit of searching, and found problems similar to this one, but not this exactly, so I'll try asking it here.
    I have a JEditorPane with HTMLEditorKit, which I'm using for a WYSIWYG text editor. When the user wants to insert something, say an image, I get the caret position and insert a String into the document's underlying text.
    The problem is that if we are the WYSIWYG mode, the caret position isn't the same as the caret position in text/plaain mode.
    So if the underlying text is
    <html>
      <body>
         Some text
      </body>
    </html>the user will just see "Some text". If they place the caret between "Some" and "text", editorPane.getSelectionStart() will return '5'. But I want to insert my text at position '16' in the plain text.
    Is there a simple way to go back and forth between these two positions? Or to have getSelectionStart() to return the index relative to the text/plain mode?
    Thanks!
    Tim

    Very poor that no one answered this one.
    Did you still need the answer?
    I have 'a' answer. But not a complete one.
    In fact I only found this in search for an answer for my problem:
    http://forums.sun.com/thread.jspa?threadID=5409216&tstart=0
    Did you actually just test out what you knew so far to test what happens?
    If you were to use the HTMLEditorKit.insertHTML function, it just wants the visual caret position. So '5' would have been reasonably correct for you.
    I was doing something like this:
                   HTML.Tag tag = null;
                   Pattern p = Pattern.compile("\\s*\\<\\s*(\\w+).*", Pattern.MULTILINE|Pattern.DOTALL);
                   Matcher m = p.matcher(text);
                   if (m.matches())
                        tag = HTML.getTag(m.group(1));
                   kit.insertHTML(doc, offset,// +1
                                  text, 0,// 0
                                  0,// 0
                                  tag);
    Assuming you were inserting a tag, my code there checks what tag it is, and if that is known by the java implementation, assigns that to 'tag', so that the element is correctly inserted.
    If it is not known, we just use 'null'. Which for me wasn't such a great result.
    In fact, nothing really was a great result, as with the default java implementation being buggy (so far as I can see) it inserted to the wrong position and caused all sorts of anomalies.
    Hope you worked it out. And if you did, and have a better result than what I have, maybe you can let me know what you did!
    Sincerely,
    sean

  • How to display a text file in a html page?

    I have written a servlet that executes a batch file whose output is saved to a txt file. I am attempting to display content of the text file as a html page from the servlet but am struggling I have attempted to read the file and output it as shown below but it is not displaying the correct data
    Appreciate some help
    Thanks in advance
    Amjad
    Runtime r = Runtime.getRuntime();
    Process p = r.exec("C:\\Condor\\test\\QueStatus.bat");
    PrintWriter out;
    String title = "Que Status";
    response.setContentType("text/html");
    out = response.getWriter();
    FileReader fr = new FileReader ("C:\\Condor\\test\\output.txt");
    for (int chr = fr.read(); chr != -1; chr = fr.read()){
         out.print(chr);
    }

    Couple of things. First you should search the forums for how to properly exec a dos batch file. There are some problems you may run into especially with io. I suspect you may not actually be running that batch file at all.
    I would test outputing a text file separately from execing the batch file.
    Here is some code so you don't have to output 1 char at a time. Setting the content length and closing the output stream might help.
    File downloadFile = new File("c:\\blah\\blah\\blah");
    response.setContentLength((int)downloadFile.length());
    response.setContentType("text/html");
    ServletOutputStream out = response.getOutputStream();
    FileInputStream fis = new FileInputStream(downloadFile);
    byte[] buffer = new byte[1024];
    int bytesRead;
    while ((bytesRead = fis.read(buffer)) != -1) {
    out.write(buffer, 0, bytesRead);
    fis.close();
    out.close();

  • How to modify the text in login page?

    In login page , there are some lines text:
    This network is to be used only for legitimate business purposes. If you are not authorized to have access, do not enter this network. By entering the network, you agree to maintain its confidentiality and not to disclose or misuse the information contained in the network and you further agree to our monitoring of your use of this network.
    How to modify or delete these words ?
    Thanks

    This text is not a translation managed in the DB.  you can modify the aspx page, directly.  web\webcommon\login.aspx

  • How to Set Up TextEdit as an HTML or Plain Text Editor?

    How to Set Up TextEdit as an HTML or Plain Text Editor?

    Well,
    There are 5 choices to choose from on the page. In the description of the choices at the bottom of the page there are 7, and the two additional choices talk about having to first have registered the site with SSO. So...I'm interpreting that as meaning that other 2 possible choices would be displayed if the site is registered with SSO. That, plus the fact that the page which describes how to add the site to SSO seems to think that the SSO choices are displayed in the wizard.
    So, no, there's no "exact launguage" that says what the reason is for the choices not being displayed. Can you point me to some exact language that tells me how to get those choices displayed?

  • How can we generate the reports in html or text file formats?

    Hi,
    Is there any package that can help in creating HTMLDB reports in .txt files or .html files? (Similar to TEXT_IO in Oracle Forms)
    How can we generate the reports in html or text file formats from HTMLDB?
    Thanks in Advance
    Renjith

    Hello all.
    Bi Publisher is great, but has a very high price tag. It's even more expensive than Forms & Reports Services. We are considering APEX to replace Forms & Reports on the web, but the reporting limitations are still a problem.
    I wonder if there is another option.
    Thanks

  • How to add text in .ai file and  set position, font, size and colour

    I want to place multiple lines of of text (individually) into .ai file and set size, font, colour and position for each.
    Preferably text should have origin in a single point (rather than be framed)
    Hope anyone can help me out.
    Thank you in advance.

    Here's what's in the Scripting Reference
    Creating and modifying text frames
    // Creates a document with text frames displaying path, area and point
    // text, changes the content of each frame then deletes the 2nd frame
    // create a new document
    var docRef = documents.add();
    // create 3 new textFrames (area, line, point)
    // Area Text
    var rectRef = docRef.pathItems.rectangle(700, 50, 100, 100);
    var areaTextRef = docRef.textFrames.areaText(rectRef);
    areaTextRef.contents = "TextFrame #1";
    areaTextRef.selected = true;
    // Line Text
    var lineRef = docRef.pathItems.add();
    lineRef.setEntirePath( Array(Array(200, 700), Array(300, 550) ) );
    var pathTextRef = docRef.textFrames.pathText(lineRef);
    pathTextRef.contents = "TextFrame #2";
    pathTextRef.selected = true;
    // Point Text
    var pointTextRef = docRef.textFrames.add();
    pointTextRef.contents = "TextFrame #3";
    pointTextRef.top = 700;
    pointTextRef.left = 400;
    pointTextRef.selected = true;
    redraw();
    // count the TextFrames
    var iCount = docRef.textFrames.length;
    var sText = "There are " + iCount + " TextFrames.\r"
    sText += "Changing contents of each TextFrame.";
    // change the content of each
    docRef.textFrames[0].contents = "Area TextFrame.";
    docRef.textFrames[1].contents = "Path TextFrame.";
    docRef.textFrames[2].contents = "Point TextFrame.";
    redraw();
    docRef.textFrames[1].remove();
    redraw();
    // count again
    var iCount = docRef.textFrames.length;
    Your are looking stuff with the pointTextRef.

  • How do I modify text in a 3D scene

    I am trying to display some live data inside a 3D picture. However, I just can't figure out how ot modify the text after I have added the object tot he scene. If I attempt to modify the text using the reference of the text object I created I get a message sayign teh reference is invalid (1055 I believe).
    Anyone out there have any experience with this?
    Amit

    Hi Amit,
    I was able to modify the text while the program was running.  I've attached the VI that I used.
    Cheers,  
    Marti C
    Applications Engineer
    National Instruments
    NI Medical
    Attachments:
    change_text_2009.vi ‏11 KB

Maybe you are looking for