Same files are generated differently

Hi, support

This is my original file
Michael DR Activity_2019-01-24.xlsx.zip (314.7 KB)

When I tried to generate an image, it looks like this
Screen Shot 2019-01-24 at 1.52.24 PM.jpg (279.9 KB)
→ Take a look at row 31
Screen Shot 2019-01-24 at 1.54.50 PM.png (671.2 KB)
The display result is not correct.

The weird thing is with the same file, when you just save it to another file (without modifying anything). It will be correct.

Please take a look at this.

The source code should be the same as this ticket

@Kevinng85,

Thanks for the template, screenshots and details.

We evaluated your issue a bit. Well, your issue is due to the fact that in the given template file, the saved formula values are incorrect for row 31. If you do not calculate formulas in the workbook, we just use that value (read) from template file for rendering. When opening the file in MS Excel and re-save it, MS Excel will calculate formulas automatically and save the correct value into the re-saved file, so there is no issue when using the re-saved file to generate the image. To simulate MS Excel’s behavior, you should calculate formulas before rendering, see the lines of code for reference:
e.g
Sample code:

.......
Workbook.CalculateFormula();

workbook.Save(…); 

Hope, this helps a bit.

@Amjad_Sahi that’s great.

Another concern is we don’t want to calculate all the time.

Is there any way to know how many formula or how much the complexity of the formula inside the workbook so we can make better decision whether to calculate or not?

@Kevinng85,

I am afraid it is not possible, we cannot know the complexity of the formulas until we calculate it actually. And, even we calculate the formulas, it is hard for us to describe the complexity involved. You can only get the total cells (count) which contains formulas. You can gather the count by checking Cell.IsFormula attribute, but we don’t think it is much useful for you to determine whether the calculation is simple or eating high resources(time, cpu, etc.) .

Thanks for your reply.

I understand that it is over complicated and just curious if you have another way.

CHeers,

@Kevinng85,

I am afraid, there may not be any better way to cope with it, check our previous reply.