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

Free Support Forum - aspose.com

Copy Array formula increase excel file size drastically

HI,
I changed the copy formula to arrayFormula,

Original Code

localSheet.Cells[targetCellID].Formula = workBook.Worksheets[“Format”].Cells[refCellID].Formula;

to

localSheet.Cells[targetCellID].SetArrayFormula(
workBook.Worksheets[“Format”].Cells[refCellID].Formula,
workBook.Worksheets[“Format”].Cells[targetCellID].Row,
workBook.Worksheets[“Format”].Cells[targetCellID].Column
);

and I see a big jump in the file size. Like a 300kb excel file (.xls) becomes 3000kb. Am I using the API wrongly? Please let me know.

Aspose Vesion: 16.11.0.0

@ksnaspose,

Thanks for the sample code and details.

Please try our latest version: Aspose.Cells for .NET v17.9:
https://downloads.aspose.com/cells/net/new-releases/aspose.cells-for-.net-17.9/

If you still find the issue with v17.9, kindly do create a sample console demo application (runnable), zip the project with all the files and share with us (you may upload to some file sharing service, e.g dropbox, Google drive, etc.) and share the Download link here, we will check it soon.

@ksnaspose

Thanks for using Aspose APIs.

We think, you have misunderstood the last two parameters for setting array formula. They should define the range where array formula will be applied (row/column count). For your case, it should both be 1.

1 Like