com.aspose.words
Class CompressionLevel

java.lang.Object
    extended by com.aspose.words.CompressionLevel

public class CompressionLevel 
extends java.lang.Object

Utility class containing constants. Compression level for OOXML files.

(DOCX and DOTX files are internally a ZIP-archive, this property controls the compression level of the archive.

Note, that FlatOpc file is not a ZIP-archive, therefore, this property does not affect the FlatOpc files.)

Example:

Shows how to specify the compression level to use while saving an OOXML document.
Document doc = new Document(getMyDir() + "Big document.docx");

// When we save the document to an OOXML format, we can create an OoxmlSaveOptions object
// and then pass it to the document's saving method to modify how we save the document.
// Set the "CompressionLevel" property to "CompressionLevel.Maximum" to apply the strongest and slowest compression.
// Set the "CompressionLevel" property to "CompressionLevel.Normal" to apply
// the default compression that Aspose.Words uses while saving OOXML documents.
// Set the "CompressionLevel" property to "CompressionLevel.Fast" to apply a faster and weaker compression.
// Set the "CompressionLevel" property to "CompressionLevel.SuperFast" to apply
// the default compression that Microsoft Word uses.
OoxmlSaveOptions saveOptions = new OoxmlSaveOptions(SaveFormat.DOCX);
saveOptions.setCompressionLevel(compressionLevel);

StopWatch st = new StopWatch();
st.start();
doc.save(getArtifactsDir() + "OoxmlSaveOptions.DocumentCompression.docx", saveOptions);
st.stop();

File fileInfo = new File(getArtifactsDir() + "OoxmlSaveOptions.DocumentCompression.docx");

System.out.println(MessageFormat.format("Saving operation done using the \"{0}\" compression level:", compressionLevel));
System.out.println(MessageFormat.format("\tDuration:\t{0}", st.getTime()));
System.out.println(MessageFormat.format("\tFile Size:\t{0} bytes", fileInfo.length()));

Field Summary
static final intNORMAL = 0
           Normal compression level. Default compression level used by Aspose.Words.
static final intMAXIMUM = 1
           Maximum compression level.
static final intFAST = 2
           Fast compression level.
static final intSUPER_FAST = 3
           Super Fast compression level. Microsoft Word uses this compression level.
 

Field Detail

NORMAL = 0

public static final int NORMAL
Normal compression level. Default compression level used by Aspose.Words.

MAXIMUM = 1

public static final int MAXIMUM
Maximum compression level.

FAST = 2

public static final int FAST
Fast compression level.

SUPER_FAST = 3

public static final int SUPER_FAST
Super Fast compression level. Microsoft Word uses this compression level.

See Also:
          Aspose.Words Documentation - the home page for the Aspose.Words Product Documentation.
          Aspose.Words Support Forum - our preferred method of support.