Analyzing your prompt, please hold on...
An error occurred while retrieving the results. Please refresh the page and try again.
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.
The following code snippet demonstrates the use of OoxmlCompressionType enumeration and compares the conversion time for Level1, Level6, and Level9. You may also compare the sizes of the generated files.
#include <iostream>
#include <chrono>
#include "Aspose.Cells.h"
using namespace Aspose::Cells;
using namespace std::chrono;
int main()
{
Aspose::Cells::Startup();
// Source directory path
U16String srcDir(u"..\\Data\\01_SourceDirectory\\");
// Output directory path
U16String outDir(u"..\\Data\\02_OutputDirectory\\");
// Load the workbook
Workbook workbook(srcDir + u"LargeSampleFile.xlsx");
// Create XlsbSaveOptions object
XlsbSaveOptions options;
// Set compression level to 1 and save the workbook
options.SetCompressionType(OoxmlCompressionType::Level1);
auto start = high_resolution_clock::now();
workbook.Save(outDir + u"LargeSampleFile_level_1_out.xlsb", options);
auto stop = high_resolution_clock::now();
auto duration = duration_cast<milliseconds>(stop - start);
std::cout << "Level 1 Elapsed Time: " << duration.count() << std::endl;
// Set compression level to 6 and save the workbook
options.SetCompressionType(OoxmlCompressionType::Level6);
start = high_resolution_clock::now();
workbook.Save(outDir + u"LargeSampleFile_level_6_out.xlsb", options);
stop = high_resolution_clock::now();
duration = duration_cast<milliseconds>(stop - start);
std::cout << "Level 6 Elapsed Time: " << duration.count() << std::endl;
// Set compression level to 9 and save the workbook
options.SetCompressionType(OoxmlCompressionType::Level9);
start = high_resolution_clock::now();
workbook.Save(outDir + u"LargeSampleFile_level_9_out.xlsb", options);
stop = high_resolution_clock::now();
duration = duration_cast<milliseconds>(stop - start);
std::cout << "Level 9 Elapsed Time: " << duration.count() << std::endl;
Aspose::Cells::Cleanup();
return 0;
}
Analyzing your prompt, please hold on...
An error occurred while retrieving the results. Please refresh the page and try again.