I am using visual studio 2010, i want to compress word, excel, powerpoint files in maximum 1 MB. seperately.
How to compress any ms office files in maximum 1mB ?
1 Answer
Know the answer? Post it. Somebody with the same question will find it here.
I am using visual studio 2010, i want to compress word, excel, powerpoint files in maximum 1 MB. seperately.
Know the answer? Post it. Somebody with the same question will find it here.
Answer a question in the forums and earn +20 SHARP for every answer.
See unanswered questions
DevSocialUpcoming · 3rd editionAI Agents ConferenceDec 1–3, 2026Live onlineFree to attend5days leftRegister
Vishal YelveRank #178 · 13.6K reputationPosted Sep 29, 2022, 5:46 AM EDT
Hi Puneet,
Please check the below link
https://learn.microsoft.com/en-us/dotnet/api/system.io.compression.gzipstream?view=net-6.0#examples
https://learn.microsoft.com/en-us/dotnet/api/system.io.compression.gzipstream?view=netframework-4.0#examples
void CompressThis (string inFile, string compressedFileName) { using (FileStream sourceFile = File.OpenRead(inFile)) using (FileStream destinationFile = File.Create(compressedFileName)) using (GZipStream output = new GZipStream(destinationFile, CompressionMode.Compress)) { sourceFile.CopyTo(output); } }