Adjust workbook compression level

Adjust workbook compression level

Developers can adjust the compression level of the workbook when working with larger workbooks. Developers may prioritize smaller file sizes over processing time or vice versa. Aspose.Cells provides OoxmlCompressionType enumeration which you can use to set the compression level of the workbook. The OoxmlCompressionType enumeration provides the following members.

  • LEVEL_1: The fastest but least effective compression.
  • LEVEL_2: A little slower, but better, than level 1.
  • LEVEL_3: A little slower, but better, than level 2.
  • LEVEL_4: A little slower, but better, than level 3.
  • LEVEL_5: A little slower than level 4, but with better compression.
  • LEVEL_6: A good balance of speed and compression efficiency.
  • LEVEL_7: Pretty good compression!
  • LEVEL_8: Better compression than Level7!
  • LEVEL_9: The “best” compression, where best means greatest reduction in the size of the input data stream. This is also the slowest compression.

The following code snippet demonstrates the use of OoxmlCompressionType enumeration and compares the conversion time for LEVEL_1, LEVEL_6, and LEVEL_9. You may also compare the sizes of the generated files.