Click here to Skip to main content
15,742,973 members
Please Sign up or sign in to vote.
1.00/5 (3 votes)
See more:
Hi folk's

how to zip multiple files into single file using grid , and extract into excel and save in a particular folder


My scenario is in this way ...download zip files from grid and extract into excel and save those files in a folder........


if you have any code please help me....





regard's
mahesh.b
Posted
Comments
Sergey Alexandrovich Kryukov 7-Sep-12 13:55pm    
Using grid? A grid has nothing to do with zip. Ever heard of separation of concerns?
--SA

1 solution

It's very unlikely that someone has this code, because this is too specific to your design and not very usual. Your problem is that you are mentally trying to put all things together. You need to be able to consider one thing at a time and separate concerns.

First, a grid. No, I don't believe it really contains files, so "download from grid" does not seem making any sense. Most likely, it contains some data with some URLs. So, first, you need to know how to extract the set of URLs and perhaps some related information (such as target file names or some other mapping between URLs and some other data). For this purpose, you need to read data from a grid. Just read MSDN documentation on this control and look at your own code where you populated the grid with data.

Next step is downloading. You did not inform us on what it is, but in most cases, it means downloading files using FTP or HTTP based on file URLs. To do this, you need to use one or more of classes derived from System.Net.WebRequest:
http://msdn.microsoft.com/en-us/library/system.net.webrequest.aspx[^].

On the MSDN page referenced above, you can see all non abstract classes implementing different protocols, read help on that (code samples are available) and see how to do downloads.

The remaining step is working with ZIP files. Here you might need to use some 3-rd party library. I would recommend do consider #ziplib:
http://www.icsharpcode.net/opensource/sharpziplib/[^].

Another option is using SevenZipSharp, a .NET wrapper of the famous 7-Zip:
http://en.wikipedia.org/wiki/7-Zip[^],
http://sevenzipsharp.codeplex.com/[^].

Both ZIP libraries are open-source.

Now you have all the components you need. As you can see, most work is already done for you. All you need is to put it all together according to your required scenario and write the code using available components. You can do you it by yourself.

Good luck,
—SA
 
Share this answer
 

This content, along with any associated source code and files, is licensed under The Code Project Open License (CPOL)



CodeProject, 20 Bay Street, 11th Floor Toronto, Ontario, Canada M5J 2N8 +1 (416) 849-8900