The Cell theCell=worksheet. Descendants() Where (c=& gt; Arthur c. ellReference==addressName). FirstOrDefault (); |
If (theCell!=null)
{
Value=https://bbs.csdn.net/topics/theCell.InnerText;
If (theCell CellFormula!=null)
{
If (theCell CellValue!=null)
{
Value=https://bbs.csdn.net/topics/theCell.CellValue.InnerText;
}
The else {
return null;
}
}
}
Such as read Q51 column line 51 (Q) value, theCell. The InnerText value is "=ROUND (SUM (I51 J51 * and L51 * K51, M51 N51 * and P51 * O51), 2) 0.320000", theCell. CellValue. The InnerText value is "0.320000", but actually in excel Q51 value is 0.8, the odd thing was not Q column more than some value can read wrong, only a few misread,
The excel sheet is password protected, remove the password protection will not read wrong, but can't read the formula, is give sheet to encrypt code below:
SheetProtection SheetProtection=new SheetProtection () {Sheet=true, Objects=true, Scenarios,=true, the Password="* * * *"};
Worksheet. InsertAfter (sheetProtection, ws. GetFirstChild());
What a great god met this kind of situation or is there a way to solve, the trouble to help me, thank you!
CodePudding user response:
What is the difference between is round?You to set up a file, need not formula, write Numbers in directly, then read compare have a look
CodePudding user response:
Isn't the problem the rounded rounded cannot turn 0.8 to 0.32, there is no formula is okCodePudding user response:
=ROUND (SUM (I51 J51 * and * K51 L51, M51 N51 * and * O51 P51), 2) 0.320000, this is the formula in the Excel?Not in a component, like epplus is good too