Remove Html textarea scrollbar from jeditorpane

Hi,
I am using jeditorpane for display a content in my project,
i am create html code and set to jeditorpane, but in my code i am using textarea for display large text,
what my problem is in the textarea is not at all wrap and even small text also its show scrollbar,
i want to remove the scrollbar and wrap properly, can any one give some idea is highly useful to solve my problem.
my code is
        setContentType("text/html"_);
          HTMLEditorKit kit = new HTMLEditorKit();
          super.setEditorKit(kit);
          StyleSheet styleSheet = kit.getStyleSheet();
          styleSheet.addRule("textarea {style=border:4; overflow:auto; wrap:virtual}");
          styleSheet.addRule("body {color:#000; font-family:times; margin: 1px }");
          StringBuffer sb = new StringBuffer();
        // in this string buffer i am append all the html code
         setText( sb.toString() );Thanks in advance.

This is the technique I use.
1. Create 2 identical columns, one with the HTML and one without.
2. Then conditionally display the columns, one to display in the web page and the other to display in the download. This can easily be done using the request value e.g.
Condition Type: Request Is NOT Contained within Expression 1
Expression1: CSV,PDF,RTF,XLS
I hope that does the trick for you :)
Simom

Similar Messages

  • Can't remove unwanted vertical scrollbar from JSP

    I can't remove an unnecessary vertical scrollbar from my JSP when the "<DIV>" on the screen is wider than the screen(i.e a horizontal scrollbar is necessary).It does'nt matter how much info is removed from the page the vertical scrollbar remains as long as the "<DIV>" is wider than the screen.Has anyone else experienced this problem before?.

    The data displayed is all necessary for the functionality of the screen (i.e different calculations and figures being checked, similiar usage as an excel spreadsheet online).So it is necessary to have a horizontal scrollbar but I do not want a vertical scrollbar as it does'nt provide any functionality as the page fits perfectly into the screen height wise.

  • How to remove html-tags from a text.

    Hello!
    I have a text-field which I will remove html-tag's from.
    Example:
    "This is a test<br><p> and another test"
    The function must return a similar text, but without the html-
    tags <br> and <p> (in this case).
    Anybody that can help me with this little problem?
    Thanks in advance for any help :-)
    Best regards
    Kjetil Klxve

    You can wait for some kind personal to post a complete code
    solution... But if you want to fix this yourself (which is good
    for the soul) here are some hints:
    - You can use SUBSTR to get at chunks of text
    - You can use INSTR to find particular characters.
    - You can use INSTR as an argument of SUBSTR
    Hence:
    bit_of_text := SUBSTR(text, 1, INSTR(text, '<'));
    chopped_text := SUBSTR(text, INSTR(text, '<'));
    bit_of_text := bit_of_text||SUBSTR(chopped_text, INSTR
    (text, '>'), INSTR(text, '<'));
    will give you the first bit of text that doesn't contain any
    angle brackets.
    From this you should be able to work out how to functionalised
    this (you'll need to store the offsets and use them in a loop
    construct).
    Note that this assumes that the text only contains the '<'
    character when it's part of a HTML tag. If you can't guarantee
    this then you'll have to explicitly search for all the tags e.g.
    bit_of_text := SUBSTR(text, 1, INSTR(lower(text), '<p>'));
    bit_of_text := SUBSTR(text, 1, INSTR(lower(text), '<br>'));
    This will be a bit of pain. And completely rules out XML!
    rgds APC

  • HTML TextArea is a  JScrollPane in JEditorPane?

    Hi all,
    I'm trying to create an autofill facility for my application, to do this I am getting the components from the HTML document and converting them to their Java Swing counterpart.
    So for example <input type="text" name="example" /> would be a normal text input field on a HTML form, and its Swing conversion is a JTextField - this works as desired and it allows me to use the .settext() command to set the text on the HTML form - i.e. autofilling.
    My problem comes when I try to get the component for a HTML textarea, e.g. <textarea name="example"></textarea> - I would expect the Swing component to be a JTextArea, but the class it gets converted to is a JSrcollPane! This leads to a problem as I can't set the text of a JScrollPane as it is a container.
    Does anyone know how I might get around this problem so that I can set the text for the textarea? I've included my code below.
    Many thanks
    BBB
    import java.awt.event.*;
    import java.awt.*;
    import java.net.URL;
    import javax.swing.*;
    public class Tester extends JFrame{
        static JEditorPane pane = new JEditorPane();
        public Tester()
            try {
                pane.setPage( new URL("http://www.amray.com/cgi/amray/addurl.cgi") );
            } catch (Exception e) {
            this.getContentPane().add(new JScrollPane(pane));
            JButton b1 = new JButton("Auto Fill");
            this.getContentPane().add(b1,BorderLayout.SOUTH);
            b1.addActionListener(new ActionListener() {
                public void actionPerformed(ActionEvent e)
                    for ( int i = 0; i < pane.getComponentCount(); i++ )
                        Container c = (Container)pane.getComponent(i);
                        Component swingComponentOfHTMLInputType = c.getComponent(0);
                        System.out.println(swingComponentOfHTMLInputType.getClass());
                        if ( swingComponentOfHTMLInputType instanceof JTextField ) {
                            JTextField tf = (JTextField)swingComponentOfHTMLInputType;
                            tf.setBackground( Color.yellow );
                            tf.setText("Auto Filled");
                        if ( swingComponentOfHTMLInputType instanceof JScrollPane ) {
                            JScrollPane ta = (JScrollPane)swingComponentOfHTMLInputType;
        public static void main(String args[]) {
            Tester app = new Tester();
            app.setDefaultCloseOperation( JFrame.EXIT_ON_CLOSE );
            app.setSize( 400, 400 );
            app.setVisible( true );
    }

    Hi Jim,
    Thanks for the suggestion, but I've already tried that and although it does work from a visual POV, when you then submit the form the data in the JTextArea isn't added - it just says the field is blank.
    Although, I'm not sure whether it's not working due to the method I've had to use to add the JTextArea: -
    JScrollPane ta = (JScrollPane)swingComponentOfHTMLInputType;
    JTextArea oTextArea = new JTextArea();
    oTextArea.setText("Hello World!");
    ta.setViewportView(oTextArea);I'm not sure if it's not working because I've had to use .setViewportView(); rather than .add(). If I use .add() then no changes are reflected on screen and the JTextArea isn't actually added.
    Any other suggestions?

  • How to remove HTML tags from a String ?

    Hello,
    How can I remove all HTML Tags from a String ?
    Would you please to give me a simple example ?
    Best regards,
    Eric

    Here's some code I cooked up. I have created an object that processes code so that it can be incorporated directly into a project. There is some redundancy so that the it can be used in more than one way. Depending on your situation you might have to make the condition statement a little more sophisticated to catch stray ">" tags.
    I have also included a Tester application.
    //This removes Html tags from a String either by submitting the String during construction and then
    // calling getProcessedString() or
    // by simply calling " stringwithoutTags=removeHtmlTags(stringWithTagsSubmission); "
    //Note: This code assumes that all"<" tags are accompanied by a ">" tag in the proper order.
    public class HtmlTagRemover
         private String stringSubmission,processedString,stringBeingProcessed;
         private int indexOfTagStart,indexOfTagEnd;
         public HtmlTagRemover()
         public HtmlTagRemover(String s)
              removeHtmlTags(s);          
         public String removeHtmlTags(String s)
              stringSubmission=s;
              stringBeingProcessed=stringSubmission;
              removeNextTag();
              return processedString;
         private void removeNextTag()
              checkForNextTag();
              while((!(indexOfTagStart==-1||indexOfTagEnd==-1))&<indexOfTagEnd)
                   removeTag();
                   checkForNextTag();
              processedString=stringBeingProcessed;
         private void checkForNextTag()
              indexOfTagStart=stringBeingProcessed.indexOf("<");
              indexOfTagEnd=stringBeingProcessed.indexOf(">");
         private void removeTag()
              StringBuffer sb=new StringBuffer("");
              sb.append(stringBeingProcessed);
              sb.delete(indexOfTagStart,indexOfTagEnd+1);
              stringBeingProcessed=sb.toString();
         public String getProcessedString()
              return processedString;
         public String getLastStringSubmission()
              return stringSubmission;
    public class HtmlRemovalTester
         static void main(String[] args)
              String output;
              HtmlTagRemover h=new HtmlTagRemover();
              output="The processed String: "+h.removeHtmlTags("<Html tag>This is a test<another Html tag> string<yet another Html tag>.");
              output=output+"\n"+" The original string:"+h.getLastStringSubmission();
              System.out.print(output);

  • JEditorPane + html TEXTAREA + WRAP

    Hi, I have a simple program that uses a JEditorPane to create an html TEXTAREA.
    Supposedly the text in the TEXTAREA should be wrapped, and when I add READONLY, the text can�t be deleted. However, the wrapping and readonly don�t work�
    Here is the code:
    import javax.swing.*;
    import java.awt.*;
    public class Main extends JFrame {
        public Main() {
            String abc = "A BIG LONG STRING WHICH SHOULD BE WRAPPED, AND CANNOT BE DELETE...A BIG LONG STRING WHICH SHOULD BE WRAPPED, AND CANNOT BE DELETE...A BIG LONG STRING WHICH SHOULD BE WRAPPED, AND CANNOT BE DELETE...A BIG LONG STRING WHICH SHOULD BE WRAPPED, AND CANNOT BE DELETE...";
            Container ct = getContentPane();
            JEditorPane ep = new JEditorPane();
            ep.setContentType("text/html");
            ep.setText("<body><tr><td class=one width=135>Test Criteria:</b></td><TEXTAREA WRAP=SOFT COLS=20 ROWS=2 READONLY>"
                       + abc + "</TEXTAREA></tr></body>");
            ct.add("Center", ep);
            setSize(400, 300);
            setVisible(true);
        public static void main(String[] args) {
            new Main();
    }Please help me out.
    Thanks.
    Hong Jiang

    As I understand it, JEditorPane's version of HTML is 3.2. Looking in the HTML 3.2 recommendation I don't see "wrap" and "readonly" as acceptable attributes for Textarea.

  • HT1277 Removing Horizontal Scrollbar from Mail

    Can anyone help me remove or switch off the horizontal scrollbar from Mail?
    The window is forcing received emails into one long line of text and I'm having to scroll horizontally to read the email, its seriously driving me crazy!
    I figured that if I remove the scrollbar it will force the received the email to run around? Then I'll only need to scroll vertically.
    Please help.

    I'm seeing a similar problem in Compose. Word wrap logic seems to have disappeared. When I type past the width of the edit screen, the line does not wrap.  Rather, the screen scrolls to the right. I don't find a word wrap option anywhere. And I've just upgraded to 6.01.
    Anyone else?

  • How to remove HTML encoding from csv file using powershell

    Hi guys i am exporting data from a sharepoint list using powershell which works fine. My problem is that some of the fields contain HTML mark up. Is there a way to remove all of the html mark up from the array before writing it to csv ?
    I have tried playing about with System.Web.HttpUtility.HtmlDecode but with no luck the code runs but no html is removed.
    Below is a sample of my script.
    Set-Variable HOME $env:USERPROFILE -Force
    (Get-PSProvider FileSystem).Home = $HOME
    if(-not(Get-PSSnapin | where { $_.Name -eq "Microsoft.SharePoint.PowerShell"}))
    Add-PSSnapin Microsoft.SharePoint.PowerShell;
    # imports assembly needed for url stuff to do
    Add-Type -AssemblyName System.Web
    $SPWeb = Get-SPWeb "http://site url"
    $SPList = $SPWeb.Lists["List Name"]
    $exportlist = @()
    $SPList.Items | foreach {
    $obj = New-Object PSObject -Property @{
    "Employee full name" = $_["EMPLOYEEFNAME"]
    "Employee login name" = $_["EMPLOYEENAME"]
    "Department Name" = $_["DEPARTMENT"]
    System.Web.HttpUtility.HtmlDecode("OBJECTIVESTOBEACHIEVED_0") = $_["F1_S4a_OBJECTIVESTOBEACHIEVED_0"]
    "OBJECTIVESTOBEACHIEVED_1" = $_["F1_S4a_OBJECTIVESTOBEACHIEVED_1"]
    "OBJECTIVESTOBEACHIEVED_2" = $_["F1_S4a_OBJECTIVESTOBEACHIEVED_2"]
    "OBJECTIVESTOBEACHIEVED_3" = $_["F1_S4a_OBJECTIVESTOBEACHIEVED_3"]
    "OBJECTIVESTOBEACHIEVED_4" = $_["F1_S4a_OBJECTIVESTOBEACHIEVED_4"]
    "OBJECTIVESTOBEACHIEVED_5" = $_["F1_S4a_OBJECTIVESTOBEACHIEVED_5"]
    "OBJECTIVESTOBEACHIEVED_6" = $_["F1_S4a_OBJECTIVESTOBEACHIEVED_6"]
    "OBJECTIVESTOBEACHIEVED_7" = $_["F1_S4a_OBJECTIVESTOBEACHIEVED_7"]
    $exportlist += $obj
    $exportlist | select "Employee full name", "Employee login name", "Department Name", "OBJECTIVESTOBEACHIEVED_0", "OBJECTIVESTOBEACHIEVED_1", "OBJECTIVESTOBEACHIEVED_2", "OBJECTIVESTOBEACHIEVED_3", "OBJECTIVESTOBEACHIEVED_4", "OBJECTIVESTOBEACHIEVED_5", "OBJECTIVESTOBEACHIEVED_6", "OBJECTIVESTOBEACHIEVED_7" | Export-Csv ~/Export.csv -noType
    $SPWeb.Dispose()
    any help would be much appreciated.

    Should have googled before posting !
    "OBJECTIVESTOBEACHIEVED_0" = [Microsoft.SharePoint.Utilities.SPHttpUtility]::ConvertSimpleHtmlToText($_["F1_S4a_OBJECTIVESTOBEACHIEVED_0"],-1) -replace '\s+', ' '
    Clears all the additional white space. As always jrv you
    have saved the day, many thanks for all the help.
    Mal

  • Fastest way to remove html tags except url in href from string using java

    Hi All,
    Please suggest the, fastest way to remove html tags (stripe) except url in href of an anchor tag from string using java.
    Please help me with the best solution as I use parser but it's taking time to remove the html tags from string of file.
    I want the program should give the performance as 1 millisecond for 2kb file.
    Please help me out... Thanks in advance

    Hi,
    how can I replace the anchor tag in a string, by the url in the href of that anchor tag by using jsoup,
    e. g.
    <code>
    suppose input text is :
    test, string using, dsfg, 1:14 PM, < a t a r ge t="_ablank" s t y l e = " color: red" h r e f = " h t t p : / / t e s t u r l . c o m / i n d e x . j s p ? a = 1 2 3 4 " > s u p p o r t < / a >, s c h e d u l a r t a g , < a t a r g e t = " _ vbblank " s t y l e = " c o l o r : g r e e n " h r e f = " h t t p : / / t e s t u r l g r e e n . c o m / i n d e x . j s p ? a = a s d f a s df 4 " > s u pp o r t r e q < / a > a s d f pq r
    then out put text should be :
    test, string using, dsfg, 1:14 PM, http://testurl.com/index.jsp?a=1234, schedular tag, http://testurlgreen.com/index.jsp?a=asdfasdf4 asdf pqr
    </code>
    Please help at the earliest..
    Thanks in advance
    as this text editor is not supporting html anchor tag the example is not displaying correctly
    Edited by: 976815 on Dec 17, 2012 5:17 AM

  • Remove HTML tags from a text area

    Hi, here is my problem:
    I have a form with a text area item; this item is “Display as Editor HTML standard”. So it is possible to enter formatted text with tags HTML. Then I save the text in a table. In the column the text maintain the HTML tags. Afterwards I can put the text in a report, and I can see the formatted text with the tags HTML interpreted.
    But I need also to use that text for other aims, (i.e. sending it in a mail) with the html tags removed.
    Is there any way to remove HTML tags from a text item?
    Regards
    Dario

    From http://asktom.oracle.com/pls/asktom/f?p=100:11:0::::P11_QUESTION_ID:769425837805
       FUNCTION str_html (line IN VARCHAR2)
          RETURN VARCHAR2
       IS
          x         VARCHAR2 (32767) := NULL;
          in_html   BOOLEAN          := FALSE;
          s         VARCHAR2 (1);
       BEGIN
          IF line IS NULL
          THEN
             RETURN line;
          END IF;
          FOR i IN 1 .. LENGTH (line)
          LOOP
             s := SUBSTR (line, i, 1);
             IF in_html
             THEN
                IF s = '>'
                THEN
                   in_html := FALSE;
                END IF;
             ELSE
                IF s = '<'
                THEN
                   in_html := TRUE;
                END IF;
             END IF;
             IF NOT in_html AND s != '>'
             THEN
                x := x || s;
             END IF;
          END LOOP;
          RETURN x;
       END str_html;There's also a reqular expression approach that I've not tried. Remove HTML Tags and parse the text out of it

  • Way to remove HTML tags from a page-scoped attribute using JSTL?

    Hi,
    I'm using JSTL 1.2 with Tomcat 6.0.26. Does anyone know of a way to remove HTML tags from a page attribute, "${myExpr}". I would prefer a solution that uses JSTL only, but ultimately whatever gets the job done is fine with me.
    Thanks, - Dave

    I'm sorry, I don't understand your requirement. What do you mean by "remove HTML tags from a page attribute"?
    If you are dealing with a value of an attribute, it is most likely a String, and should be treated as such. The best approach would probably be java coding.

  • Removing HTML Comments from an entire website

    Hi, I wonder if there is a simpler way to remove 'HTML Comments' from an entire website without having to use the regular expression ' <!-- [\w\W]*?--> ' using Find & Replace in DW 8?  Many thanks, Simon

    Thanks Murray, - I guess I was hoping for a 'button' in DW 8 that offered this function without writing a simple regular expression that works just fine. What laziness!  My reasons for removing my HTML comments also puts me in a bad light!!!  Best wishes, Simon

  • Remove vertical scrollbar from multi-row af:inputText

    Hi,
    Is it possible?
    I'm using JDeveloper 11.1.2.1
    I have two text field (af:inputText) and field 2 is a multi line row, which automatically adds extra width for the vertical scrollbar, and throws off the right alignment
    field 1 |________|
    field 2 |_______|v|
    I need both field 1 and 2 to be left and right aligned
    i.e.
    field 1 |_______|
    field 2 |_______|
    Is there a way to do this? I was thinking this could be achieved by removing the vertical scrollbar, but I'm not sure how to do this.
    Also, the application needs to be viewed in both mobile device (iPad) and desktop. Since iPad doesn't use scrollbar (hence it's not rendered), setting both fields to have fixed width won't achieve what i need, because it will be correct in one version, but not both.
    Thank you for any information.
    Regards,
    Andi

    Hi Navaneeth,
    Code:
    <h:panelGrid columns="2" id="pg1">
    <af:outputLabel value="Field 1" id="ol5"/>
    <af:inputText value="#{bindings.ModelCode1.inputValue}"
    required="#{bindings.ModelCode1.hints.mandatory}" columns="#{bindings.ModelCode1.hints.displayWidth}"
    maximumLength="#{bindings.ModelCode1.hints.precision}"
    shortDesc="#{bindings.ModelCode1.hints.tooltip}" id="it4">
    <f:validator binding="#{bindings.ModelCode1.validator}"/>
    </af:inputText>
    <af:outputLabel value="Field 2" id="ol4" shortDesc="#{bindings.Comments.hints.tooltip}"/>
    <af:inputText value="#{bindings.Comments.inputValue}"
    required="#{bindings.Comments.hints.mandatory}" columns="#{bindings.Comments.hints.displayWidth}"
    maximumLength="#{bindings.Comments.hints.precision}" shortDesc="#{bindings.Comments.hints.tooltip}"
    id="it9" rows="#{bindings.Comments.hints.displayHeight}">
    <f:validator binding="#{bindings.Comments.validator}"/>
    </af:inputText>
    </h:panelGrid>
    Current layout:
    http://img607.imageshack.us/img607/4282/fieldalignmentproblem.jpg
    Desired layout (To have it aligned as per the green line):
    http://img338.imageshack.us/img338/7865/fieldalignmentdesired.jpg
    Thanks,
    Andi

  • Using Textarea Scrollbars

    Before I started using Dreamweaver, I used notepad. And I
    would use textarea scrollbars for excessive text.
    http://www.funky-chickens.com/tarea.shtml
    ...At the bottom, where it says Textarea allowing HTML. I usually
    use that on my previous websites. But using dreamweaver, when I
    install that snippet it creates problems and the tables stretch and
    screws up the whole site. How do I make that function work. I
    looked around and couldn't find that option
    Can anyone help me?
    A reference to how I use it:
    http://leyendarecords.com/biography.html
    ... Theres a website I made for someone. If you check out that
    page, you can see that I have scrollbars and text inside it. A
    friend made that template on Dreamweaver and I did everything on
    Notepad. Exactly how do I do that?

    That code is SO ANTIQUE it's unbelievable.
    <ilayer name="scroll1">
    <div id="scroll3"
    style="width:100;height:75;
    background-color:COLORHERE;
    overflow:auto">
    TEXT HTML TEXT HTML
    </textarea></div>The <ilayer> tag is not
    recognized by any browser than
    NN4x, and that browser is nearly extinct. In addition, they
    even omit the
    opening <textarea> tag and the closing </ilayer>
    tag, so in addition to
    being hopelessly antique, it's invalid too.
    > But using dreamweaver, when I install that snippet it
    > creates problems and the tables stretch and screws up
    the whole site. How
    > do I
    > make that function work.
    That's not surprising. DW doesn't know what to do with this
    markup.
    You could try just removing the <ilayer> tag -
    <div id="scroll3"
    style="width:100px;height:75px;background-color:COLORHERE;overflow:auto"><textarea>
    TEXT HTML TEXT HTML</textarea></div>
    but all form elements are required to be within an explicit
    <form>, so
    you'll have to add that -
    <div id="scroll3"
    style="width:100px;height:75px;background-color:COLORHERE;overflow:auto"><form>
    <textarea>TEXT HTML TEXT
    HTML</textarea></form></div>
    And then both the form tag and the textarea tag have some
    necessary
    attributes, so you'll have to add them too....
    I recommend you not use something like this, anyhow. There is
    a good
    discussion on this forum from just today about why it's a
    poor layout/design
    decision....
    Murray --- ICQ 71997575
    Adobe Community Expert
    (If you *MUST* email me, don't LAUGH when you do so!)
    ==================
    http://www.dreamweavermx-templates.com
    - Template Triage!
    http://www.projectseven.com/go
    - DW FAQs, Tutorials & Resources
    http://www.dwfaq.com - DW FAQs,
    Tutorials & Resources
    http://www.macromedia.com/support/search/
    - Macromedia (MM) Technotes
    ==================
    "streekd" <[email protected]> wrote in
    message
    news:[email protected]...
    > Before I started using Dreamweaver, I used notepad. And
    I would use
    > textarea
    > scrollbars for excessive text.
    http://www.funky-chickens.com/tarea.shtml
    > ...At
    > the bottom, where it says Textarea allowing HTML. I
    usually use that on my
    > previous websites. But using dreamweaver, when I install
    that snippet it
    > creates problems and the tables stretch and screws up
    the whole site. How
    > do I
    > make that function work. I looked around and couldn't
    find that option
    >
    > Can anyone help me?
    >
    > A reference to how I use it:
    http://leyendarecords.com/biography.html
    > Theres a website I made for someone. If you check out
    that page, you can
    > see
    > that I have scrollbars and text inside it. A friend made
    that template on
    > Dreamweaver and I did everything on Notepad. Exactly how
    do I do that?
    >

  • Html report scrollbar in LV User Interface

    Hi Everyone
    I'm designing a LV User Interface with a HTML report view. Everything is working nicely except that while the report is being generated the report text becomes wider than the report view causing a horizontal scrollbar to appear which then shifts the report view to the far right hand side. This is annoying and we don't want the operator to constantly have to scroll the horizontal bar across every time.
    How can I disable the Horizontal scrollbar or enable the text to just wrap around. The culprit in the HTML report is when the full path name to the sequence is displayed, if I could at least disable the filename from being written that ought to help. This ought to be done within the reportgen_HTML.seq but where?
    Kurt Friday
    www.sciware.com.au

    Hi
    To help you remove the report path from the report I will need to know what are your report settings.
    Can you please post your "TestStandModelReportOptions.ini" usually found under <TestStand>\cfg folder.
    To try to resolve the issue with the horizontal scroll bar I have a couple of questions:
    1. What version of TestStand are you using
    2. What version of IE is installed on your machine
    3. Can you please post a sample report and a TestStand Sequence File which causes this issue
    4. What is your OS?
    Regards
    Anand Jain
    National Instruments.

Maybe you are looking for