[Smart marker] CPU 100% and massive memory because of large amount of formulas or cells filled in the worksheet

We have a case in production environment: client produced a template which has 10000 columns and 10000 rows, that is a matrix with 10000 * 10000 cells and every cell in the matrix is filled with custom function like “lookup(A{r},C1…10000)” .
image.jpg (116.8 KB)

After the execution of WorkbookDesigner.process it will lead to cpu 100% and massive memory is cost. In this case it is a wrong way to use Smart Marker but we can’t find an elegant way to restrict our clients how to use in right way.

So I want to know if we have some API to restrict the total number of formula or cells to avoid cpu 100% and massive in the “WorkbookDesigner.process”. Like setMaxFormulaNumber or setMaxCellsNumber N if the number is beyond N the “WorkbookDesigner.process” will be terminated automatically.

Hope for your reply.

@kevinzhang
Please implement ICellsDataTable as a data source yourself, you can control when ending process with ICellsDataTable.Next() returns false

Hi, I have implement data source by ICellsDataTable with limit 20000. But 20000 * 20000 is also a big number, is there any api to restrict the number of cells or max columns in the process of drawing ?

Our clients of product can edit the template in any way, so we need a more generic or original way to restrict the wrong input of template. Thank you. Hope for your reply. :smiley_cat: :smiley_cat:

Hi, I have implement data source by ICellsDataTable with limit 20000. But 20000 * 20000 is also a big number, is there any api to restrict the number of cells or max columns in the process of drawing ?

Our clients of product can edit the template in any way, so we need a more generic or original way to restrict the wrong input of template. Thank you. Hope for your reply. :smiley_cat: :smiley_cat:

Any one help ? this is an urgent case in production environment… :rofl: :rofl: :rofl:

@kevinzhang
1, Limit columns
ICellsDataTable.Columns property is used to define how many columns in the table.
2, Limit Cells’ count
You can simply get the number of data with ICellsDataTable.Next() .
public class CustomerDataSource : ICellsDataTable
{
private int RowCount;
public bool Next()
{
RowCount++;
If(RowCount* Columns.Length> xxxx)
{
return false;
}
}

I think you didn’t understand my purpose. This is a demo project that simulates our production case. AsposeCpuMemory.zip (252.2 KB)

We have a datasource level which has 10000 rows data. Clients can edit the template in any way. In this case clients want to do “looking up” by our custom function “mylookup”, as to the wrong input like the template in demo. The data matrix is 10000 * 10000, so it has 10000*10000 string function “mylookup…”
so it does lots of GC operation and cpu is very high when designer is processing.
image.jpg (275.7 KB)
image.jpg (281.0 KB)

It is a wrong input for template, so we want to restrict the max cells or max cols to avoid the memory cost and cpu problem. We can’t restrict the row count of datasource directly, because sometimes clients want to show data eg: 15000, but only a few cols like 500. Hope you can understand.

So I want to know if aspose have a kind of API can restrict the max columns or cells in excel when smart marker processing.

@kevinzhang
Please check the attached codes .limit.zip (1.1 KB)