how can i calculated values after Worksheet.Calculate()?

user9775219

i tried Trial version of Gembox.SpreadSheet.

when i Get Cells[,].value by for() or Foreach(). so i think after Calculate() & get Cell[].value, but that way just take same time,too. it take re-Calculate when i Get Cell[].value.

workSheet.Calcuate(); <- after this, values are Calculated, am i right?
for( int i =0; i <worksheet.GetUsedCellRange(true).LastRowIndex+1;++i)
{
    ~~~~for Iteration~~~
     var value =  workSheet.Cells[i,j].Value; <- re-Calcuate value(?)
}

so here is a Question. Can i Get calculated values? or you guys know pre-Calculate function or Get more Speed?

Mario Z

Unfortunate, I'm not sure what exactly you're asking, can you please try reformulating your question a bit so that it's easier to understand it?

Nevertheless, here is some information which I hope you'll find useful.
To iterate through all cells, you should use one of the following:

1.

foreach (ExcelRow row in workSheet.Rows)
{
    foreach (ExcelCell cell in row.AllocatedCells)
    {
        var value =  cell.Value;
        // ...
    }
}

2.

for (CellRangeEnumerator enumerator = workSheet.Cells.GetReadEnumerator(); enumerator.MoveNext(); )
{
    ExcelCell cell = enumerator.Current;
    var value = cell.Value;
    // ...
}

3.

for (int r = 0, rCount = workSheet.Rows.Count; r < rCount; ++r)
{
    for (int c = 0, cCount = workSheet.CalculateMaxUsedColumns(); c < cCount; ++c)
    {
        var value = workSheet.Cells[r, c].Value;
        // ...
    }
}

I believe all of them will have pretty much the same performances.
However, depending on the spreadsheet's content this last one could end up a bit slower. This is because it does not exclusively iterate only through allocated cells.

So for instance, let say you have a spreadsheet which has 2 rows. The first row is empty, it has no data, and the second row has 3 cells. Now if you use 1. or 2. approach then you will iterate only through those 3 cells in the second row, but if you use 3. approach then you will iterate through 3 cells in the first row (which previously were not allocated and now they are because we accessed them) and then through 3 cells in the second row.

Now regarding the calculation, note that when you save the file with some Excel application it will save the last calculated formula values in it. In this case you don't have to call Calculate method because you already have the required values in cells.
You should call Calculate method when you need to update, re-calculate the formulas in your spreadsheet, for instance after you have added or modified some cell values.

Last, regarding your question again it is hard to understand it, but nevertheless:

  • Can i Get calculated values?
    Yes, that line of code var value = workSheet.Cells[i,j].Value; should give you the calculated value because you used Calculate method before it. However, if you have formulas that are currently not supported by GemBox.Spreadsheet's calculation engine then it will not be able to calculate the value. You can find a list of currently supported Excel formula functions here.

  • or you guys know pre-Calculate function or Get more Speed?
    I don't know what "pre-Calculate function" means and for speed please refer to first part of this answer.

Collected from the Internet

Please contact [email protected] to delete if infringement.

edited at
0

Comments

0 comments
Login to comment

Related

From Dev

How can I add a custom fee in woocommerce that is calculated after tax

From Dev

How can I calculate all values in form?

From Dev

How can I calculate the sum of database values

From Dev

How can I calculate the multinomial probability values?

From Dev

How can i calculate table values

From Dev

How can I calculate total values of table column after filtering in React?

From Dev

Calculate mean of calculated values

From Dev

How can I use values in an old dataframe to calculate a new dataframe?

From Mysql

How can i calculate the average of fields and exclude the 0 values

From Dev

How can I calculate rankings of unique values in MySQL?

From Dev

how can i calculate the percentage between the values ​of these two queries?

From Dev

How can i calculate the sum the values inside a child node in firebase?

From Dev

How can I calculate exponents about negative values in python?

From Dev

How can I use calculated values by formula in a new column for other rows in new column in R?

From Mysql

How can I SELECT a row with MAX(value) from a derived table where the values are all calculated sums?

From Dev

How can I add four calculated values to a result set from a Stored Proc (TSQL)?

From Dev

How can I add already calculated standard error values to each bar in a bar plot (ggplot)?

From Dev

Numpy Median Value Calculated not represented on BarPlot, How can I represent values according

From Dev

How can I update a cell into worksheet without create new worksheet

From Dev

How can I set a worksheet object based on a worksheet's codename?

From Dev

I calculated this simple loop complexity incorrectly, how to calculate it correctly?

From Dev

How can I animate a calculated position with JQuery

From Dev

How can I reference a calculated field in a subquery?

From Dev

How can I calculate number of buses based on changing trials of customers which have been calculated using Norminv function of excel?

From Dev

How do I calculate the moving average of the 7 most recent values after the first Seven values in java?

From Dev

How can I calculate an integral?

From Dev

How can I calculate a digest

From Dev

How do I add the values calculated in a for loop in a array?

From Dev

How do I modify a collection after being calculated?

Related Related

  1. 1

    How can I add a custom fee in woocommerce that is calculated after tax

  2. 2

    How can I calculate all values in form?

  3. 3

    How can I calculate the sum of database values

  4. 4

    How can I calculate the multinomial probability values?

  5. 5

    How can i calculate table values

  6. 6

    How can I calculate total values of table column after filtering in React?

  7. 7

    Calculate mean of calculated values

  8. 8

    How can I use values in an old dataframe to calculate a new dataframe?

  9. 9

    How can i calculate the average of fields and exclude the 0 values

  10. 10

    How can I calculate rankings of unique values in MySQL?

  11. 11

    how can i calculate the percentage between the values ​of these two queries?

  12. 12

    How can i calculate the sum the values inside a child node in firebase?

  13. 13

    How can I calculate exponents about negative values in python?

  14. 14

    How can I use calculated values by formula in a new column for other rows in new column in R?

  15. 15

    How can I SELECT a row with MAX(value) from a derived table where the values are all calculated sums?

  16. 16

    How can I add four calculated values to a result set from a Stored Proc (TSQL)?

  17. 17

    How can I add already calculated standard error values to each bar in a bar plot (ggplot)?

  18. 18

    Numpy Median Value Calculated not represented on BarPlot, How can I represent values according

  19. 19

    How can I update a cell into worksheet without create new worksheet

  20. 20

    How can I set a worksheet object based on a worksheet's codename?

  21. 21

    I calculated this simple loop complexity incorrectly, how to calculate it correctly?

  22. 22

    How can I animate a calculated position with JQuery

  23. 23

    How can I reference a calculated field in a subquery?

  24. 24

    How can I calculate number of buses based on changing trials of customers which have been calculated using Norminv function of excel?

  25. 25

    How do I calculate the moving average of the 7 most recent values after the first Seven values in java?

  26. 26

    How can I calculate an integral?

  27. 27

    How can I calculate a digest

  28. 28

    How do I add the values calculated in a for loop in a array?

  29. 29

    How do I modify a collection after being calculated?

HotTag

Archive