Images and excel in zip file

related to this topic i posted in some thred ,but for proper understanding , i write here again.
i need to read images and excel file from zip and extract to some folder, in my struts application.
i am able to read and write text files with inputStream and FileWriter,but unable to write excel and images properly.
images are written with improper clarity and excel file could not open without some errors.
Any one can suggest this issue to be solved??
Is it better to handle with Any binary strams??
If yes share your experiences!!

Is it better to handle with Any binary strams??If by "better" you mean "Not mucked up" then yes, definitely copy those files with InputStream and OutputStream objects. Do not use Reader and Writer objects.

Similar Messages

  • InterMedia indexing and searching of zipped files

    Hello, I have interMedia successfully configured to index and query a repository of files (MS Word, Excel, PPT, PDFs, txt files)which are located on a file system. My issue is with zip files. I cannot successfully index and search zip files. I've tried zips that contain both ascii(text) and formatted files (doc, ppt), but interMedia seems not to recognize this particular MIME type. Is there a way to have interMedia index and search zip files? Thanks in advance for any assistance.

    You will have more luck with this question if you post it in the Oracle Text forum. This forum is for interMedia (image, audio video).

  • How do I create and send a zip file? I have Lion and I'm working in Word for mac

    To show you how little I know about any of this, I don't even know if this is the correct forum in which to ask this question. I'm a copywriter. I have a client in France. I have 15 word documents, 15 of the same documents in PDFs and a small Excel document to send him. Simple, mutlipage Word docs. Short two-page Excell sheet. I want to create a zip file for them to send to him. Can I do it? How? I have unzipped zip files other people have sent to me, but I've never created or sent one myself. I'm working in Word for Mac 2011. I have Lion. I'm using Mac's email. Please don't assume I know anything. I need very, very simple, play by play instructions. You are all very helpful, so I have high hopes.
    Nancy

    Visit:
    http://download.cnet.com/MacZip/3000-2250_4-10025248.html
    You will be able to both zip and unzip. If the recipient of your zipped file does not have zip, he/she will need to get it, or you could send him/her the above address so that he/she can unzip his/her file.
    (I wish the English language could settle on the use of something less clumsy that he/she him/her etc.)
    BTW, I think that you can zip only folders, not separate files, so put even one file into a folder before zipping).
    Message was edited by: SteveKir Added BTW

  • Appending data(Image and Text) to a file written with RTFWriter2.

    I have file witten using RTFWriter2 which contains image and text.I nedd to modify the contents of that file at runtime through browsing and selecting the JFileChooser and append the data to existing selected file.
    I write inot the file for the first time using FileOutputStream("filename",ture)
    where true stands for appending data to current file,if does noes have any/not.
    But this does not work when i write the file using RTFWriter2,and i have to use this RTFWriter2 b'coz writing an image to a file is not done by any other way.
    If there is any do let me know and if not then what is the solution to this problem of appending data to existing file written by RTFWriter2.
    Your repkeis will be appreciated.Thank You.

    Mubin_Ahmed wrote:
    Hi,
    I want to write an application which can be used to read a file that contains both images and text.
    It must separate the images and text and write them in separate files..
    Can anyone help me with this please...
    My email id is [email protected]
    Thanks in advance...This forum is to use as a resource for your questions, not a place to enlist someone to program for you. If you have specific questions on what to do, not: "I've not a clue, so explain the wold to me." But specific questions on how to get your code to work or points about Java, then people from all over the world will be happy to help you in the context of the forum, and not through your private e-mail. E-mail defeats the basic purpose of having public forums for learning and exchange of information.

  • How to upload a PDF file, zip it and download the zipped file?

    Hi Experts,
    I have a requirement to upload a PDF file, convert that to a ZIP file and download it. If anyone has worked on this requirement, can you please guide me on this? Thanks.
    Avi

    Here you go.  Hope it helps.
    REPORT  zrich_0004.
    DATA: lt_data TYPE TABLE OF x255.
    DATA: ls_data LIKE LINE OF lt_data.
    DATA: lv_zip_content TYPE xstring.
    DATA: lv_size  TYPE i.
    DATA: lv_filename TYPE string.
    DATA: lv_path TYPE string.
    DATA: lv_fullpath TYPE string.
    DATA: lt_filetab TYPE TABLE OF file_table.
    DATA: ls_filetab LIKE LINE OF lt_filetab.
    DATA: lv_rc TYPE sy-subrc.
    DATA: lv_content TYPE xstring.
    DATA: lo_zip TYPE REF TO cl_abap_zip.
    SELECTION-SCREEN BEGIN OF BLOCK b1 WITH FRAME TITLE text-001.
    PARAMETERS: p_up TYPE string DEFAULT 'C:\upload.pdf' .
    PARAMETERS: p_down TYPE string DEFAULT 'C:\download.zip' .
    SELECTION-SCREEN END OF BLOCK b1.
    AT SELECTION-SCREEN ON VALUE-REQUEST FOR p_up.
      REFRESH lt_filetab. CLEAR ls_filetab.
      cl_gui_frontend_services=>file_open_dialog(
          CHANGING
            file_table              = lt_filetab
            rc                      = lv_rc
        EXCEPTIONS
          OTHERS                  = 5 ).
      READ TABLE lt_filetab INTO ls_filetab INDEX 1.
      IF sy-subrc = 0.
        p_up = ls_filetab-filename.
      ENDIF.
    AT SELECTION-SCREEN ON VALUE-REQUEST FOR p_down.
      CLEAR: lv_filename, lv_path, lv_fullpath.
      cl_gui_frontend_services=>file_save_dialog(
         CHANGING
           filename             = lv_filename
           path                 = lv_path
           fullpath             = lv_fullpath
         EXCEPTIONS
           OTHERS               = 4 ).
      p_down = lv_fullpath.
    START-OF-SELECTION.
      CREATE OBJECT lo_zip.
    * Read the data as a string
      cl_gui_frontend_services=>gui_upload(
        EXPORTING
          filename                = p_up
          filetype                = 'BIN'
        IMPORTING
          filelength = lv_size
        CHANGING
          data_tab                = lt_data
        EXCEPTIONS
          OTHERS                  = 19 ).
    * convert binary to xstring
      CLEAR lv_content .
      CALL FUNCTION 'SCMS_BINARY_TO_XSTRING'
        EXPORTING
          input_length = lv_size
        IMPORTING
          buffer       = lv_content
        TABLES
          binary_tab   = lt_data
        EXCEPTIONS
          failed       = 1
          OTHERS       = 2.
    * Get the file name of the uploaded file
      DATA: lv_upfilename TYPE string.
      DATA: lv_tmp TYPE char1024.
      DATA: lv_tmp_file TYPE char1024.
      lv_tmp = p_up.
      CALL FUNCTION 'STRING_REVERSE'
        EXPORTING
          string  = lv_tmp
          lang    = sy-langu
        IMPORTING
          rstring = lv_tmp.
      SPLIT lv_tmp AT '\' INTO lv_tmp_file lv_tmp.
      CALL FUNCTION 'STRING_REVERSE'
        EXPORTING
          string  = lv_tmp_file
          lang    = sy-langu
        IMPORTING
          rstring = lv_tmp_file.
      lv_upfilename = lv_tmp_file.
    * add to zip file.
      lo_zip->add( name = lv_upfilename content = lv_content ).
      lv_zip_content   = lo_zip->save( ).
    * Conver the xstring content to binary
      CALL FUNCTION 'SCMS_XSTRING_TO_BINARY'
        EXPORTING
          buffer        = lv_zip_content
        IMPORTING
          output_length = lv_size
        TABLES
          binary_tab    = lt_data.
    * download
      cl_gui_frontend_services=>gui_download(
          EXPORTING
            bin_filesize = lv_size
            filename     = p_down
            filetype     = 'BIN'
          CHANGING
            data_tab     = lt_data
          EXCEPTIONS
            OTHERS       = 24 ).
    Regards,
    Rich Heilman

  • How to zip a folder containing subfolders with files and download the zip file in silverlght 4

    private void hbtnDownloadReceipt_Click(object sender, RoutedEventArgs e)
               try
                    string Docpath = "ClaimsDetails/" + "20tech" + "/" + PaymentAdviceUNo;
                    string dd = "ClaimsDetails/";
                    Uri uri = new Uri(Application.Current.Host.Source, "/" + Docpath);
                    Uri uri1 = new Uri(Application.Current.Host.Source, "/" + dd);
                    string path = uri.AbsoluteUri.ToString();
                    path1 = uri1.AbsoluteUri.ToString();
                    //HtmlPage.Window.Eval("window.open('" + path + "')");
                catch (Exception ex)
                    ex.Data.Clear();
    1) Here "path" is D:\\TL 24-12-2014 \\OfficeConnect_17_10\\OfficeConnect.Web\\ClaimsDetails\\20tech\\PaymentAdviceUNo.     
    2) In path "PaymentAdviceUNo" is the folder containing subfolders which i want to zip.
    Thanks in Advance.

    Hi,
    You can download a zip file like any files with the Webclient class, look at the details and examples in the msdn documentation for downloading content on demand it even talks about how to download and get a specific file from a zip archive.
    http://msdn.microsoft.com/en-us/library/cc189021(VS.95).aspx
    Besides,  if you want to list the files,you could check articles below:
    http://blogs.msdn.com/b/blemmon/archive/2009/11/25/reading-zip-files-from-silverlight.aspx
    Best Regards,
    We are trying to better understand customer views on social support experience, so your participation in this interview project would be greatly appreciated if you have time. Thanks for helping make community forums a great place.
    Click
    HERE to participate the survey.

  • Changing images (and text) in InDesign file to spot color.

    Hi, Im trying to create a two color job in InDesign that will be black and red. The problem I have is that our imagesetter is not separating the colors.
    I was told that the red color needs to be a spot color in InDesign for the imagesetter to know to separate the colors. Otherwise, if the colors are not set as a spot color then it sends the file as CMYK separations or grayscale separations.
    The question I have is how can I change the images (and text) in my InDesign file to be set as a spot color? Thanks in advance.

    Please re-ask your question in the ID forum:
    Mike

  • Trying to create an image and save it on file system

    Hi,
    I'm trying to create an image and save it in the file system :
         public static void main(String[] args) {
         int wid = 632;
         int hgt = 864;
         BufferedImage bufferedImage = new BufferedImage(wid,hgt,BufferedImage.TYPE_INT_RGB);
         bufferedImage.getGraphics().setColor(Color.black);
         bufferedImage.getGraphics().drawOval(30, 30, 100, 100);
              bufferedImage.getGraphics().drawString("test me one two three",2,2);
              bufferedImage.flush();
    try {
                   ImageIO.write(bufferedImage,".bmp",new File("C:/MyImage.bmp"));
         } catch (IOException e) {               
                   e.printStackTrace();
    THE PROBLEM : It creates C:/MyImage.bmp on my file system, but the file is empty (size 0).
    Am I missing something ?
    Thanks

    Try changing ".bmp" to "bmp". If that fails, try posting an SSCCE.
    Edit 1:
    And in future, please use the code tags when posting code, code snippets, HTML/XML or input/output. To do that, select the code and click the CODE button seen on the Plain Text tab of the message posting form.
    Edited by: AndrewThompson64 on Aug 3, 2009 1:23 AM

  • Labview IMAQ VI for capturing images and saving with incremental file names

    Hello,
    I am using LabView 7.1(IMAQ) to capture images with NI's PCI 1426 card, and a JAI CV-M2 camera. Now, with the example VI's like LL Grab, or LL Sequence, or Snap and Save to File.vi, I can capture the images. But what I actually want is to capture images continuously and keep saving them with a sequentially incrementing file name.
    I have tried to modify the Snap and Save to File.vi  by adding a 'for loop', so as to run this for required number of images. This works okay, but I can't really change the file name after every image. However, I'm not confident with this method either. I think it would be better to use the buffer itself, as is given in LL Grab.vi and somehow save images from the buffer. I think this would be faster ?
    In any case, any ideas as to how I should go about implementing auto-incrementing of the file name ?
    Any help will do. 
    Thanks.
    - Prashant

    Hi,
    Thanks a lot for replying. 
    I tried using this in the VI i was working with, but using the "build path" vi doesnt seem to work. If I use just the base path from user's input, it works, but then again it keeps overwriting the images into one file rather than giving each file a new name. I'm attaching the vi. 
    Please take a look and tell me where i'm going wrong.
    Thanks again.
    Attachments:
    LL Sequence_mod.vi ‏62 KB

  • Word and Excel hang "downloading" file from network drive - copy file to be able to open it

    Word or Excel hang trying to open files on a network drive maybe after an untidy close.
    Symptoms:  pick the file from a pinned entry on recent list or even direct from File!Open... or by double clicking on the file from file explorer.  Word/Excel show in the middle of the status line a comment "Downloading:filename "  
    a progress bar, that shows no progress, and a white cross on a red circle to close.  Some minutes later may Excel/Word  say could not open filename.
    I have removed any temporary copies of the file prefixed with the ~. However there are no documents shown in any document recovery pane.
    If I rename the original file the problem is still there.
    I can only clear the problem by working on a copy of the file. It works with either a new name of if the copy is used to replace the original file.
    It seems file explorer's "copy" is clearing something within the file that is causing this problem.
    I have seen the same issue with both Excel and Word documents in native Office 2010 format.
    Is there a better way to clear this issue?
    Thanks

    Hi,
    It doesn't hang/crash, does it?
    If you could provide the exact error message, it would be preferred to determine the cause.
    You can also try the steps below to modify the registry, as mentioned in this thread:
    http://social.technet.microsoft.com/Forums/en-US/ba5114e0-98dd-4b44-a078-373df8899048/word-2007-issue-slow-opening-files?forum=word
    Note your 12.0 represents Office 2007, 14.0 is for Office 2010.
    Important
    This section, method, or task contains steps that tell you how to modify the registry. However, serious problems might occur if you modify the registry incorrectly. Therefore, make sure that you follow these steps carefully. For added protection, back up the
    registry before you modify it. Then, you can restore the registry if a problem occurs. For more information about how to back up and restore the registry,
    http://windows.microsoft.com/en-US/windows7/Back-up-the-registry
    Word
    HKEY_CLASSES_ROOT\Word.Document.14\Shell\Open\Command                
    Rename Subkey “Command” to “Old_Command”                
    Rename Key “ddeexec” to “Old_ddeexec”
    Using FileType Manager change .xls from Word.Sheet.8 to Word.Sheet.14 In the Open Command append “%1” 
    .docx In the Open Command append “%1” 
    Excel
    HKEY_CLASSES_ROOT\Excel.Document.14\Shell\Open\Command                
    Rename Subkey “Command” to “Old_Command”                
    Rename Key “ddeexec” to “Old_ddeexec”
    Using FileType Manager change .xls from Excel.Sheet.8 to Excel.Sheet.14 In the Open Command append “%1” 
    .xlsx In the Open Command append “%1”
    If the issue persists, you can also read this KB below and let me know if it is helpful:
    http://support.microsoft.com/kb/313937/en-us
    Regards,
    Melon Chen
    TechNet Community Support

  • How to FTP file and extract the zip file automatically?

    Hi,
    My app needs to FTP another site and also automatically unzip the transferred file over the internet by user clicking on one button. Any experts? thanks.

    How do you open a can of beans before you take it out of the pantry?
    However I suppose your question only sounded stupid like that, you didn't really mean it that way. One problem is that you didn't mention which way the transfer was going. I assume you are asking about getting a file and unzipping it? Many of the FTP clients described in the article that jmennen referred to allow you to get an InputStream that allows you to read bytes from the server. You would take this InputStream and wrap it in a ZipInputStream. That way you could unzip the file as you transfer it from the server, rather than having to use a temporary file between the two steps.
    But if you really meant that you wanted the unzipping to take place on the server before you did the download, no, you can't do that.

  • HOW TO READ AND OPEN Zip files IN MAIL?

    Anyone know how to open and read attached zip-files in iPhone 3G mail?
    Thanks in advance,
    Alessio

    Hi Alessio,
    The iPhone does not support reading or uncompressing .zip files.
    +Mail attachment support+
    +Viewable document types: .jpg, .tiff, .gif (images); .doc and .docx (Microsoft Word); .htm and .html (web pages); .key (Keynote); .numbers (Numbers); .pages (Pages); .pdf (Preview and Adobe Acrobat); .ppt and .pptx (Microsoft PowerPoint); .txt (text); .vcf (contact information); .xls and .xlsx (Microsoft Excel)+
    http://www.apple.com/iphone/specs.html
    Jason

  • Error reading zip file containing an excel file

    Hi all,
    Using servlets I am able to zip an excel file using java.util.zip package. The excel file is created using POI API.
    While I save and extract the zip file on my machine and then open the file in MS Excel. Excel pops a message saying "MS Office Excel has encountered a problem and need to close" and it gives me an option to "Recover my work and restart MS Office Excel". I select the option and then MS Excel does a document recovery and I am able to view my data. I get an excel repair log file saying as follows
    "Microsoft Office Excel File Repair Log
    Errors were detected in file 'C:\Documents and Settings\JohnDoe\Desktop\excel\test.xls'
    The following is a list of repairs:
    Damage to the file was so extensive that repairs were not possible. Excel attempted to recover your formulas and values, but some data may have been lost or corrupted.
    I have attached my servlet code down below I suspect there is a problem with PrintWriter to output or do I need to use OutputStream to write excel data.
    Below is my servlet code:
    import java.io.*;
    import javax.servlet.*;
    import org.apache.log4j.Logger;
    import java.util.*;
    import java.util.zip.*;
    import java.net.*;
    import org.apache.poi.hssf.usermodel.*;
    import org.apache.poi.hssf.record.*;
    import org.apache.poi.hssf.util.*;
    public class ZipServlet extends HttpServlet {
         * @see javax.servlet.http.HttpServlet#doGet(javax.servlet.http.HttpServletRequest,
         * javax.servlet.http.HttpServletResponse)
         public void doGet(HttpServletRequest request, HttpServletResponse response)
              throws ServletException, IOException {
              makeZip(request, response, "GET");
         * @see javax.servlet.http.HttpServlet#doPost(javax.servlet.http.HttpServletRequest, javax.servlet.http.HttpServletResponse)
         protected void doPost(HttpServletRequest request, HttpServletResponse response)
                   throws ServletException, IOException {
                   makeZip(request, response, "POST");
         public void makeZip(HttpServletRequest request, HttpServletResponse response, String methodGetPost) {
              Logger logger = Logger.getLogger(ZipServlet.class);
              try
                   int id=1;
                   ServletContext sc = getServletContext();
         HttpSession session = request.getSession();          
                   ConnectionPoolManager cpm = (ConnectionPoolManager)sc.getAttribute("CONNECTION_POOL_MANAGER");
                   ConnectionPool cp = cpm.getConnectionPool(id);
              createTestExcelZip(request,response,methodGetPost,session);
              } catch (Exception e2) {
         public void createTestExcelZip(HttpServletRequest request, HttpServletResponse response,
                   String methodGetPost,HttpSession session
                   )throws ServletException, IOException
              Logger logger = Logger.getLogger(ZipServlet.class);
              try
              {      //Create an Excel Workbook and placing value "Test" in the first cell
                   HSSFWorkbook wb = new HSSFWorkbook();
                   HSSFSheet sheet = wb.createSheet("new sheet");
                   HSSFCell cell=null;
                   HSSFRow row = sheet.createRow((short) 0);
                   short column = 0;
                   cell = row.createCell(column);
                   cell.setCellValue(new HSSFRichTextString("Test"));
                   HSSFCellStyle fontStyle = wb.createCellStyle();
              HSSFFont f = wb.createFont();
              f.setFontHeight((short) 200);
              f.setBoldweight(HSSFFont.BOLDWEIGHT_BOLD);
              fontStyle.setFont(f);
              cell.setCellStyle(fontStyle);
              response.setContentType("application/zip");
                   response.setHeader("Content-Disposition","attachment; filename=zipExcelRecordFiles.zip;");
                   int BUFFER = 2048;
                   byte buf[]=new byte[300000];
                   ByteArrayOutputStream baos = new ByteArrayOutputStream();
                   ZipOutputStream zos = new ZipOutputStream( baos );
                   ByteArrayInputStream is = null;
                   BufferedInputStream origin = null;
                   byte[] b = null;
                   String fileName = null;
                   b = wb.getBytes();
                   fileName = "testExcelRecords.xls";
                   try
                   is = new ByteArrayInputStream(b);
                   origin = new BufferedInputStream(is, BUFFER);
                   zos.putNextEntry(new ZipEntry(fileName)); // Add ZIP entry to output stream.
              int count;
              while((count = origin.read(buf, 0, BUFFER)) != -1)
              zos.write(buf, 0, count);
              zos.closeEntry(); // Complete the entry
                   is.close();
                   }catch(Exception e)
                        logger.error(e);
                   zos.close();
              PrintWriter pr = response.getWriter();
                   pr.write(baos.toString("ISO-8859-1"));
                   pr.close();
              catch(Exception e)
              logger.error(e);     
         * @see javax.servlet.GenericServlet#destroy()
         public void destroy() {
    Any help would be appreciated.
    Regards
    jdcunha

    Jdcunha,
    I am new to the field but encountered the same problem and recently found a solution. Hope this helps.
    For my project I wanted to create individual Excel 2003 workbooks for each file I created. Excel would give me the same error it gave you when I used the same HSSFWorkbook object. I tried creating a new Workbook object each time, but ran into the same issue.
    I ended up fixing the error by creating a new instance of my write-to-excel class each time I wanted to create a new workbook, instead of just recreating a new HSSFWorkbook object. It works perfectly and the Excel errors don't show. It may also be important to note I used OutputStream, I did not try it with printwriter.

  • Adding image to a zip file

    Hi all,
    I am trying to work out a servlet that creates an on-the-fly zip file. I am trying to add an image in this zip file and then I want to prompt user to download the created zip file. It is creating the zip file -it prompts the user and downloads the zip file... but when I open the downloaded zip file -the image is not found to be added in it. Please help, here is the code:
    package servlets;
    import java.io.*;
    import javax.servlet.*;
    import javax.servlet.http.*;
    import java.util.zip.*;
    import java.net.*;
    import java.util.*;
    public class CreateZipFile extends HttpServlet {
         byte b[] = new byte[300000];
         ByteArrayOutputStream bout = new ByteArrayOutputStream();
         ZipOutputStream zout = null;
         ServletOutputStream out = null;
         ServletContext servletContext = null;
         HttpServletResponse res=null;
         public void doGet (HttpServletRequest req, HttpServletResponse res) throws ServletException, IOException
              this.res=res;
              out=res.getOutputStream();
              servletContext=getServletContext();
              File f= new File(getServletContext().getRealPath(req.getContextPath()));
              String fs = System.getProperty("file.separator");
              addToZip_Image (f.getParentFile() + fs + ("images/thermorack.jpg"));
              System.out.println("ready");
              String zip = bout.toString();
              res.setContentType("application/zip");
              res.setHeader("Content-Disposition", "inline; filename=output_dd.zip;");
              System.out.println("finished");
              out.println(zip);
              out.flush();
         public void addToZip_Image(String img) throws ServletException, IOException
              System.out.println("image=" + img);
                   try {
                        FileInputStream input = new FileInputStream(img);
                        zout = new ZipOutputStream(new FileOutputStream(img));
                        zout.putNextEntry(new ZipEntry("image.jpg"));
                        int len;
                        while ((len = input.read(b)) > 0) {
                        zout.write(b, 0, len);
                        zout.closeEntry();
                        zout.close();
                        input.close();
                        System.out.println("closed");                    
                   } catch (Exception e) {
                        System.out.println("Exception occurred");
                        res.setContentType("text/html");
                        out.println("<html><head><title>Error</title></head>");
                        out.println("<body><b>");
                        out.println("An error has occured while processing "
                                  + "<br>");
                        out.println("Here is the exception: <br>" + e + "<br>");
                        e.printStackTrace(new PrintWriter(out));
                        out.println("</body>");
                        out.println("</html>");
    }

    You would need to purchase Stuffit Standard:
    http://my.smithmicro.com/mac/stuffit/index.html

  • I downloaded a .zip file. It ate up my space and i cant find the file. How do i get this file off my phone?

    I downloaded a .zip file. It ate up my space and i cant find the file. How can i get this file off my phone?

    Not possible. Safari won't download and save a Zip file. You either had to use a 3rd party app, or as wjosten suggests, your phone is jailbroken. If the former, you'll need to use that app to find it. If the latter, you'll have to look elsewhere for assistance.

Maybe you are looking for