Send text file content as the body of an email using Send-MailMessage

I am taking the last 8 lines of a bunch of robocopy logs and bunching them together.  
Get-ChildItem -Filter *.log | ForEach {
$a += Get-Content $_.Name | Select -Last 8
$a += Write-output ' '`r
$a += Write-Output '------------------------------------------------------------------------------'`r
I then wanted to use this as the body of an email (send-mailmessage).  It all works but the formatting is lost in the email. I've tried using Out-String and ConvertTo-HTML with little luck.
If I look at $a in the above it looks fine in the PowerShell console it's just lost when it reaches my inbox.
I am using v2 of PowerShell and sadly can't upgrade it.

The issue isn't that part. It's the content of the log files that loses its formatting.
$a += Get-Content $_.Name | Select -Last 8

Similar Messages

  • Radio button to determine what text is put into the body of an email

    Hi all,
    I need some help with a radio button and java scripting. This is the code I'm using on a button with a mouse up event using Java script run at the client
    var oSubmit = this.resolveNode("$..#submit");
    var cToAddr = "[email protected]";
    var cCCAddr = "[email protected]";
    var cSubLine = "Security Access Authorization";
    var cBodya = "Dear Help Desk," + "\n" + "\n" +
    "This email serves as my electronic approval for " + "\n" + "\n"
    var cBodyb = "============ SECURITY ACCESS REQUEST DETAILS ================" + "\n" + "\n"
    var cBodyc = (EffDate.length = "")
      if(EffDate.rawValue)
    cBodyc = "Effective Date - " + EffDate.formattedValue + "\n" + "\n"
    var cBodyd = (RadBut.length == "2")
      if(RadBut.rawValue)
    cBodyd = "Status - Create New User Account" + "\n" + "\n"
    var cBodye = (RadBut.length == "3")
      if(RadBut.rawValue)
    cBodye = "Status - Add/Remove Access" + "\n" + "\n"
    var cBodyf = (RadBut.length == "5")
      if(RadBut.rawValue)
    cBodyf = "Status - Terminate" + "\n" + "\n"
    var cBodyg = (RadBut.length == "1")
      if(RadBut.rawValue)
    cBodyg = "Status - Department Transfer from " + "\n" + "\n" 
    var cBodyh = (RadBut.length == "4")
      if(RadBut.rawValue)
    cBodyh = "Request to have name changed to - " + "\n" + "\n";
    oSubmit.target = "mailto:" + cToAddr + "?cc=" + cCCAddr
    + "&subject=" + cSubLine
    + "&body=" + cBodya + cBodyb + cBodyc + cBodyd + cBodye  + cBodyf  + cBodyg + cBodyh ;
    this is the test layout I'm using
    No matter what I try, it always put all of the choices in the body of the email, not just the one I checked. any help would be greatly appreciated...Thanks Erick

    First off welcome to the group! Livecycle can be an interesting program.
    For me I am not very technically proficient in coding so I tend to gravitate to, how you say, less than elegant solutions. What I do is create an Email Submit button for each Radio button. Then I create a dummy Email Submit button (this part will be key later). From the Object Library view on each Email Submit button I set the Email Address and Email Subject that I want. Then I hide all of the Email Submit buttons with the exception of the dummy Email Submit button. From the Action Builder I then create an action on the dummy Email Submit that when the button is clicked to open a dialog box to say "Please Select an Option". I then create an action within the Action Builder on each Radio button to show the corresponding Email Submit button that has the subject line I need while also making sure to hide the dummy Email Submit button (and any other buttons if the user clicks several radio buttons). That worked for me in the past. Then I added a DocuReady event on the dummy Email Submit button to make sure it was visible and the other buttons were hidden once the form was open. Sort of a reset if you will. The downside is if the user changes nothing they still get a prompt to save the changes. I am sure that some of our more advanced coders can offer a fix to your code lines, but that is sort of the non-coder way to go about this.
    Edit: Oh I forgot to say that if you want the buttons to appear the same to the user, just overlay them together. To the user there is no change.

  • Getting an html file on to the body of an email on macmail

    I have been using my old computer, which has OSX10.4.11 and this has been working fine. with the new imac,10.5.5 it does not work at all. very frustrating.
    1. save the file to desktop, which is a photo which contains html
    2. open the file which opens in a browser window. the address in the browser window is this
    file:///Users/assistant/Desktop/kilby_ecard.html
    3. take mouse to image, drag image on to body of email, the image is shown in the email, then I send email
    4. when recipient gets it, it looks the same, and clicking it takes recipient to proper URL
    as I say above, this is fine with my old mac. with the new one, a file when safari is open "acts" as if it is working but only the jpeg gets on the emaill and not the html code. with firefox open, the image refuses to be put into the email body. it goes as far as creating a green plus sign, but then jumps back to the browser window when you let go of the mouse.
    please help. thanks.

    I do not want to build a newsletter but it is the same idea. the html file is already built and I want to drop it into emails to specific people. and it not necessary to use mail stationary in 10.4.11. is a simple process. what is wrong with this version of macmail

  • Reading from a text file and displaying the contents with in a frame

    Hi All,
    I am trying to read some data from a text file and display it on a AWT Frame. The contents of the text file are as follows:
    pcode1,pname1,price1,sname1,
    pcode2,pname2,price2,sname1,
    I am writing a method to read the contents from a text file and store them into a string by using FileInputStream and InputStreamReader.
    Now I am dividing the string(which has the contents of the text file) into tokens using the StringTokenizer class. The method is as show below
    void ReadTextFile()
                        FileInputStream fis=new FileInputStream(new File("nieman.txt"));
                         InputStreamReader isr=new InputStreamReader(fis);
                         char[] buf=new char[1024];
                         isr.read(buf,0,1024);
                         fstr=new String(buf);
                         String Tokenizer st=new StringTokenizer(fstr,",");
                         while(st.hasMoreTokens())
                                          pcode1=st.nextToken();
                               pname1=st.nextToken();
              price1=st.nextToken();
                              sname1=st.nextToken();
         } //close of while loop
                    } //close of methodHere goes my problem: I am unable to display the values of pcode1,pname1,price1,sname1 when I am trying to access them from outside the ReadTextFile method as they are storing "null" values . I want to create a persistent string variable so that I can access the contents of the string variable from anywhere with in the java file. Please provide your comments for this problem as early as possible.
    Thanks in advance.

    If pcode1,pname1,price1,sname1 are global variables, which I assume they are, then simply put the word static in front of them. That way, any class in your file can access those values by simply using this notation:
    MyClassName.pcode1;
    MyClassName.pname1;
    MyClassName.price1;
    MyClassName.sname1

  • How to send the file contents in the application server to ftp server

    Hi,
    how to send the file contents in the application server to ftp server.
    regards,
    sree

    Test SAP FTP functions
    DATA: BEGIN OF MTAB_DATA OCCURS 0,
    LINE(132) TYPE C,
    END OF MTAB_DATA.
    DATA: MC_PASSWORD(20) TYPE C,
    MI_KEY TYPE I VALUE 26101957,
    MI_PWD_LEN TYPE I,
    MI_HANDLE TYPE I.
    START-OF-SELECTION.
    MC_PASSWORD = 'password'.
    DESCRIBE FIELD MC_PASSWORD LENGTH MI_PWD_LEN.
    *-- FTP_CONNECT requires an encrypted password to work
    CALL 'AB_RFC_X_SCRAMBLE_STRING'
         ID 'SOURCE' FIELD MC_PASSWORD ID 'KEY' FIELD MI_KEY
         ID 'SCR' FIELD 'X' ID 'DESTINATION' FIELD MC_PASSWORD
         ID 'DSTLEN' FIELD MI_PWD_LEN.
    CALL FUNCTION 'FTP_CONNECT'
         EXPORTING
           USER            = 'userid'
           PASSWORD        = MC_PASSWORD
           HOST            = 'servername'
           RFC_DESTINATION = 'SAPFTP'
         IMPORTING
           HANDLE          = MI_HANDLE
         EXCEPTIONS
           NOT_CONNECTED   = 1
           OTHERS          = 2.
    CHECK SY-SUBRC = 0.
    CALL FUNCTION 'FTP_COMMAND'
         EXPORTING
           HANDLE = MI_HANDLE
           COMMAND = 'dir'
         TABLES
           DATA = MTAB_DATA
         EXCEPTIONS
           TCPIP_ERROR = 1
           COMMAND_ERROR = 2
           DATA_ERROR = 3
           OTHERS = 4.
    IF SY-SUBRC = 0.
      LOOP AT MTAB_DATA.
        WRITE: / MTAB_DATA.
      ENDLOOP.
    ELSE.
    do some error checking.
    ENDIF.
    CALL FUNCTION 'FTP_DISCONNECT'
         EXPORTING
           HANDLE = MI_HANDLE
         EXCEPTIONS
           OTHERS = 1.
    Execute external commands (FTP Scripts)
    The following code shows the syntax of the FM 'SXPG_COMMAND_EXECUTE'. You pass it the external command created within transaction SM69 and it will execute it.
    DATA: ld_comline 
    LIKE sxpgcolist-name,
            ld_param    LIKE sxpgcolist-parameters,
            ld_status   LIKE extcmdexex-status,
            ld_output   LIKE btcxpm OCCURS 0 WITH HEADER LINE,
            ld_subrc    LIKE sy-subrc.
      REFRESH ld_output.
      MOVE 'FTP_DATA_IN' to ld_comline.         "Maintained using trans SM69
    Execute external command, contained in 'ld_comline'
      CALL FUNCTION 'SXPG_COMMAND_EXECUTE'
           EXPORTING
                commandname                   = ld_comline
              additional_parameters   = ld_param  "Params passed to script
              operatingsystem              
    = 'UNIX'
           IMPORTING
                status                        = ld_status
           TABLES
                exec_protocol                 = ld_output
           EXCEPTIONS
                no_permission
                     = 1
                command_not_found
                 = 2
                parameters_too_long          
    = 3
                security_risk                
    = 4
                wrong_check_call_interface    = 5
                program_start_error           = 6
                program_termination_error     = 7
                x_error                       = 8
                parameter_expected            = 9
                too_many_parameters           = 10
                illegal_command               = 11
                wrong_asynchronous_parameters = 12
                cant_enq_tbtco_entry
              = 13
                jobcount_generation_error
         = 14
                OTHERS                       
    = 15.
      IF sy-subrc NE 0.
      ENDIF.

  • Unlike some users, I want to send some files in the body of my email NOT as an attachment. How do I do that?

    Some literary agents want a chapter or two in the body of an email. They do NOT want an attachment. How do I do that?

    ppress and hold on email section until the select and select all show up. Ussually I select text and then hit paste instead.
    Other option on pc or if you have a Bluetooth keyboard
    On windows
    control + c
    to copy
    control + v
    to paste
    on mac
    command + c
    to copy
    command + v
    to paste

  • Xml content in the body of the email

    Hi... I am using JDev 10.1.3.4 . My requirement is to get xml content in the body of the email. please throw some light on this.

    Hi
    Thanks al for ur replies.
    Actually my requirement is to send email with some xml data in the body (like failed records to show dat dese are all the records without necessary information).
    @Eric,
    Using ora:getContentAsString(XMLElement) i only received a blank email without any content. I even tried to write the xml content in a file and used ora:doc() . Even then the body of the email is blank. Dunno wat i am missing here.
    @pavan4s
    I am literally new to bpel. Can u please elaborate or send some links to use xsl in email body?
    Edited by: friendsforever on Oct 11, 2010 2:35 AM
    Edited by: friendsforever on Oct 11, 2010 2:36 AM

  • How to print a text file contents using java.

    Using Input and Output streams I can add and retrive the contents to/from text file. But how to send this file contents to the printer or how to print the file.

    Example from my code:
       private void printErrorReport()
          PrintJob pjob = getToolkit().getPrintJob(m_frame,null,null);
          if (pjob != null) {
            Graphics pg = pjob.getGraphics();
            if (pg != null) {
              String s = detailsArea.getText();
              printLongString (pjob, pg, s);
              pg.dispose();
            pjob.end();
    // Utility method needed
       void printLongString (PrintJob pjob, Graphics pg, String s) {
         int pageNum = 1;
         int linesForThisPage = 0;
         int linesForThisJob = 0;
         // Note: String is immutable so won't change while printing.
         if (!(pg instanceof PrintGraphics)) {
           throw new IllegalArgumentException ("Graphics context not PrintGraphics");
         StringReader sr = new StringReader (s);
         LineNumberReader lnr = new LineNumberReader (sr);
         String nextLine = "       ";
         int pageHeight = pjob.getPageDimension().height;
         pageHeight -= 20;
         Font helv = new Font("Arial", Font.PLAIN, 12);
         //have to set the font to get any output
         pg.setFont (helv);
         FontMetrics fm = pg.getFontMetrics(helv);
         int fontHeight = fm.getHeight();
         int fontDescent = fm.getDescent();
         int curHeight = 0;
         try {
           do {
             nextLine = lnr.readLine();
             if (nextLine != null) {
               if ((curHeight + fontHeight) > pageHeight) {
                 // New Page
                 System.out.println ("" + linesForThisPage + " lines printed for page " + pageNum);
                 pageNum++;
                 linesForThisPage = 0;
                 pg.dispose();
                 pg = pjob.getGraphics();
                 if (pg != null) {
                   pg.setFont (helv);
                 curHeight = 0;
               curHeight += fontHeight;
               if (pg != null) {
                 pg.drawString (nextLine, 0, curHeight - fontDescent);
                 linesForThisPage++;
                 linesForThisJob++;
               } else {
                 System.out.println ("pg null");
           } while (nextLine != null);
         } catch (EOFException eof) {
           // Fine, ignore
         } catch (Throwable t) { // Anything else
           t.printStackTrace();
         System.out.println ("" + linesForThisPage + " lines printed for page " + pageNum);
         System.out.println ("pages printed: " + pageNum);
         System.out.println ("total lines printed: " + linesForThisJob);
         }

  • How to view the file content from the directory? getting Error:ORA-21560

    SQL> create directory READ_LOB_DIR as 'D:\Prj\Comm\Data';
    CREATE OR REPLACE Procedure READ_FILE_LOB IS
    -- Input Directory as specified in create directory
    l_dir CONSTANT VARCHAR2(30) := 'READ_LOB_DIR';
    -- Input File which is read word by word
    l_fil CONSTANT VARCHAR2(30) := 'testfile.txt';
    -- Separator Character between words is a BLANK (ascii = 32)
    l_seb CONSTANT RAW(100) := UTL_RAW.CAST_TO_RAW(CHR(32));
    -- Character at the end of the file is NEWLINE (ascii = 10)
    l_sen CONSTANT RAW(100) := UTL_RAW.CAST_TO_RAW(CHR(10));
    -- Pointer to the BFILE
    l_loc BFILE;
    -- Current position in the file (file begins at position 1)
    l_pos NUMBER := 1;
    -- Amount of characters have been read
    l_sum BINARY_INTEGER := 0;
    -- Read Buffer
    l_buf VARCHAR2(500);
    -- End of the current word which will be read
    l_end NUMBER;
    -- Return value
    l_ret BOOLEAN := FALSE;
    BEGIN
    -- Mapping the physical file with the pointer to the BFILE
    l_loc := BFILENAME(l_dir, l_fil);
    -- Check if the file exists
    l_ret := DBMS_LOB.FILEEXISTS(l_loc) = 1;
    IF (l_ret) THEN
    dbms_output.put_line('File ' || l_fil || ' in Directory ' || l_dir ||
    ' exists');
    -- Open the file in READ_ONLY mode
    DBMS_LOB.OPEN(l_loc, DBMS_LOB.LOB_READONLY);
    LOOP
    -- Calculate the end of the current word
    l_end := DBMS_LOB.INSTR(l_loc, l_seb, l_pos, 1);
    -- Process end-of-file
    IF (l_end = 0) THEN
    l_end := DBMS_LOB.INSTR(l_loc, l_sen, l_pos, 1);
    l_sum := l_end - l_pos - 1;
    DBMS_LOB.READ(l_loc, l_sum, l_pos, l_buf);
    dbms_output.put_line(UTL_RAW.CAST_TO_VARCHAR2(l_buf));
    EXIT;
    END IF;
    -- Read until end-of-file
    l_sum := l_end - l_pos;
    DBMS_LOB.READ(l_loc, l_sum, l_pos, l_buf);
    dbms_output.put_line(UTL_RAW.CAST_TO_VARCHAR2(l_buf));
    l_pos := l_pos + l_sum + 1;
    END LOOP;
    DBMS_LOB.CLOSE(l_loc);
    ELSE
    dbms_output.put_line('File ' || l_fil || ' in Directory ' || l_dir ||
    ' does not exist');
    END IF;
    EXCEPTION
    WHEN OTHERS THEN
    dbms_output.put_line('Error:' || SQLERRM);
    DBMS_LOB.CLOSE(l_loc);
    END;
    The Text file content is...
    Copyright 1996,2001 Oracle Corporation.     All Rights Reserved
    This file contains installation instructions for installing the
    Oracle8 ODBC Driver software.
    It is divided into four parts:
    o Part I: Summary of systems supported by Oracle8 ODBC client
    software
    Lists the platforms on which the Oracle8 ODBC Client software can
    be installed.
    o Part II: Oracle8 ODBC Driver software.
    Describes the files, and installation prerequisites for the Oracle8
    ODBC driver software.
    o Part III: Exploding the kit onto your system
    Describes how to explode the kit onto your system hard drive.
    o Part IV: Installation Instructions
    Describes how to install the Oracle8 ODBC driver.
    Part I: Systems supported by the Oracle8 client software
    You can install the ODBC client software on any of the following systems:
    o Windows 2000
    o Windows NT X86
    o Windows 95
    o Windows 98
    The Oracle8 ODBC Driver provides support for ODBC connections
    from Windows 2000, Windows NT, Windows 95, and Windows 98 systems
    to Oracle databases.
    o Part II: Oracle8 ODBC Driver software.
    Refer to the following files for information about the Oracle8 ODBC Driver:
    LICENSE.TXT - Oracle8 ODBC Driver License Agreement. Read carefully
    before installing and/or using this product. Enclosed in
    your software distribution kit.
    SQORA.HLP - A Window's Help file which is the primary reference
              manual for the Oracle8 ODBC Driver.
    ODBCRelnotes.WRI - The release notes for the Oracle8 ODBC Driver
    which contains information which may have not been
    included in the Help file.
    Installation Prerequisites
    See the Oracle8 ODBC Driver release notes (ODBCRelnotes.WRI),
    for a complete list of software products required and their versions.
    Time Required
    The installation of the Oracle8 ODBC Driver takes approximately 5
    minutes. The actual time may be shorter or longer, depending upon
    your hardware configuration.
    Disk Space Required
    The Oracle8 ODBC driver installation requires approximately 2
    megabytes of available storage space. The space required depends upon
    what files you already have installed. The installation procedure
    checks to see if you have enough available disk space. If you do not,
    the installation fails.
    Part III: Exploding the Kit onto your system
    Expand the self-extracting archive file onto your hard drive.
    C:\> ORA8174.EXE
    Part IV: Installation Instructions
    Oracle8 ODBC Driver 8.1.7.4.0
    This section assumes the following:
    1. MS Windows 2000, Windows NT, Windows 95 or Windows 98 is running.
    2. Oracle Universal Installer shipping with 8.1.7 has already been
    installed on your system.
    3. Part III has been completed.
    Software fixes:
    Refer to release notes (ODBCRelnotes.wri) for a complete list of
    Software fixes.
    Installation Instructions
    Once the self-extracting archive file ORA8174.EXE has been
    exploded it will create an installable directory structure
    onto your hard drive. Run the Oracle Universal Installer from
    your local drive.
    1. On the screen "File Locations" use the "Browse" button of
    the source path to choose the file 'products.jar' from the
    folder that ORA8174.EXE was extracted to. Choose 'Next'.
    2. You will receive a warning that some of the dependencies of
    this product are not found in the staging area. This warning
    is OK. The ODBC driver depends on the Net8 Client being already
    installed on the system. Answer 'Yes' to continue.
    Oracle is a registered trademark of Oracle Corporation.
    Microsoft, MS are registered trademarks of Microsoft Corporation.
    Microsoft Windows, Windows NT, Windows 95, Windows 98 and Open Database
    Connectivity are trademarks of Microsoft Corporation.
    All other trademarks and registered trademarks are the property
    of their respective owners.
    The output was...
    File testfile.txt in Directory READ_LOB_DIR exists
    Copyright
    1996,2001
    Oracle
    Corporation.     
    All
    Rights
    Reserved
    This
    file
    contains
    installation
    instructions
    for
    installing
    the
    Oracle8
    ODBC
    Driver
    software.
    It
    is
    divided
    into
    four
    parts:
    o
    Part
    I:
    Summary
    of
    systems
    supported
    by
    Oracle8
    ODBC
    client
    Error:ORA-21560: argument 2 is null, invalid, or out of range
    I want to diplay/view as per file content format from the file under that specified directory.
    Have any other method / any help or suggestions would be really appreciated.

    I changed the code like...
    CREATE OR REPLACE Procedure READ_FILE_LOB_tmp IS
    -- Input Directory as specified in create directory
    l_dir CONSTANT VARCHAR2(30) := 'READ_LOB_DIR';
    -- Input File which is read word by word
    l_fil CONSTANT VARCHAR2(30) := 'testfile.txt';
    -- Separator Character between words is a BLANK (ascii = 32)
    l_seb CONSTANT RAW(100) := UTL_RAW.CAST_TO_RAW(CHR(32));
    -- Character at the end of the file is NEWLINE (ascii = 10)
    l_sen CONSTANT RAW(100) := UTL_RAW.CAST_TO_RAW(CHR(10));
    -- Pointer to the BFILE
    l_loc BFILE;
    -- Current position in the file (file begins at position 1)
    l_pos NUMBER := 1;
    -- Amount of characters have been read
    l_sum BINARY_INTEGER := 0;
    -- Read Buffer
    l_buf VARCHAR2(4000);
    -- End of the current word which will be read
    l_end NUMBER;
    -- Return value
    l_ret BOOLEAN := FALSE;
    BEGIN
    -- Mapping the physical file with the pointer to the BFILE
    l_loc := BFILENAME(l_dir, l_fil);
    -- Check if the file exists
    l_ret := DBMS_LOB.FILEEXISTS(l_loc) = 1;
    IF (l_ret) THEN
    dbms_output.put_line('File ' || l_fil || ' in Directory ' || l_dir ||
    ' exists');
    -- Open the file in READ_ONLY mode
    DBMS_LOB.OPEN(l_loc, DBMS_LOB.LOB_READONLY);
    LOOP
    -- Calculate the end of the current word
    l_end := DBMS_LOB.INSTR(l_loc, l_sen, l_pos, 1);
    -- Process end-of-file
    IF (l_end = 0) THEN
    EXIT;
    END IF;
    -- Read until end-of-file
    l_sum := l_end - l_pos;
    DBMS_LOB.READ(l_loc, l_sum, l_pos, l_buf);
    dbms_output.put_line(UTL_RAW.CAST_TO_VARCHAR2(l_buf));
    l_pos := l_pos + l_sum + 1;
    END LOOP;
    DBMS_LOB.CLOSE(l_loc);
    ELSE
    dbms_output.put_line('File ' || l_fil || ' in Directory ' || l_dir ||
    ' does not exist');
    END IF;
    EXCEPTION
    WHEN OTHERS THEN
    dbms_output.put_line('Error:' || SQLERRM);
    DBMS_LOB.CLOSE(l_loc);
    END;
    Now its working fine with one addtional line...
    The file content is...
    This is My Content
    This is My Content
    This is My Content
    This is My Content
    This is My Content
    But The output was...
    File testfile.txt in Directory READ_LOB_DIR exists
    This is My Content
    This is My Content
    This is My Content
    This is My Content
    This is My Content
    here, i want to delete that additonal line...?

  • Browser can't find a text file opened via the save as dialogue box

    Hi there,
    I have a servlet which outputs a file using the servlet output stream, with the following lines set:
    response.setContentType("application/msword");
    response.setHeader("Content-Disposition", "attachement; filename="+ fileName);
    servletOutStream.write(myBytes);
    servletOutStream.flush();
    It works fine for .doc files and it seems the mechanism is that it is saved to the Temporary Internet Folder and delivered from there when the user clicks on the 'open' or 'save' option in the browser popup dialogue box. However... when I try this with text files, (setting the content type to "text/plain") I get the open/save dialogue box up correctly but if I try to open the file it says it cannot find the file, and gives the path under the Temporary Interenet Folder. If I look in there the text file isn't present - though the .doc files are.
    So... it looks as if the problem is that for some reason it doesn't save the text files correctly to the Temporary Internet Folder.
    I can't deliver the text files inline as a solution as the filename is lost and it thinks it's an html file (which the client doesn't want).
    Any ideas?
    Alison

    At least also set the content length. Your browser may be configured be the default application to open textfiles. If the contentlength is not set, then most applications would refuse to open the file without choosing for 'Save' first and manually open it.

  • Problem in reading this particular text file, what is the problem with it..

    Hai to all..,
    I had developed an application to read the text file that is stored in my computer from mobile, all are working fine but some files create problems in reading the file content, like the file i had attached with this..
    Can any one please tell why this particular file creates problem in reading the contents...
    I had attached a text file with this...
    and the code I am using is
    int getcharcount;
    FileInputStream fstream = new FileInputStream(filename);
    InputStreamReader in = new InputStreamReader(fstream);
    while ((getcharcount = in.read()) != 0)
         getchar = getchar + (char) getcharcount;
    System.out.println("Full File Content :"+getchar);
    I try'd with BufferedReader also, but have the same problem,
    Can any one please give me a solution for this..

    Hai to all..,
    Sorry for the previous posting,
    I had developed an application to read the text file that is stored in my computer from mobile, all are working fine but some files create problems in reading the file content, like the file i had attached with this..
    Can any one please tell why this particular file creates problem in reading the contents...
    and the code I am using is
    int getcharcount;
    FileInputStream fstream = new FileInputStream(filename);
    InputStreamReader in = new InputStreamReader(fstream);
    while ((getcharcount = in.read()) != 0)
         getchar = getchar + (char) getcharcount;
    System.out.println("Full File Content :"+getchar);
    I try'd with BufferedReader also, but have the same problem,
    Can any one please give me a solution for this..The error I am getting is
    Full File Content :ÿþC
    But the file contains plain text only..
    Edited by: Kamal Raj on Oct 17, 2010 10:22 PM

  • How to read text file content in portal application?

    Hi,
    How do we read text file content in portal application?
    Can anyone forward the code to do do?
    Regards,
    Anagha

    Check the code below. This help you to know how to read the text file content line by line. You can display as you require.
    IUser user = WPUMFactory.getServiceUserFactory().getServiceUser("cmadmin_service");
    IResourceContext resourceContext = new ResourceContext(user);
    String filePath = "/documents/....";
    RID rid = RID.getRID(filePath);
    IResource resource = ResourceFactory.getInstance().getResource(rid,resourceContext);
    InputStream inputStream = resource.getContent().getInputStream();
    BufferedReader reader = new BufferedReader(new InputStreamReader(inputStream));
    String line = reader.readLine();
    while(line!=null) {
          line = reader.readLine();
         //You can append in string buffer to get file content as string object//
    Regards,
    Yoga

  • How can I embed a pdf file into the body of an email?

    How can I embed a pdf file into the body of an email?

    The problem is defining what it even means to “embed” a PDF file in the body of an e-mail, especially if you are dealing with a multiple page PDF file.
    E-mail is either pure text, rich text (something akin to RTF in Word), or HTML. PDF is not compatible with any of these. Thus, to embed a PDF file, something has to be converted and that means the PDF would be converted to a less graphically rich raster format. But is that what you would really want?
    I think that the MacOS and iOS e-mail clients do under some circumstances place an attached PDF file within HTML segments and by clicking on same, you get the equivalent of extracting the full PDF file, but I have no real experience with that.
    Another alternative is HTML with a proxy image with a hyperlink to an external PDF file that is invoked when you click on the hyperlink.
    Perhaps you can explain what you are really trying to accomplish and what the recipient of such an e-mail's actual experience would be?
              - Dov

  • Why do my older emails have no content in the body of the message?

    My older emails in my folders show the sender, addressee and subject but no content in the body of the message.  Why is that the case?  I use my email to save important messages.

    This is the Mac Pro desktop forum.
    In the received message does the subject appear correctly?
    Is just the body message field blank?
    What app is the recipient using?
    Can they try another pp?
    Is there anything strange in the body? Like special characters?

  • How to convert a text file content to String in JSP?

    Hi,
    I need to read the content of a text file and convert it into String and display it on to a JSP file.
    But the codings below don't work. Please advise me on how can i display the text file content.
    ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
    File adCheck = new File("list.txt");
    fis = new FileInputStream(adCheck);
    int Length = adCheck.length();
    byte arr[] = new byte[Length];
    int dataRead = 0;
    int totalData = 0;
    while(totalData <Length)
         dataRead = fis.read(arr,totalData,Length);
         totalData += dataRead;
    String Content = new String(arr);//byte array converted to String
    arr = null;

         InputStreamReader in=new InputStreamReader(fis);
          StringWriter out=new StringWriter();
          char[] buffer=new char[8192];
          int sizeRead;
          while ( ( sizeRead=in.read(buffer, 0, 8192) ) != -1 )
            out.write(buffer, 0, sizeRead);
         String content=out.toString();

Maybe you are looking for

  • Error while creating a application server connection in jdeveloper 10.1.3.2

    When I am trying to create a connection using the wizard with the following inputs hostname as :- localhost RMI Por as 22667 When I use the test conection receive the following error racle.oc4j.admin.jmx.shared.exceptions.JMXRuntimeException: Error w

  • Cp4 AS3 - using Javascript to generate a text string

    I'm a complete Javascript beginner, so please forgive me if this is a stupid question! I need to generate a pseudo random text string. I'm using the unpatched version of Cp4, AS3, Internet Explorer 7 I've had a look at Captivate.Dev.com and the w3sch

  • How to combine or merge 2 CD's of Adobe Creative Suite 4 Web Premium

    Problem: I bought "Adobe Creative Suite 4 Web Premium" which came in 2CD's. My laptop's CD drive don't play CD's due to error. So I copied contents of 2 CD's into external hard drive.(2  different folder) When i start 'Setup.exe' it installs first fo

  • Forms 6i in Batch Mode - I need help..

    Hello ALL. Before I proceed migrating our 4.5 to 6i, I would like to know how to run forms/reports 6i in batch mode. I have RDBMS 8.1.6. running on HP-UX 11.0 and the plan is to deploy the forms/reports6i to browser or intranet via the OAS9i/NT Serve

  • ELM 1:N Can we Map Multiple Contact Persons for an Org

    I want to upload Multiple contact persons for an organization. Using ELM Mapping tool can we map multiple contact persons for an organization? orgID  name  persID  Name   CP_FUNCTIONKEY    CP_FUNCTIONNAME 9          abc     9          Pers1