How to open a doc file using jsp Anchor tag

when i am trying to open a doc file using a jsp it is opening with out proper alignment.
          how to open a doc file with proper alignment using Anchor Tag in JSp Page
          

Hello!
Does some one of you had open a MS word file (.doc) in Java search for a token like [aToken] replace it with another text and then feed it to a stream of save it?
I want to build a servlet to open a well formatted and rich on media (images) ms word document search for tokens and replace them with information form a web form.
Any Ideas?
Thank you in advanced.

Similar Messages

  • How to open a pdf file using OPEN DATASET

    Im trying to convert a pdf into binary format. So im trying to read the contents of the pdf into a XSTRING. Using the FM 'SCMS_XSTRING_TO_BINARY' i can convert the XSTRING to binary format.
    How to open a pdf file using OPEN DATASET and transfer its contents in a XSTRING variable.
    What i've tried is....
    DATA: f_name type string value 'C:\rep_output_pdf.pdf',
          x1 type xstring,
          LT_DATA TYPE STANDARD TABLE OF X255.
    OPEN DATASET f_name FOR input IN BINARY MODE.
    READ DATASET f_name INTO x1.
    CLOSE DATASET f_name.
    CALL FUNCTION 'SCMS_XSTRING_TO_BINARY'
        EXPORTING
          BUFFER     = x1
        TABLES
          BINARY_TAB = LT_DATA.
    Im getting a short dump .
    Short text: The file is not open.
    Plz help me out.

    Hello Rajesh,
    You are trying to do use OPEN DATASET with a local file. NOT POSSIBLE
    You have to have the file in the app server to use OPEN DATASET.
    BR,
    Suhas

  • Problem in opening a doc file using Runtime.exec()

    Code:
    import java.io.*;
    class StreamGobbler extends Thread {
        InputStream is;
        String type;
        StreamGobbler(InputStream is, String type) {
            this.is = is;
            this.type = type;
        public void run() {
            try {
                InputStreamReader isr = new InputStreamReader(is);
                BufferedReader br = new BufferedReader(isr);
                String line=null;
                while ( (line = br.readLine()) != null) System.out.println(type + ">" + line);   
            catch (IOException ioe) {
                 ioe.printStackTrace(); 
    public class GoodWindowsExec {
        public static void main(String args[]) {
             String file = "test.doc";
             String appPath = "/C";
            try {
                String osName = System.getProperty("os.name" );
                System.out.println("OS : " + osName);
                String[] cmd = new String[3];
                if( osName.equals( "Windows NT" ) || osName.equals( "Windows XP" )) {
                    cmd[0] = "cmd.exe" ;
                    cmd[1] = appPath;
                    cmd[2] = file;
                else if( osName.equals( "Windows 95" ) ) {
                    cmd[0] = "command.com" ;
                    cmd[1] = appPath;
                    cmd[2] = file;
                Runtime rt = Runtime.getRuntime();
                System.out.println("Execing " + cmd[0] + " " + cmd[1] + " " + cmd[2]);
                Process proc = rt.exec(cmd);
                // any error message?
                StreamGobbler errorGobbler = new StreamGobbler(proc.getErrorStream(), "ERROR");           
                // any output?
                StreamGobbler outputGobbler = new StreamGobbler(proc.getInputStream(), "OUTPUT");
                // kick them off
                errorGobbler.start();
                outputGobbler.start();
                // any error???
                int exitVal = proc.waitFor();
                System.out.println("ExitValue: " + exitVal);       
            catch (Throwable t) {
                t.printStackTrace();
    }I got this code from internet. Program will work fine if my "test.doc" is in "C:\test.doc" directory. Is there any way to get the application path and open the doc file or how to give a specified path for my doc file
    EG:- "C:\TestDir\test.doc"
    Thanks

    Well /C is not the path to the app. It is a switch to
    the command line.
    set your file name to "C:/test.doc"
    ~TimSorry, I guess my reply doesn't really answer the problem. But you can supply the entire path as part of the file name string.
    String file = "C:/Path/To/My/File/to execute/test.doc"

  • How to open a ".doc" file with ms word directly with this servlet?

    Here is a servlet for opening a word or a excel or a powerpoint or a pdf file,but I don't want the "file download" dialog appear,eg:when i using this servlet to open a word file,i want open the ".doc" file with ms word directly,not in IE or save.
    import javax.servlet.*;
    import javax.servlet.http.*;
    import java.io.*;
    import java.util.*;
    public class OpenWord extends HttpServlet {
    public void doGet(HttpServletRequest request, HttpServletResponse response) throws ServletException, IOException {
    doPost(request,response);
    public void doPost(HttpServletRequest req,HttpServletResponse res) throws ServletException, IOException {
    String strFileName = req.getParameter("filename");
    int len = 0;
    String strFileType1 = "application/msword";
    String strFileType2 = "application/vnd.ms-excel";
    String strFileType3 = "application/vnd.ms-powerpoint";
    String strFileType4 = "application/pdf";
    String strFileType = "";
    if(strFileName != null) {
         len = strFileName.length();
         if(strFileName.substring(len-3,len).equalsIgnoreCase("doc")) {
              strFileType = strFileType1;
         } else if(strFileName.substring(len-3,len).equalsIgnoreCase("xls")) {
              strFileType = strFileType2;
         } else if(strFileName.substring(len-3,len).equalsIgnoreCase("ppt")) {
              strFileType = strFileType3;
         } else if(strFileName.substring(len-3,len).equalsIgnoreCase("pdf")) {
              strFileType = strFileType4;
         } else {
              strFileType = strFileType1;
    if(strFileName != null) {
         ServletOutputStream out = res.getOutputStream();
         res.setContentType(strFileType); // MIME type for word doc
    //if uncomment below sentence,the "file download" dialog will appear twice.
         //res.setHeader("Content-disposition","attachment;filename="+strFileName);
         BufferedInputStream bis = null;
         BufferedOutputStream bos = null;
         String path = "d:\\"; //put a word or a excel file here,eg a.doc
         try {
         File f = new File(path.concat(strFileName));
         FileInputStream fis = new FileInputStream(f);
         bis = new BufferedInputStream(fis);
         bos = new BufferedOutputStream(out);
         byte[] buff = new byte[2048];
         int bytesRead;
         while(-1 != (bytesRead = bis.read(buff, 0, buff.length))) {
         bos.write(buff, 0, bytesRead);
         } catch(NullPointerException e) {
         System.out.println ( "NullPointerException." );
         throw e;
         } catch(FileNotFoundException e) {
         System.out.println ( "FileNotFoundException." );
         throw e;
         } catch(final IOException e) {
         System.out.println ( "IOException." );
         throw e;
         } finally {
         if (bis != null)
         bis.close();
         if (bos != null)
         bos.close();

    Hello!
    Does some one of you had open a MS word file (.doc) in Java search for a token like [aToken] replace it with another text and then feed it to a stream of save it?
    I want to build a servlet to open a well formatted and rich on media (images) ms word document search for tokens and replace them with information form a web form.
    Any Ideas?
    Thank you in advanced.

  • How to upload a image file using JSP

    hello to all.
    i am in the learning stage please help me to upload a image file
    using jsp. give the explanation to the code also if possible.
    thanks in advance
    sincerely
    Chezhian

    You may find the following articles useful for the JSP/Servlet part:
    Uploading files: http://balusc.blogspot.com/2007/11/multipartfilter.html
    Downloading files: http://balusc.blogspot.com/2007/07/fileservlet.html

  • How to open the pdf file using LabVIEW program

    I want to open the pdf file using the system exe, but it is not happening . Can you help me?
    Solved!
    Go to Solution.

    In simpler version
    Mark the satisfied answer as accepted solution for your question,you mistakenly marked youself 
    Message Edited by Baji on 04-07-2009 05:03 PM
    Balaji PK (CLA)
    Ever tried. Ever failed. No matter. Try again. Fail again. Fail better
    Don't forget Kudos for Good Answers, and Mark a solution if your problem is solved.
    Attachments:
    open pdf.JPG ‏25 KB

  • How to open a .DOC file with MS-Word ?

    Hye fellow Java freaks,
    I have made an application to upload .DOC and .RTF files to the server using servlets and the Jakarta Commons FileUpload package.
    The files are uploading successfully.
    Now, I want to place a link to the most recently uploaded file and then, on clicking that link, I want the file to open not in the browser, rather with MS-Word.
    What is the servlet code that I should implement to accomplish this ?
    Any suggesions ?
    Thanx in advance.

    I think this is a client-side issue - how the browser chooses to deal with the .doc file it receives.
    You can 'save as' and then open the file by hand.
    --Jon                                                                                                                                                                                                                                                                                                                               

  • How to open a PDF file using NWDS or VC

    Hi Frndz...
    As per my requirment i need to open a PDF file on browser which PDFs are reside on R/3 and in my case EP server is on UNIX usinig either NWDS or VC ....
    Thanks in Advance
    Regards
    Rajesh
    09903726944

    hi,
    can you put your question much more clearly? I couldnt get you properly.
    Check out the following links, they may be useful
    [How to Create a pdf form Using Web Dynpro - Java;
    [https://www.sdn.sap.com/irj/sdn/go/portal/prtroot/docs/library/uuid/805709cb-ec97-2910-04b8-f3d6303d8d3b]
    [Diff - PDF view inside NWDS livecycle designer and when App. is run;
    [https://www.sdn.sap.com/irj/sdn/go/portal/prtroot/docs/library/uuid/90e8e837-cc15-2a10-8db1-a87e2d29e9c9]
    Regards,
    Murthy.

  • How to open jxl workbook directly using JSP...??

    Dear Friends,
    I have created an object for "jxl.write.WritableWorkbook" in my action class, suppose let's say "objWB"
    now I can write this object to a file using objWB.write(), If I write to a file I am able to open it using FileInputStream
    but I don't have permissions on my client machine
    so is there any way, where I can open it directly using JSP.
    Thanks in advance..
    GP
    Don't think be happy

    Don't think, be happy eh? How can you be happy if you have no capacity to register it?
    In any case, to "open" a document in any web environment, you write the binary data to the response with the correct content-type set. If for example you set the content-type to "application/ms-excel" and on the client computer a program is registered to handle that content type, the document might be opened directly in that application. If there is no application registered to handle the content-type, a download of the file is usually offered.
    Do a google search for popular content-type values. I'm sure you can also find examples on how to output a binary file to the response. You are already almost there, in stead of writing the data to the fileoutputstream, write it to the outputstream of the response object in stead.

  • How to open a .doc file in MS word?

    Hello
    Can any body direct me to any api or library or sample, where by if you have word document in your local machine, you can run a java program to open that file in MS word. Basically Microsoft word is opened with the local file in your machine and displayed to the user.
    I looked for a while on this, could find anything...
    Your help is really appreciated.
    Thanks
    Jeevan

    >
    Can any body direct me to any api or library or sample, where by if you have word document in your local machine, you can run a java program to open that file in MS word. Basically Microsoft word is opened with the local file in your machine and displayed to the user.>[Desktop.open(File)|http://java.sun.com/javase/6/docs/api/java/awt/Desktop.html#open(java.io.File)]. (Note that here - a word Doc would be opened in Open Office - but that is more useful since Word is not installed.)
    >
    Your help is really appreciated.>For my part, your thanks are best expressed by assigning [Duke stars|http://wikis.sun.com/display/SunForums/Duke+Stars+Program+Overview] to the answer, and marking it as 'correct' or 'helpful'.

  • How to open a text file using button click event

    hi, How can i open a text file in a textpad or notepad on the click event of a button.?
    Thanks
    Jay

    Pnt,
    this will not work LV 8.0.1 and LV 8.6 will give back error 193.
    Attached is a VI to use the ShellExecute WinAPI. The VI is LV 7.1.1.
    Message Edited by waldemar.hersacher on 10-09-2008 10:48 PM
    Waldemar
    Using 7.1.1, 8.5.1, 8.6.1, 2009 on XP and RT
    Don't forget to give Kudos to good answers and/or questions
    Attachments:
    ShellExecute.zip ‏27 KB

  • How To Open PDF Attached file use CLIENT_HOST 11 g forms

    How to open pdf file on client side at 11 g forms ?
    when i open any attached (PDF )file on client side is not open those file open on server side plz guide me how to  open those file on client machine using client host?
    thanks

    Where is the pdf you are trying to open? Is it on the server or the client? If the file is stored on the server then you can access it using WEB.SHOW_DOCUMENT assuming it is stored in a place that has a virtual mapping. For example:
    WEB.SHOW_DOCUMENT ('http://server/someLocation/file.pdf','_blank');If the file is on the client then you need to configure your application to use WebUtil. Then you can do what Francois suggested.

  • How to open a PDF file using forms 9i

    Hi guys!!! Could you please help me with this?
    Using the webutil library, i've found the function FILE_OPEN_DIALOG which yes, it is like windows' dialog box, but it doesn't open the specific file. If i have the PDF software, and a pdf file, and i use the webutil code to open the file from forms, why doesn't it open de file?
    Code used:
    :block.item := WEBUTIL_FILE.FILE_OPEN_DIALOG('c:\',
    'pdf|*.pdf',
    'Select a file: ') ;
    I have also used:
    :block.item := webutil_file.file_selection_dialog(directory_name => 'c:\',
    file_name => null,
    file_filter => 'pdf|*.pdf',
    title => 'Select a file',
    dialog_type => open_file, --save_file
    select_file => TRUE);
    thnx!!

    The dialog just gives you the name of the file to open. You then have to write code to open the file. web.show_document should work.
    I have deleted your last entry. Whatever you think about the situation, a civilized language (which I know Spanish to be) would be appreciated.

  • How to open a doc file

    Suddnely doc files have stopped opening!

    Please perform the below shown steps to resolve the issue
    1. Turn OFF the Notebook
    2. Power ON the Notebook and keep tapping the F8 Key
    3. Select "Last known good configuration from "Advance Boot Options" list
    4. Please remove Startup items and Uninstall if there are any unwanted applications
    5. Please reboot/restart the Notebook once
    **Click the KUDOS star on left to say Thanks**
    Make it easier for other people to find solutions by marking a Reply 'Accept as Solution' if it solves your problem.
    Thank You,
    K N R K
    I work on behalf of HP

  • How to upload an html file using jsp and jdbc

    Hi,
    im trying to upload an html page using JSP and jdbc. but of no success.
    my aim is to keep some important html pages in the database.the file size can vary.the file has to be selected from a local machine (through the browser) and uploaded to a remote machine(where the databse resides).
    any help/sample code or pointer to any helpful link is appreciated.
    thanks in advance
    javajar2003

    When uploading a file, I use a byte array as a temporary buffer..
    So, you should then be able to store the byte array in the
    database as binary data.
    example>
    //Temporary Buffer To Store File
    byte[] tmpbuffer = new byte[860];
    //Some Code To Upload File...
    //File Should Now Be In Byte Array
    //Get DB Connection and execute Prepared Statement
    Connection con=//GET DB CONNECTION;
    String sql=insert into TABLE(page) values(?);
    PreparedStatement ps=con.prepareStatement(sql);
    ps.setBytes(1,tempbuffer);
    ps.executeUpdate();
    //Close PS and Free DB Connection
    ..... and this method looks like you dont even have
    to store the file in a byte array, you can just give
    it the input stream.
    ps.setBinaryStream(int, inputStream, int);
    You may have to make several attempts at this. I have
    uploaded a file and temporarily stored it in a byte array,
    but have never from there stored it in the DB as binary
    data.. but this looks like it'll work.
    Good Luck!

Maybe you are looking for

  • Masking Buttons problem...

    Hello All... I am trying to create a website using Flash CS3. I want to have my navigation appear with a mask when seen on the site. I created the buttons in a movie clip and each button is an actual button. When I place a mask over the buttons and t

  • User exit for block changes in PO if movement 101 occured

    Hi, Does anyone knows if there is a user-exit to block changes in the items of a PO, if there was a GR (mov 101) for that item (and considering that didn't was a mov 102 for the same item)? Thanks, Pedro Mariano

  • Importing  pdf multi page in Illustartor

    Is it possible to import a multi page pdf in illustartor ( as I open the illustrator file I would like all pdf pages to be imported automatically in each corrsdiponding drawing table) Thank you!!!

  • How to Fill in Forms on Ipad w/Adobe Ideas

    I read an Apple post (Apple - iPad in Business - Profiles - Dr. Jonathan Ferencz) about a prosthodontist who uses AI w/Ipads for his patient files. According to the post, the combination enables patients to fill in their intake forms on the Ipad I in

  • Production Client 700 not modifiable

    Guys, I need to upload trial balances in my production client thru LSMW.and in testing in QA, I got the error msg. for tax line items exceeding 999 and I had to turn off the taxware which dteremines the taxlineitems line by line.So I was able to uplo