RTF Text - PLain Text

Can I use the swing.text.rtf library to convert RTF text into plain text? If so, what's a quick way to do so? What I need to do is parse some given string of RTF code to see if there is any actual text inside (other than just RTF commands)
I wanted to use PDFFilter as referenced in PDFParser but apparently that class does not exist

sorry for resing the topic but I have almost exact same problem. However when I tested this solution it doesnt seem to work so I figured you may tell me what am I doing wrong. I have the following code
import java.io.*;
import javax.swing.*;
import javax.swing.text.*;
import javax.swing.text.rtf.*;
public class rtf2text {
  public static void main(String args[]) {
    try {
         StringReader sr = new StringReader("{\\lang1033\\langfe1049\\langnp1033  text \\par \\par \\par Some table \\par \\par \\par}");
      JEditorPane editor = new JEditorPane();
      RTFEditorKit kit = new RTFEditorKit();
      editor.setEditorKit(kit);
      javax.swing.text.Document doc = editor.getDocument();
      kit.read(sr, doc, 0);
      String s = doc.getText(0, doc.getLength());
      System.out.println("sAttachment\n >" + s + "<");
    catch (Exception ex) {
      ex.printStackTrace();
}and it doesnt return anything i.e. s="". What am doing wrong?

Similar Messages

  • Issue Using C# to Get RTF Text From Clipboard to Outlook With Formatting and Without Encoding Tags

    I have created a little application that gathers data from various text boxes and then combines the data into a formatted richTextBox.  A person using the tool asked if I could then add a button that would allow that text (with formatting) to be copied
    and pasted into an Outlook Email.  When I do this, I can get the text into an email, but I either strip out the formatting or I get all the RTF encoding tags to come along with it. 
    I have tested to see that the copy of the data from the richTextBox has indeed made it to the clipboard correctly.  This has been verified by the fact that I can manually press "ctrl" + "v" and I can past the text with proper
    formatting into the mail body.
    I do know that I can brute force things by trying to manually wrap HTML tags around my textBox fields and then pipe that into an HTMLBody property.  In fact I can get a lot of things to work with the HTMLBody property, but while it is nice that will
    work, I feel that I must be missing something really simple while trying to work with RTF.
    I currently am pasting (using the Clipboard.GetText(TestDataFormat.RTF)) the RTF data into the Body property of the mail item.  This is bringing in all the RTF encoding tags.  I have tried to paste this directly into the RTFBody of the mail item,
    yet an execption gets thrown when executed.  Oddly, though, if I change RTFBody to HTMLBody, I do not get the exception, but I still have the RTF encoding tags in it.  Though if I feed the HTMLBody property straight, HTML text with the encoding tags,
    it will render properly.
    This has me confused then why if I feed HTMLBody HTML text with the encoding tags that it will render, but if I try and do the same for RTFBody and feed it RTF text with encoding tags it still throws an exception.  Any help in the matter would be greatly
    appreciated.  I have included the code snippet below for sending the richTextBox information to the clipboard and then attempting to retrieve it and paste it into an Outlook email.
    Thanks for the help.
    Some pertinent information:
    Blend for Visual Studio 2015 CTP6 (I switched from VS2012 as intellisense was added to Blend in 2015)
    Because of this Systems.Windows.Forms is not in use
    private void buttonEmail_Click(object sender, RoutedEventArgs e)
    //Copy richTextBox information to Clipboard
    Clipboard.Clear();
    richTextBox.SelectAll();
    richTextBox.Copy();
    //Get current date to add to email subject line
    DateTime myNewDate = new DateTime();
    myNewDate = DateTime.Now;
    //Create Email
    Outlook.Application myNewApplication = new Outlook.Application();
    Outlook.MailItem myNewMailIoI = myNewApplication.CreateItem(Outlook.OlItemType.olMailItem) as Outlook.MailItem;
    myNewMailIoI.To = " "; //An attempt to ensure that the focus moves down to the body field
    myNewMailIoI.Subject = "IoI - " + myNewDate.Date.ToString("d");
    myNewMailIoI.BodyFormat = Outlook.OlBodyFormat.olFormatRichText;
    //Pasting data into body of email
    myNewMailIoI.Body = Clipboard.GetText(TextDataFormat.Rtf); //This will past the text with encoding tags into email
    //If this section is uncommented, it will add a properly formatted HTML text to the email
    //myNewMailIoI.BodyFormat = Outlook.OlBodyFormat.olFormatHTML;
    //myNewMailIoI.HTMLBody = "<p>This stinks!!!</p>" + "<p style='color: green; font-size:10pt; font-family:arial'>different font and color</p>";
    myNewMailIoI.Display(); //Allow for window to be minimized
    myNewMailIoI.Display(true);

    Ok, I found the solution.  Part of the issue was caused by the confusion of the HTML body property acting as a text encoder for HTML text when a string is passed in vs the RTF Body property needing to have a plain text file taken and encoded into a
    byte stream.  Even though the RTF text is in readable text (albeit with the RTF Encoding Tags) it needs to be reencoded into a series of bytes. 
    This is where I failed to understand the previous answers.  I knew that RTF Body needed to have a array of bytes, and the previous answers seemed to indicate that the data in the clipboard was already in this byte format (this may have just been my
    misunderstanding) and that I needed to somehow take this byte array and do something with it.  My misunderstanding was that all the methods for getting values from the clipboard returned strings and not bytes.
    after some digging last night and with the few hints that were offered before, I came across a post on CodeProject (apparently I cannot post links, so I will try and include this so that you can find the postcodeproject(DOTCOM)/Questions/766917/How-to-convert-richtextbox-output-into-bytearray). 
    This showed that I needed to take the raw, RTF text with its RTF encoding tags from the clipboard and and encode it to a byte array and then pass this into the RTF Body property.  Included below is the final code such that I hope that it helps some other
    person as there seem to be a lot of searches for this on the web, but not a lot of direct answers.
    using System.Text;
    using Outlook = Microsoft.Office.Interop.Outlook;
    private void buttonEmail_Click(object sender, RoutedEventArgs e)
    //Copy richTextBox information to Clipboard
    Clipboard.Clear();
    richTextBox.SelectAll();
    richTextBox.Copy();
    //Get current date to add to email subject line
    DateTime myNewDate = new DateTime();
    myNewDate = DateTime.Now;
    //Create Email
    Outlook.Application myNewApplication = new Outlook.Application();
    Outlook.MailItem myNewMailIoI = myNewApplication.CreateItem(Outlook.OlItemType.olMailItem) as Outlook.MailItem;
    //Add Subject
    myNewMailIoI.Subject = "IoI - " + myNewDate.Date.ToString("d");
    //Set Body Format to RTF
    myNewMailIoI.BodyFormat = Outlook.OlBodyFormat.olFormatRichText;
    //Converting RAW RTF data from string to bytes. THIS IS THE FIX THAT WAS NEEDED TO MAKE IT WORK
    string myNewText = Clipboard.GetText(TextDataFormat.Rtf);
    byte[] myNewRtfBytes = Encoding.UTF8.GetBytes(myNewText); //This line cost me way too many hours of lost sleep!!!
    //Inserting RTF bytes into RTFBody property
    myNewMailIoI.RTFBody = myNewRtfBytes;
    myNewMailIoI.Display(); //Displays the newlycreated email
    //If this section is uncommented, it will add a properly formatted HTML text to the email
    //myNewMailIoI.BodyFormat = Outlook.OlBodyFormat.olFormatHTML;
    //myNewMailIoI.HTMLBody = "<p>This works for the HTMLbody property!!!</p>" + "<p style='color: green; font-size:10pt; font-family:arial'>this renders properly</p>";

  • [ANN] Xtrema Unicode RTF Text Member, alpha version

    Xtrema Unicode RTF Text Member, alpha version.
    For Director 8.5 and above, windows NT4, 98 and above.
    http://xtrema.rtr.gr/cDown/
    Features of the final release (progress state)
    Unicode (utf-16) support. (done)
    Rich Text Format support. (done)
    East European + Asian + RTL Language support. (done)
    Embedded Images. (done)
    Common shortcuts / controls :
    http://msdn2.microsoft.com/en-us/library/ms651760.aspx
    (done)
    Mouse Wheel support. (done)
    Drag & Drop functionality. (drag only)
    Copy to / paste from Clipboard. (done)
    Insert rtf data into rtf selection. (not enabled)
    Full character/line position/dimension (rect) info. (done)
    Event driven operation (e.g. on xKeyDown/up - with unicode
    key info, plus
    mouseWheel) (done)
    Support for virtual sprites (one member, many sprites) (not
    tested)
    Support for memberless objects. (not tested)
    Extended (object driven) text formatting support. (-)
    Rich Text, or Plain Text operation. (rich text only)
    Character masking (for password entry) (not enabled)
    Horizontal / Vertical scrolling (not enabled, auto only)
    Zooming (not enabled)
    Hyperlink support (-)
    Auto stretching to fit Director's stage zoom (done)
    Ink support (blend only)
    Generate 32 bit image object (not enabled)
    This member has been created from a personal wish list based
    on years of
    experience with director's text objects.
    If something else comes to mind, or if you wish to join the
    beta testers
    list, please feel free to contact xtrema at rtr gr.
    Regargs,
    - alchemist.

    Xtrema Unicode RTF Text Member, alpha version.
    For Director 8.5 and above, windows NT4, 98 and above.
    http://xtrema.rtr.gr/cDown/
    Features of the final release (progress state)
    Unicode (utf-16) support. (done)
    Rich Text Format support. (done)
    East European + Asian + RTL Language support. (done)
    Embedded Images. (done)
    Common shortcuts / controls :
    http://msdn2.microsoft.com/en-us/library/ms651760.aspx
    (done)
    Mouse Wheel support. (done)
    Drag & Drop functionality. (drag only)
    Copy to / paste from Clipboard. (done)
    Insert rtf data into rtf selection. (not enabled)
    Full character/line position/dimension (rect) info. (done)
    Event driven operation (e.g. on xKeyDown/up - with unicode
    key info, plus
    mouseWheel) (done)
    Support for virtual sprites (one member, many sprites) (not
    tested)
    Support for memberless objects. (not tested)
    Extended (object driven) text formatting support. (-)
    Rich Text, or Plain Text operation. (rich text only)
    Character masking (for password entry) (not enabled)
    Horizontal / Vertical scrolling (not enabled, auto only)
    Zooming (not enabled)
    Hyperlink support (-)
    Auto stretching to fit Director's stage zoom (done)
    Ink support (blend only)
    Generate 32 bit image object (not enabled)
    This member has been created from a personal wish list based
    on years of
    experience with director's text objects.
    If something else comes to mind, or if you wish to join the
    beta testers
    list, please feel free to contact xtrema at rtr gr.
    Regargs,
    - alchemist.

  • How to make a copy of DefaultStyledDocument Object for RTF text ?

    Hi All,
    In my application, I need to copy RTF text from Org_Default_Styled_Document to New_Default_Styled_Document (both are independent objects.)
    For this I wrote the below method :
    public DefaultStyledDocument copyRTFStyledDocument(DefaultStyledDocument  Org_Default_Styled_Document)
              DefaultStyledDocument New_Default_Styled_Document = null;
              try
                            // writing RTF byte[] to output stream.
                   ByteArrayOutputStream bOData = new ByteArrayOutputStream();
                   rtfKitEditor.write(bOData, Org_Default_Styled_Document, 0, Org_Default_Styled_Document.getLength());
                            // reading RTF byte[] from input stream.
                   ByteArrayInputStream bIData = new ByteArrayInputStream(bOData.toByteArray());
                   New_Default_Styled_Document = new DefaultStyledDocument();
                   rtfKitEditor.read(bIData, New_Default_Styled_Document, 0);
              }  catch(BadLocationException e)   {
                e.printStackTrace();
              catch(IOException e)        {
                e.printStackTrace();
           return New_Default_Styled_Document;
      }I am able to see an extra 'enter' character (i.e, "\n") added to New_Default_Styled_Document.
    I tried to figure out the problem by digging API classes like RTFEditorKit.java and RTFGenerator.java, I observed that an extra 'enter' character is adding at the below method of RTFGenerator.java
    public void writeRTFTrailer()
        throws IOException
        writeEndgroup();
        writeLineBreak();
    public void writeLineBreak()
        throws IOException
        writeRawString("\n");
        afterKeyword = false;
    }I used
    New_Default_Styled_Document.remove(Org_Default_Styled_Document_Length, 1); to remove the extra 'enter character from New_Default_Styled_Document every time. Its workaround only.
    Can any one please help me how to make a new copy / clone of DefaultStyledDocument ? Is there any alternate solution which does not add any extra character when we make a copy of DefaultStyledDocument ?
    Its very urgent. I am trying a lot.
    Thanks in advance
    Satya.

    You will need to define an Organization hierarchy.
    1. Define your company as a Business Group and define the 3 child companies as Organizations (HR Organizations).
    2. Define Organization Hierarchy with 3 child organizations as child of the Business Group. You can further add organizations as childs to those three in the hierarchy.
    3. Define 3 security profiles (Security > Profile) marking View Employees / Contingent workers / Applications / Contacts as restricted. Click in the Organization Security tab. Select the option of Secure by Organization hierarchy option. Click in Organization hierarchy and select the one defined in step 2. Click in top Organization and select Company 1 / 2 /3 for each of the Security Profile. Check the box Include Top Organization. Also select the check box Restrict on Individual assignments option. Save the security profile(s).
    4. Define 3 HR Responsibilities (e.g. Company 1 HR, Company 2 HR, Company 3 HR). Using system profile HR:Security Profile, attach corresponding security profile to each of the responsibilities. Profile value of HR: Business Group is same for all the responsibilities.
    5. Run the Concurrent Program "Security List Maintenance" for each of the security profile.
    From now, One responsibility can not view data from another Organization and its child Orgs.

  • RTF text with background colour - formatting lost in editable RTF export

    Hi
    I have designed a report in CR2008 using XSD datasource.
    I have a field which returns a RTF text. The text comes out correctly when I run the report. 
    Scenario:
    1.Background colour (eg Yellow) has been applied to the field
    2.RTF text contains paragraph breaks
    Result
    The background appears for each paragraph and where there a para break, there is white space. In other words, I want the background colour to appear for the entire field. Right now, it appears odd because I have white spaces between each paragraph with the background colour for each paragraph
    Example:
    Text is as below (with RTF coding)
    In a bad mood? Don't worry   according to research, it's good for you.
    An Australian psychology expert who has been studying emotions has found being grumpy makes us think more clearly.
    In contrast to those annoying happy types, miserable people are better at decision making and less gullible, his experiments showed.
    While cheerfulness fosters creativity, gloominess breeds attentiveness and careful thinking, Professor Joe Forgas told Australian Science Magazine.
    My export type is Editable RTF. The background colour is maintained when you choose Word for Windows option or PDF (but this is not what I want to use in the report). Can the background be maintained for Editable RTF? Is there a work around for this problem?
    Thanks

    Please re-post if this is still an issue or purchase a case and have a dedicated support engineer work with you directly:
    http://store.businessobjects.com/store/bobjamer/DisplayProductByTypePage&parentCategoryID=&categoryID=11522300?resid=-Z5tUwoHAiwAAA8@NLgAAAAS&rests=1254701640551

  • Copy/Paste of RTF text from Java to Word

    Hiya
    I am trying to transfer info from Java to MS-Word via the Clipboard, I have had a look and a play with the code given in the tutorial at
    http://java.sun.com/docs/books/tutorial/uiswing/components/generaltext.html
    But even thought it is implied that the copy and paste of the RTF text will paste in styled text, it does not. Just simple text arrives.
    Any hints, links, examples or acts of god to help a desperate programmer would be appreciated.
    thanks and cya
    Storm

    Sorry it took me this long (over a year!) to get back to you all, but thanks for the info.
    In that time due to ugrades the above URL has changed to
    http://java.sun.com/j2se/1.4.2/docs/guide/swing/1.4/dnd.html
    and will prob oon change again to version 1.5
    Thanks again (deposited Duke$)
    Efran

  • Font RTF text settings

    Hi ,
    can any one tell me what will be the RTF Text for Verdana .
    Ive created a custom font Verdana, for the purpose of form printing

    Hi Sridhar,
    Which Arabic font you are using?
    Yes it is necessary to upload a font.
    RTF text for Arabic is
    \fbidi\fcharset &&& Miriam
    Regards,
    Suresh

  • Plz help me.....How to write rtf text in a file

    Hi all,
    i m creating a rtftextEditor.. with bold, italic ,underline, strikethroug features... i want to save the text with this attributes in a file but the strikethrough attribute does not save in the file.
    the code for that i write is..
    File file=new File(curFileName);
    OutputStream fo=new FileOutputStream(file);
    rtf.write(fo,doc,0,doc.getLength());
    fo.close();
    so wat can i do now.plz help me
    Regards...

    Sun's RTF package is old and I am not sure they have plan to update it. Many RTF keywords are not handled by the java RTF package. You might want to modify their rtf package. Most of the files in this package are protected, only the RTFEditorKit is public. Look into the src.zip file and check out the RTFGenerator.java file.

  • Editing Rtf Text

    We are running Authorware 6.5 & want to give users the
    ability to edit text, read from external files. This is straight
    forward with a simple text file (filename.txt) where we can read
    the data from a file then write back the amended data to the file.
    We are having problems doing this with formatted text
    (filename.rtf).
    Is it possible for users to access the Rtf Objects Editor? If
    not, is it possible for Authorware to open the filename contained
    in a variable using Microsoft Word?

    Most computers have it already.
    "Apurva Lawale" <[email protected]> wrote in
    message
    news:einhr0$7ke$[email protected]..
    > Well, the Microsoft RTF ActiveX Control needs license to
    distribute.
    > Please do check out any licensing issues before
    distributing.
    >
    > Example:
    http://www.theofficeexperts.com/forum/showthread.php?t=1867
    >
    > Best Regards,
    > Apurva
    >
    http://www.apurvalawale.com/
    - "Home of alBrowser and Amigo"
    >
    http://learning.apurvalawale.com/
    - "Learn authorware tips and tricks"
    >
    http://amigo.apurvalawale.com/
    - "A friendly search"
    >
    >
    > "Amy Blankenship *AdobeCommunityExpert*"
    > <[email protected]> wrote in
    message
    > news:einh0n$6lj$[email protected]..
    >> You can embed an RTF ActiveX control.
    >> "TomWhite" <[email protected]>
    wrote in message
    >> news:ein90d$qcs$[email protected]..
    >>> We are running Authorware 6.5 & want to give
    users the ability to edit
    >>> text,
    >>> read from external files. This is straight
    forward with a simple text
    >>> file
    >>> (filename.txt) where we can read the data from a
    file then write back
    >>> the
    >>> amended data to the file. We are having problems
    doing this with
    >>> formatted text
    >>> (filename.rtf).
    >>>
    >>> Is it possible for users to access the Rtf
    Objects Editor? If not, is it
    >>> possible for Authorware to open the filename
    contained in a variable
    >>> using
    >>> Microsoft Word?
    >>>
    >>
    >>
    >
    >

  • Printing RTF-Text using JTextPane

    G'day
    Does someone know how to print the drawed content of a JTextPane/JEditorPane?
    I derived a class from JTextPane and implemented Printable:
    public void print(Graphics g)
      paintComponent(g);
    public void paintComponent(Graphics g)
      super.paintComponent(g);
    }Seems a little ugly, uhm?! It does not work :(
    I get the following errors:
    java.lang.NullPointerException
         at java.util.Hashtable.get(Hashtable.java:336)
         at java.awt.Component.getFontMetrics(Component.java:2503)
         at javax.swing.JComponent.getFontMetrics(JComponent.java:1589)
         at com.sun.java.swing.SwingUtilities2.getFRC(SwingUtilities2.java:368)
         at com.sun.java.swing.SwingUtilities2.drawChars(SwingUtilities2.java:576)
         at javax.swing.text.Utilities.drawTabbedText(Utilities.java:159)
         at javax.swing.text.GlyphPainter1.paint(GlyphPainter1.java:102)
         at javax.swing.text.GlyphView.paintTextUsingColor(GlyphView.java:472)
         at javax.swing.text.GlyphView.paint(GlyphView.java:463)
         at javax.swing.text.BoxView.paintChild(BoxView.java:144)
         at javax.swing.text.BoxView.paint(BoxView.java:407)
         at javax.swing.text.BoxView.paintChild(BoxView.java:144)
         at javax.swing.text.BoxView.paint(BoxView.java:407)
         at javax.swing.text.ParagraphView.paint(ParagraphView.java:584)
         at javax.swing.text.BoxView.paintChild(BoxView.java:144)
         at javax.swing.text.BoxView.paint(BoxView.java:407)
         at javax.swing.plaf.basic.BasicTextUI$RootView.paint(BasicTextUI.java:1338)
         at javax.swing.plaf.basic.BasicTextUI.paintSafely(BasicTextUI.java:643)
         at javax.swing.plaf.basic.BasicTextUI.paint(BasicTextUI.java:781)
         at javax.swing.plaf.basic.BasicTextUI.update(BasicTextUI.java:760)
         at javax.swing.JComponent.paintComponent(JComponent.java:743)
         at fd.gui.Component.paintComponent(Component.java:149)Does that make any sense?
    Btw: I used Sun JRE 1.5 (Ubuntu)
    Cahadras
    Edited by: Cahadras on Oct 23, 2007 1:50 PM

    Cahadras wrote:
    ....It must be an internal bug of the Sun VM that causes this NullPointerException when the JTextPane class passes Font instances to JComponent.getFontMetrics().You may be right, but I'm going to say "careful there partner" to your statement claiming that the Sun VM must have a bug. Please see this excellent web site titled "How to Ask Questions the Smart Way" and is found here:
    http://www.catb.org/~esr/faqs/smart-questions.html
    Here's a subsection of that page titled:
    Don't Claim that you've found a bug:
    When you are having problems with a piece of software, don't claim you have found a bug unless you are very, very sure of your ground. Hint: unless you can provide a source-code patch that fixes the problem, or a regression test against a previous version that demonstrates incorrect behavior, you are probably not sure enough. This applies to webpages and documentation, too; if you have found a documentation �bug�, you should supply replacement text and which pages it should go on.
    Remember, there are many other users that are not experiencing your problem. Otherwise you would have learned about it while reading the documentation and searching the Web (you did do that before complaining, didn't you?). This means that very probably it is you who are doing something wrong, not the software.
    The people who wrote the software work very hard to make it work as well as possible. If you claim you have found a bug, you'll be impugning their competence, which may offend some of them even if you are correct. It's especially undiplomatic to yell �bug� in the Subject line.
    When asking your question, it is best to write as though you assume you are doing something wrong, even if you are privately pretty sure you have found an actual bug. If there really is a bug, you will hear about it in the answer. Play it so the maintainers will want to apologize to you if the bug is real, rather than so that you will owe them an apology if you have messed up.

  • Different rich text/plain text settings for different accounts?

    I use Mail for both my work email (MS Exchange) and my personal email (webmail/IMAP). Many of my coworkers use Outlook's rich text formatting options, so I need to have my work emails go out as rich text. However I'd like to have my personal emails go out as plain text.
    I can set Mail to create new messages in plain text, but to reply in the same format of the original message. That takes care of everything EXCEPT when I compose a new message using my work address... in that case it goes out as plain text, and my coworkers complain that they can't use formatting, because their copies of Outlook are in turn configured to reply in the same format as the original message.
    So ideally what I'd like is to have two different formatting settings for my two different accounts. Anyone know how this might be done? Any plugins, etc., that might accomplish this?

    Since you are running Jaguar, Jaguar and Panther Mail do not support composing in HTML and this includes when forwarding a message received that was composed in HTML.
    Since Jaguar and Panther Mail do not support composing or forwarding HTML, you can't embed images or photos in the message body anyway.
    RTF with Tiger Mail is really HTML and although Tiger Mail does not include an HTML composer/editor, you can copy/paste HTML format from a web page and forward HTML received.
    Images/photos and single page PDF attachments are revealed as inline or viewed in place within the body of the message by default which cannot be turned off. This applies to received and sent messages which is not the same as being embedded. Embedded requires HTML and an embedded attachment is not a true attachment. All Mail.app versions render HTML received but you cannot attach a photo or image as embedded with Jaguar or Panther Mail so it doesn't matter if you use RTF or Plain Text in regards to photo/image or single page PDF attachments which appear as inline or viewed in place within the body of the message by default regardless.
    When you use Plain Text for message composition, the receiving mail client renders the text in whatever font the reader chooses.
    IMO, everyone should use Plain Text for message composition. Messages would be boring to some but the majority if not all problems experienced with email would be eliminated if HTML was banned from message composition.

  • How do you verify the size of a large ( 32K) plain text body

    Hello All,
    I am running GW 8.0.2 Hot Patch 3, using SOAP schema 1.04.
    When I attempt to process a message, that contains only a plain text body with a size (in bytes) of 64,382 - the following sizes are reported by objects extracted from GroupWise, via SOAP calls:
    Message Size: 71,425 (should be bigger than the plain text body).
    Message Part [0] length: 70,854 - no idea where this value comes from
    In the getAttachmentResponse object, the part has:
    length: 87,772 - Which matches the Base64 encoded length, plus padding, of the plain text.
    The actual size of the plain text (on disk): 64,382
    I am hoping to use the HTTP GET method for extracting the large plain text object, which means that I will not have access to the getAttachmentResponse object.
    So my question is, based on the MessageBody, MessagePart[0] length of 70,854 - is there a formula, or other way to determine the correct expected byte size of the plain text object to enable me to verify that the HTTP GET operation or the SOAP getAttachmentRequest completed correctly?
    Regards,
    Dave Stiller.

    Hey Preston,
    Thanks for the prompt response. Not the answer that I was seeking, but none the less an answer. Thanks.
    Can I suggest an enhancement for a future release, to add an additional structure to the message object that allows you to detail the available formats and byte sizes of the formats that relate to the message body object. This could even be an extension/completion of the MessagePart object array on the Message Body. (One array component for each available format.) There are no issues when dealing with large body texts as attachments, but an accurate byte count is important to me.
    This will enable us to verify that the message body content, downloaded from GroupWise, has not be corrupted during transfer - particularly important when using HTTP requests.
    Have a great day,
    Dave...
    Originally Posted by Preston Stephenson
    You will have to be careful in getting message bodies.
    The plain text message body can come from different
    sources and / or formats.
    The message body can be stored in RTF format.
    You can extract the plain text from the RTF text.
    If there is a text.htm message body attachment, the
    GW Client will extract the text plain text from the
    text.htm attachment and will ignore the text plain
    message body attachment.
    There can be corruptions in the message body
    attachment. The attachment can report a certain
    size, but the actual data may be different.
    You have to assume what is stored / returned is
    correct. If you are bound and determined to read
    the number of bytes recorded, you can cause
    problems. There was one case where the attachment
    was corrupt. The POA returned all the data that
    was available. The application tried to read past
    the end of the valid data and caused the POA to
    crash.
    You get all of the data in one HTTP GET call. In
    that case, the "Content-Length" header will have
    the number of bytes in the message body attachment.
    Preston
    >>> On Sunday, August 12, 2012 at 11:36 PM,
    stillerd<[email protected]> wrote:
    > Hello All,
    >
    > I am running GW 8.0.2 Hot Patch 3, using SOAP schema 1.04.
    >
    > When I attempt to process a message, that contains only a plain text
    > body with a size (in bytes) of 64,382 ‑ the following sizes are
    reported
    > by objects extracted from GroupWise, via SOAP calls:
    >
    > Message Size: 71,425 (should be bigger than the plain text body).
    > Message Part [0] length: 70,854 ‑ no idea where this value comes from
    >
    > In the getAttachmentResponse object, the part has:
    > length: 87,772 ‑ Which matches the Base64 encoded length, plus padding,
    > of the plain text.
    >
    > The actual size of the plain text (on disk): 64,382
    >
    > I am hoping to use the HTTP GET method for extracting the large plain
    > text object, which means that I will not have access to the
    > getAttachmentResponse object.
    >
    > So my question is, based on the MessageBody, MessagePart[0] length of
    > 70,854 ‑ is there a formula, or other way to determine the correct
    > expected byte size of the plain text object to enable me to verify that
    > the HTTP GET operation or the SOAP getAttachmentRequest completed
    > correctly?
    >
    > Regards,
    > Dave Stiller.

  • RTF inccorect text when I export my Crystal Report to PDF

    Hello,
    I'm facing a quite unusual problem.
    I've developped a VB.NET 2008 application for my customer that creates Crystal Reports from manually-entered text.
    There's a part where the user can enter RTF text in a RichTextBox control, or import from a RTF File.
    Here's what I do :
    I'm typing a three-lines example in Word 2007 and save it in RTF.
    Then I import it in my application into the RichTextBox.
    When I display the report, everything looks fine, but when I export it to PDF, "i" letters are inserted after each "t" letter.
    It looks like it appears only after a "bold"-ed text. Here's and example:  [http://screencast.com/t/31t4X86XBs3]
    I'm using CrystalReports Editor Included in Visual Studio 2008.
    Has anyone already encoutered that issue ?
    Regards,
    Guillaume

    See [this|https://forums.sdn.sap.com/click.jspa?searchID=29094456&messageID=7206473] forum thread for possible clues to a resolution. In a nut shell, as long as the Calibri font is up to date, the other two steps are;
    1) Ensure you are using the latest Service Pack as suggested by Jonathan
    2) See what USP10.dll is loading (use the [Modules|https://smpdl.sap-ag.de/~sapidp/012002523100006252802008E/modules.zip] utility)
    Also, if this is a win app, compile it to an exe and run the exe to see if the issue persists. (when running the app exe, the USP10 loaded should be from the CR bin directory. when running ion the .NET environment, the USP10 will load from win\system or other)
    Ludek
    Edited by: Ludek Uher on Jul 16, 2009 10:57 AM

  • Adding text to a RTF document

    I'm reposting this because my last post was very poorly written. I have a JTextPane that uses a RTF editor kit, and what I want to do is add some text to the very beginning and end of the document with out losing the formatting of the RTF. What I do now is get a string from the Editor Kit that is RTF text but I can't just add to the front because of the formatting there, {rtf and all that jazz. What I do is use the getText() function to get just the unformatted text, then get the first 10 chars, and then search for that in the RTF string, and insert text there. It seems to be a bit of a crude way to go about it; even so I would be fine with it if it didn't fail with non-English characters. (You know like the French e with the accent or the German u with the 2 dots). So what I�m looking for is some sort of way to insert the text programmatically eliminating the need for searching and all that. Any help will be greatly appreciated.                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                               

    Forgive me if you know this already but I'd like to offer what I can...
    The JTextComponent (and it's subclasses) makes use of a Document for a lot of its Model. If you haven't set a different one explicitly, then the RTFEditorKit will see that an appropriate StyledDocument is used on your JTextPane. The Document interface allows for raw text (without markup, formatting, etc) to be mutated with optional formatting attributes (inserts, replaces, etc.).
    I think what you are looking for lies in the Document of the JTextPane. The getDocument() method will return the Document holding the text and can be mutated at will (either by typing into the component or programmatically inserting text).
    When you call getText() on your text component, the call is delegated to the installed editor kit and returns the contents. The text component calls the write( Writer, .... ) on the EditorKit but the RTFEditorKit actually should throw an exception and cause null to be returned from the getText() method of JEditorPane. To get the marked up, rtf text you would need to call the write( OutputStream, ... ) method.
    Here is programmatic insertion at the beginning and end...
        JTextPane textPane = new JTextPane();
        textPane.setEditorKit( new RTFEditorKit() );
        //pretend we've grabbed an rtf file and set it's contents with the setText() method.
        Document doc = textPane.getDocument();
        try{      
            doc.insertString( 0, "begin", null );
            doc.insertString( doc.getLength(), "end", null );
        }catch( BadLocationException ex ){
            //what ever you need to do
        //now of course to get the rtf formatted string out of the editor kit
        //you need to write it to an OutputStream (i.e. System.out, a FileOutputStream, etc.)
        try{
            textPane.getEditorKit().write( System.out, doc, 0, doc.getLength() );
        }catch( BadLocationException ex ){
            //what ever you need to do
        }catch( IOException ex ){
            //what ever you need to do
        }I didn't pass any formatting attributes into the calls of the insertString method but you could easily do that if you need to.
    Hope that helps!
    Matt

  • How can i paste text from a web site to an open office document as rtf?

    i'm running firefox under windows 7. i'm unable to copy text from web pages to the clipboard as rtf formatted data. tried pasting into ms wordpad and open office 3.3 writer. ie allows pasting as rtf text, but i'd prefer using firefox. why is rtf not an available format?

    Curnow 1 wrote the following:  "you should do a tap wait a sec and 1 more tap in the same place and hold the Second tap ;https://www.dropbox.com/s/23whtlt2gizxu27/MOV_1048.mp4?dl=0" Curnow1, this actually worked! Holy Cow, who'da thought?!!Thank you. I gave you a kudo and I marked this as a solution. Thanks again!PS - I'm amazed at how long it takes me to accomplish seemingly simple things with a smart phone. This is my first smart phone ever. I am a former computer programmer and am very PC literate. Still, sometimes I pull my hair out. Thanks again! 

Maybe you are looking for

  • IWeb (and Safari) fonts all screwed up (See pic)

    Hi yall. I am having this problem with my fonts. First it started in Safari, now iWeb. It seems to only be plauging Apple software. Do I have corrupted font files. If so, how do I clean em out. Here is the pic to show you what I mean by "Screwed up".

  • I have still empty Notes in iCloud

    When I open iCloud on my PC, Notes are still empty not synchronized. On my iPhone and iPad is everything okay. What should I do?

  • How to copy movie to a dvd on my iMac

    I would like to purchase and download a movie from a website; then burn it to a DVD and then play it on my DVD player Any suggested procedures for easily doing this? Denny

  • Time gap

    Hello. I have problem with time gap in process. There is parallel flow, one branch waiting for receive confirmation and second invoke some web services. Sometimes happens that process freeze between activities and continue after 45 seconds. If came c

  • Refreshing ALV from POV

    Hi Experts,    I have a module pool screen, in which I have an input field and under that I have OOPS alv grid control. I want to select a value from search help for that input field. The moment I select the value in that input field, according to th