APPEND STRING TO defaultDocumentStyle.

Hi all,
Anyone have an idea how to append or add String to the file,?
For e.g i have some string "Author : Xttrax".
<code>
protected JTextPane editorZone;
protected StyleContext m_context;
protected DefaultStyledDocument docStyle;
protected RTFEditorKit m_kit;
editorZone = new JTextPane();
m_kit = new RTFEditorKit();
editorZone.setEditorKit(m_kit);
m_context = new StyleContext();
docStyle = new DefaultStyledDocument(m_context);
editorZone.setDocument(docStyle);
try {
OutputStream out = new FileOutputStream(fileRead + ".mcf");
m_kit.write(out, docStyle, 0, docStyle.getLength());
out.close();
catch (Exception ex)
ex.printStackTrace();
</code>
while come to the part >
<b> m_kit.write(out, docStyle,0,docStyle.getLength()</b>
can i do something like
docStyle = docStyle.getText + "String";
i want to do this because i wish to append some "Tag" to the file whenever it is "saved"..
thanks for considering my doubts

Try making the textarea larger and see if it still
shows on a new line...Textarea width is very large .There are many line break sometimes all lines
are of different length so there is no issue of word wrap .I check the output
sometimes it gives newline when it encounter space but not always .there are also spaces in single line .Sometimes it gives new line when it encounter >
and sometimes it continue in same line after enconter > .
Thanks

Similar Messages

  • Append string to stringbuffer in same line

    I have stringbuffer in which i append string thiesestring is of variable lengt
    has different value .I want that when i append string to stringbuffer it append
    to same line .I use append method of stringbuffer.But the whole value is not
    in same line it breaks into many line all lines are not of same size.
    Thanks

    Try making the textarea larger and see if it still
    shows on a new line...Textarea width is very large .There are many line break sometimes all lines
    are of different length so there is no issue of word wrap .I check the output
    sometimes it gives newline when it encounter space but not always .there are also spaces in single line .Sometimes it gives new line when it encounter >
    and sometimes it continue in same line after enconter > .
    Thanks

  • Append string in BPEL

    Hello,
    I have three values coming in the XML elements like
    FirstName, LastName and ZipCode
    I want to append these 3 using inside BPEL (using BPEL way) and then at the end also append current TimeStamp.
    So final appended string will look like FirstNameLastNameZipCodeTimeStamp
    How can i go about doing this appending ? also, Do I have to create a holder element that will hold this appended string ?
    thx
    d

    Hi,
    Use Concat(), inside Assign activity, give the values like, concat(FirstName,LastName,ZipCode, currectTime), offcourse this FirstName and other values will come from XML elements which you can select in the Expression Builder
    concat(bpws:getVariableData('inputVariable','payload','/ns4:FirstName'),bpws:getVariableData('inputVariable','payload','/ns4:LastName'),bpws:getVariableData('inputVariable','payload','/ns4:ZipCodeName'),xp20:current-time())
    Next you can create a new Variable and assign this value concat() to it.
    -Yatan

  • Append String to Integer

    Hi Guys,
    I am trying to append a String to Integer like this;
    String areacode = 020;
    Integer phone_no = 21354214;
    Integer full = areacode && phone_no;My problem is how to join the two datatypes to a single Integer value. Do anyone know how to go about this?
    B

    sabre150 wrote:
    Skotty wrote:
    Without debating the logic of doing such a thing...
    Concatenate them as Strings, then convert that String back to an Integer.Your are on the top floor of the Eiffel Tower and a man is trying to climb over the safety netting but having trouble climbing the netting. You ask him why he is doing this and he says he has to get down to the ground as soon as possible but he has an irrational fear of lifts. Do you help him climb the safety netting or do you advise him that this is not a good idea and try to stop him?I get him to use my camera to take my picture.

  • Append String if do not exists!!

    How can we append a string in an array only in case if it do not exists in that array?
    Thanks in advance!!

    You would probably get a better response posting in the Developers Forum.
    Perhaps the hosts will move your post there.

  • Question on JTextArea.append(String str)

    Hi All,
    When i provide JTextArea.append("FMTL") it is showing me on the JTextArea but when i give it as
    String item="Viswanadh";
    JTextArea.append(item).this particular statement is remaming blank on the TextArea.
    Any idea why this is happening and is there any other method to be used instead of append.???
    Thanks in advance..
    regards,
    Viswanadh

    class OnApplyFormat implements ActionListener{
         public void actionPerformed(ActionEvent formatevent){
              JComboBox source = (JComboBox) formatevent.getSource();
                   String item =  source.getSelectedItem().toString();
                     System.out.println("Selected Format is:"+item);
                     try
                       if ( item!=null )
                              System.out.println("Format is:"+item);
                     infoarea.append("FMTL");
                   infoarea.append(item);
                     infoarea.append("\r\n");
                   infoarea.append("FMTU");
                   infoarea.append("\r\n");
                   infoarea.append("wait 5");
                   infoarea.append("\r\n");
              else
                   throw new Exception("FormatNotFoundException");
                          }catch(Exception e){
                          e.printStackTrace();
    }That is my code and still i am facing the same FMTL is not getting appended with the item variable.
    Help me in solving this issue.
    Thanks in advance.
    regards,
    Viswanadh

  • Loop through Timer is ok, but then, how to append string?

    Hi,
    reading thorugh this forum, I was able to create a loop cycle via a timer (http://social.technet.microsoft.com/Forums/en-US/a1d160ba-a7d6-4c5c-aa2a-f724990a3b11/add-repeating-entry-to-collection?forum=projectsiena).
    Now, I would be ready to collect info of a cell, based on an index of the row (or, better, the ID value, which is incremental) of a collection.
    But, how can I append the pulled strings into one final string? So, even if there is the workaround for the loop cycle, how can it be used, other than populate another collection?
    Thanks!
    Fabio

    Hi,
    reading thorugh this forum, I was able to create a loop cycle via a timer (http://social.technet.microsoft.com/Forums/en-US/a1d160ba-a7d6-4c5c-aa2a-f724990a3b11/add-repeating-entry-to-collection?forum=projectsiena).
    Now, I would be ready to collect info of a cell, based on an index of the row (or, better, the ID value, which is incremental) of a collection.
    But, how can I append the pulled strings into one final string? So, even if there is the workaround for the loop cycle, how can it be used, other than populate another collection?
    Thanks!
    Fabio

  • Append strings to file

    Hi,
    How do i modify "write characters to file.vi" such that every time i append a new string to the same file, it will start at a new line?
    There is this parameter in the vi that is called "convert eol"? Read the help file but could not figure out what is a end of line marker. Please help.
    Thanks.

    Hi,
    the easiest way is to concatenate EOL symbol with your string and then write this new string to the file.
    So you will write something like
    EOL"your string". (or "/nyour string" in codes)
    EOL symbol and "Concatenate strings.vi" you can find in "Functions/String/..."
    Good luck.
    Oleg Chutko.

  • How to append strings

    Hi,
    I am trying to append three strings, My middle string will vary upon condition.
    start+middle+end, if middle is "not" I need string to be empty, I tried with ? operator but it is not working. Can you please suggest a simple method and other than using if operator.
    Regards,
    Basil Abraham

    The moment one puts a constraint on such as "other than using if operator" a post starts to look like homework. Since a student's homework should be done by the student one should not provide code. You say you have tried the ternary operator '?' but "it is not working" so you must have done it wrongly. Why not post the code that does not work for the forum members to comment on? You might want to give a an example or two of what a correctly operating program should do.

  • Append string using c tag

    Hi,
    I've a code like this
    <td>
    <c:set var="author" value="${blogEntry.authorDetails}"/>     <c:out value="${author.firstName}"/> 
         <c:out value="${author.lastName}"/>
    </td>
    the problem is both first name and last name are strings,word wrapping is not done perfectly.
    For instance if it is,
    "James Gosling"
    then it may come like ,
    James Gosli
    ng
    so is it possible to append both the string using jstl?
    Thanks,
    mms.

    I think it's caused by the cell column width being too small, not related to the behaviors of jstl tags. You can try it outside of a <td>, or increase the column width.
    -cheng

  • Append String onto inputText value

    Hi all,
    I need to append the string value " - old" onto a value. How do I do this?
    I had: <h:inputText rendered="#{diffHandler.costCode.isDeleted}" id="descriptionOld"
    value="#{diffHandler.costCode.alternateDescription} - old">but when I go to save it, it throws an error. What I need is the -old to be appended onto the value and set when the save is pushed.
    Cheers,
    Illu

    Make a separate property on your backing bean that handles it in the getter and setter.

  • Append string to variable in each iteration of for loop in Powershell.

    Thanks so much I was able to get it working with the following command!
    PowershellGet-Mailbox | where {$_.Name -eq "admin"} | foreach-object {Set-Mailbox -Identity $_.Name -DisplayName "$($_.DisplayName) ABBREVIATION"}
    As for their reasoning behind wanting multiple mailboxes, they seem to be wanting to operate as 2 separate entities still. So their old clients still work with them under the old company name and they are paranoid about having names crossover mistakenly. We did try to get them to switch over to 1 mailbox and demonstrated it for them, but this is what they requested.

    I have to ask - why keep two separate mailboxes for each user rather than just have one mailbox with multiple addresses?But yes, you can concatenate just like other languages. You have two problems currently -
    1. You aren't referencing anything with "$.DisplayName". You need to use "$_.DisplayName" and you need to use it in a Foreach-Object script block.2. You need to pass the concatenated string as a single argument to the -DisplayName parameter. There are several ways to do this but the problem you're having is because there is whitespace in your argument.
    PowershellGet-Mailbox | where {$_.Name -eq "admin"} | foreach-object {Set-Mailbox -DisplayName ($_.DisplayName + ' ABBREVIATION')}#ORGet-Mailbox | where {$_.Name -eq "admin"} | foreach-object {Set-Mailbox -DisplayName "$($_.DisplayName)ABBREVIATION"}

  • Append string to each column value

    Version:11.2
    create table test1 (name1 varchar2(10));
    insert into test1 values ('JUPITER');
    insert into test1 values ('EARTH');
    insert into test1 values ('MARS');
    insert into test1 values ('VENUS');
    commit;
    SQL> select * from test1;
    NAME1
    JUPITER
    EARTH
    MARS
    VENUSFor each values of this table, I want three rows to be returned with the string
    JUPITER is a planet
    JUPITER is almost round
    JUPITER revolves around the sun
    EARTH is a planet
    EARTH is almost round
    EARTH revolves around the sun
    MARS is a planet
    MARS is almost round
    MARS revolves around the sun
    .Any idea how I could do this ?

    You'll need to cross join a set of three rows to your base table.
    There are different ways to do it, for example :
    SQL> select name1 ||
      2         case n when 1 then ' is a planet'
      3                when 2 then ' is almost round'
      4                when 3 then ' revolves around the sun'
      5         end as final_name
      6  from test1
      7       cross join (
      8         select level n
      9         from dual
    10         connect by level <= 3
    11       )
    12  order by 1
    13  ;
    FINAL_NAME
    EARTH is a planet
    EARTH is almost round
    EARTH revolves around the sun
    JUPITER is a planet
    JUPITER is almost round
    JUPITER revolves around the sun
    MARS is a planet
    MARS is almost round
    MARS revolves around the sun
    VENUS is a planet
    VENUS is almost round
    VENUS revolves around the sun
    12 rows selected
    SQL> select name1 || text as final_name
      2  from (
      3    select name1
      4         , ' is a planet' as text1
      5         , ' is almost round' as text2
      6         , ' revolves around the sun' as text3
      7    from test1
      8  )
      9  unpivot (text for text# in (text1, text2, text3))
    10  ;
    FINAL_NAME
    JUPITER is a planet
    JUPITER is almost round
    JUPITER revolves around the sun
    EARTH is a planet
    EARTH is almost round
    EARTH revolves around the sun
    MARS is a planet
    MARS is almost round
    MARS revolves around the sun
    VENUS is a planet
    VENUS is almost round
    VENUS revolves around the sun
    12 rows selected

  • Appending string to the start of a file problem

    Hi guys,
    I've got an xml file which i want to add a dtd to. So i'm using RandomAccessFile to seek the start of the file and write to it, but its seems to be overwriting a small part of my file. My code to this is below:
             try {
             RandomAccessFile f = new RandomAccessFile(xmlMap,"rw");
                f.seek(0);
            //write DTD definition to start of file
             f.writeChars("<?xml version=\"1.0\" encoding=\"UTF-8\"?>"+"\n"+
                     "<!DOCTYPE map SYSTEM \"mapDTD.dtd\">"+"\n");
             f.close();
             } catch(IOException e) {
                  System.out.println("ERROR with file name, game exiting");
                  System.exit(1);
             }If i take in this xml file:
    <map width="19" height="19" goal="6" name="Hallways of Dooom">
         <random-item type='lantern' amount='5' />
         <random-item type='health' amount='10' />
         <tile x="0" y="0" type="floor" />
         <tile x="1" y="0" type="floor">
              <renderhint>floor:wood</renderhint>
         </tile>
         <tile x="2" y="0" type="floor" />
         <tile x="3" y="0" type="wall" />
         <tile x="4" y="0" type="wall" />
         <tile x="5" y="0" type="wall">
              <renderhint>wall:bricks,cracked</renderhint>
         </tile>it gets overwritten as :
    <?xml version="1.0" encoding="UTF-8"?>
    <!DOCTYPE map SYSTEM "mapDTD.dtd">
         <tile x="0" y="0" type="floor" />
         <tile x="1" y="0" type="floor">
              <renderhint>floor:wood</renderhint>
         </tile>
         <tile x="2" y="0" type="floor" />
         <tile x="3" y="0" type="wall" />
         <tile x="4" y="0" type="wall" />
         <tile x="5" y="0" type="wall">
              <renderhint>wall:bricks,cracked</renderhint>
         </tile>I want it so it is :
    <?xml version="1.0" encoding="UTF-8"?>
    <!DOCTYPE map SYSTEM "mapDTD.dtd">
    <map width="19" height="19" goal="6" name="Hallways of Dooom">
         <random-item type='lantern' amount='5' />
         <random-item type='health' amount='10' />
         <tile x="0" y="0" type="floor" />
         <tile x="1" y="0" type="floor">
              <renderhint>floor:wood</renderhint>
         </tile>
         <tile x="2" y="0" type="floor" />
         <tile x="3" y="0" type="wall" />
         <tile x="4" y="0" type="wall" />
         <tile x="5" y="0" type="wall">
              <renderhint>wall:bricks,cracked</renderhint>
         </tile>
         <tile x="6" y="0" type="wall" />
         <tile x="7" y="0" type="wall" />
         <tile x="8" y="0" type="wall">
              <renderhint>wall:rock,cracked</renderhint>
         </tile>If anyone can see what's going wrong and how i can correct, i would greatly appreciate them saying so.
    Thanks a lot.

    javaUser wrote:
    Hi guys,
    I've got an xml file which i want to add a dtd to. So i'm using RandomAccessFile ...That's your mistake. Don't use random access file. It wasn't built for this situation and shouldn't be used for this situation. Do the right thing: rewrite the whole file.

  • Append a constant string to every element in an array

    Hi Friend,
    I have a small stuck in my labview program that is I need to append a constant string to each element of an array. Could someone provide guidance on this? Prior thanks to your help.
    Have a nice day!
    Lee Joon

    Pass the array into a for loop with autoindexing; concatenate each element with the constant and then use the array output from the loop...
    I was a few seconds behind the post above; great minds think alike!
    Message Edited by Phillip Brooks on 11-15-2007 08:42 AM
    Now is the right time to use %^<%Y-%m-%dT%H:%M:%S%3uZ>T
    If you don't hate time zones, you're not a real programmer.
    "You are what you don't automate"
    Inplaceness is synonymous with insidiousness
    Attachments:
    Append String.gif ‏33 KB

Maybe you are looking for

  • Error Message for the cancellation of paid billing document

    Hi, Can i create and error message for the cancellation of paid billing document? If yes, how can i create such. Overview: Accounting document is created upon creation of billing document. Upon payment, document cleared is the accounting document cre

  • All of a sudden I can no longer watch videos I have rented they will not stream

    I have iPad 2 and Have had my apple Tv 2 for about a month. Everything has been working great. Rented movies on the iPad and have watched them thru my Apple TV with no problems. then yesterday I had trouble streaming, the movies will start playing on

  • How to convert word documen to pdf using Adobe Acrobat 9.0

    I have just installed Adobe Acrobat 9.0 on my notebook. I'm having a little trouble when I had to convert a Word document to PDF because the results are not in accordance with the display on the monitor screen. The layout of the image is slightly cha

  • Payment Terms - NT30

    Hi All... While creating to customer 'Sold-to-Party' i have to select the payment terms as 'NT30' in the company code details... When i am checking the F4 entries it is showing 0001...0009 payement  terms. How i have to activate this NT30 Payment ter

  • Company code change involves invalid change of country

    Hi collegues, we are facing one problem. We would like to change Cost Centre to root org. unit in IT 1001 (A 011) and when we do that, the next message apearrs: Company code change involves invalid change of country Message no. PD002 Diagnosis The ch