Guide for C#
Core Document Formats
Additional Features

C# Word - Word Compression in C#.NET

Word Compression and Decompression in Visual C#.NET Project

Visual C#
Home > .NET Imaging SDK > C# > Word Compression
If this is your first time to use our DocImageSDK, we strongly suggest you reading How to Start first!

RasterEdge .NET Imaging SDK provides comprehensive image and document editing features that allow developers and end-users to easily incorporate robust Word document compression and decompression functionalities into your document management system. By compressing the image and embedded object you can get a Word doc with reduced size. With the Office Word document compressed, users will find it more convenient for file transfer or sending the docx file through email attachment.
Related .net document control helps: image viewer jquery: ASP.NET Image Viewer Control(MVC & WebForms): view, annotate, redact, convert image files in html, JQuery pdf document viewer c#: ASP.NET PDF Document Viewer in C#: open, display, view, annotate, redact Adobe PDF files online in ASP.NET MVC & WebForm... view text file: ASP.NET Text file viewer in MVC, WebForms: Open, view, annotate, convert txt files in C# ASP.NET
mvc document viewer: ASP.NET MVC Document Viewer: view, annotate, redact files on ASP.NET MVC web projects office document viewer: ASP.NET Office Word Document Viewer: view Word doc files online using C# in ASP.NET MVC web applications pdf editor component: EdgePDF: ASP.NET PDF Editor Web Control: Online view, annotate, redact, edit, process, convert PDF documents sharepoint document viewer free: ASP.NET SharePoint Document Viewer: view, annotate, redact documents in SharePoint
  • Written in Visual C#.NET pure code
  • Compatible with .NET Framework 2.0 and later versions
  • Easy to integrate into .NET development application such as MS Visual Studio 2005 / 2008 / 2010
  • Efficiently reduce Microsoft Office Word document size using C# code
  • Compress size for images and embedded object in Word in C# programming
  • Easier to send Word to another user or through email with a minimum size
This tutorial page is aimed to help .NET developers learn how to compress & decompress a Word document in C#. Here are the sections with examples that are going to be talked about:
  • How to create a C# Word processing project
  • C# methods for Word compression & decompression
  • C# sample codes to compress & decompress Word
Besides this Word compressor and decompressor, RasterEdge also provides libraries and tutorials for C# developers to compress and decompress other file formats, such as JBIG2, JPEG2000, TIFF and other image file. View more here:
How to Create a C# Project
In order to use the Word compressor and decompressor library, developers need to create a Visual C# application in your Microsoft Visual Studio first. Then you can load the target Word into your program for later compression and decompression conduct. Please follow the steps below to create a C# application first:
  1. Open Visual Studio 2005 or greater versions and create a C#.NET Windows project;
  2. Download the RasterEdge .NET Imaging SDK and unzip it;
  3. Run the exe file in the package to get an evaluation license, and copy the generated RasterEdgeLicense.txt to your project;
  4. Now please copy the Word processing DLLs to your project: RasterEdge.Imaging.Basic.dll & RasterEdge.Imaging.MSWordDocx.dll;
  5. Add those two RasterEdge assemblies to C# project reference by right-clicking on the References folder.
C# Word Compress & Decompress Methods
Here are the Visual C# methods you will use in order to compress and decompress Microsoft Office Word (.docx) document in C# application. Using these methods, developers will find it easy to create single or bulk Word compression & depression process(es). Images within the Word doc will be compressed to get you the Word file with a shrinked size, and then you can save both the original and compressed files to your local directory for later use.
private void DocumentCompression(string inFile, string outFile, ImageEncoder encoder);
private void DocumentDecompression(string inFile, string outFile, ImageDecoder Decoder);
C#.NET Code to Compress & Decompress Word
When your Microsoft Office Word document contain large amounts of formatting code and / or embedded images, they can cause your doxc file to be extremely large, which is not suitable for transferring or emailing. However, if you have already created a C# project in your VS program, you can simply copy the C# sample codes below to compress the Word document file to a minimum size.
On the other hand, this Word processing library control also provides function for you to decompress a Word document to get better idea of the embedded image or object. Just copy the second chunk of C# sample code to your project for a test!

Word Compression in C#.NET

using System.IO;
using System.Drawing.Printing;
using RasterEdge.Imaging;
using RasterEdge.Imaging.Codec.Compression;
using RasterEdge.Imaging.MSWordDocx;

DocumentEncoder = DocumentEncoder.Group3Encoding

RasterEdgeImaging Document = new RasterEdgeDocumentg();
Image. DocumentCompression(@"C:\1.docx", "C:\2.docx", DocumentEncoder DocumentEncoder.Group3Encoding);

Word Decompression in C#.NET

using System.IO;
using System.Drawing.Printing;
using RasterEdge.Imaging;
using RasterEdge.Imaging.Codec.Decompression;
using RasterEdge.Imaging.MSWordDocx;

DocumentDecoder = DocumentDecoder.Group3Decoding

RasterEdgeImaging Document = new RasterEdgeDocument ();
Document. DocumentDecompression(@"C:\1.docx", "C:\2.docx", DocumentDecoder DocumentDecoder.Group3Decoding);
More Tutorials on Word Document in C#.NET

Recommend this to Google+ is professional provider of ASP.NET MVC Document Viewer, ASP.NET PDF Viewer, MVC PDF Viewer document, content and imaging solutions, available for ASP.NET AJAX, Silverlight, Windows Forms as well as WPF. We are dedicated to provide powerful & profession imaging controls, PDF document, image to pdf files and components for capturing, viewing, processing, converting, compressing and stroing images, documents and more.

©2000-2017 Raster