We're sorry Aspose doesn't work properply without JavaScript enabled.

Free Support Forum - aspose.com

High cpu usage and time opening an xlsx

i have code as shown below opening an excel files and generating a thumbnail from specified sheet. if i use it to open up the attached xlsx file (hcr calculator 01_29) , when the new Workbook line is called, if I watch cpu usage, it spikes to 35-40% and it take a few seconds to open. I would not expect this behavior from a 5meg file. This seems like an issue to me, because we use this under the context of a service, but if one call is generating this much time and cpu overhead, that is not very scalable.

I also attached a smaller file (benefits statemet with chart..), which takes subsecond as a comparison. its only 1.7 meg, but still nowhere near the time and cpu usage to open it up.


public Image CreateThumbnail(byte[] file, int worksheetNumber, int resolution) { int adjustedWorksheetNumber = worksheetNumber - 1; Workbook book = new Workbook(new MemoryStream(file)); Worksheet sheet = book.Worksheets[adjustedWorksheetNumber]; ImageOrPrintOptions options = new ImageOrPrintOptions(); options.ImageFormat = ImageFormat.Png; options.HorizontalResolution = resolution; options.VerticalResolution = resolution; sheet.PageSetup.FitToPagesTall = 1; sheet.PageSetup.FitToPagesWide = 1;

        var render = new SheetRender(sheet, options);
        //render.PageCount = 1;

        return render.ToImage(0);

XLSX files are actually compressed archives. Try opening those files directly from excel, you will most likely see similar performance. I was testing with a 36MB .xlsx file today that uncompressed is around 270MB and takes 17seconds to open on a computer with a SSD and an i7 processor.


Thanks for your files and sharing some details.

Well, Michael is right to certain extent, it takes some time to open some XLSX files into even MS Excel. After an initial investigation, I did notice the issue, it takes a bit higher CPU usage and time while opening the file "HCR+Calculator+01_29.xlsx" which apparently it should not as I can open some other files fine with no such issue.

Sample code:

Workbook workbook = new Workbook("e:\\test2\\HCR+Calculator+01_29.xlsx");

We need to look into your issue and will do it soon. I have logged a ticket with an id "CELLSNET-41379" for your issue. Once we have any update on it, we will let you know here.

Thank you.


Thanks for your posting and using Aspose.Cells.

After further investigation and checking your file, we found that

a) The file is encrypted, we have to decrypt file first.
b) The size of the unzipped file is about 50M.