Quantcast
Channel: ClosedXML - The easy way to OpenXML
Viewing all articles
Browse latest Browse all 1877

New Post: Problem with the formula

$
0
0
Hello. I have a problem with the recording of the formula in the cell. Formula - "=IF(A6>$A$4;0;1-(E6+F6)/C6)".

Sample Code:

var workbook = new XLWorkbook();
var worksheets = workbook.Worksheets.Add("Sheet 1");

worksheets.Cell(4, 1).Value = new DateTime(DateTime.Now.Year, DateTime.Now.Month, DateTime.Now.Day);
worksheets.Cell(6, 1).Value = new DateTime(DateTime.Now.Year, DateTime.Now.Month, DateTime.Now.Day);

worksheets.Cell(6, 3).Value = "3";
worksheets.Cell(6, 5).Value = "5";
worksheets.Cell(6, 6).Value = "6";

worksheets.Cell(2, 2).FormulaA1 = "=IF(A6>$A$4;0;1-(E6+F6)/C6)";

workbook.SaveAs("123.xlsx");



When opening a file I get an error - "Excel found unreadable content in '123.xlsx'. Do you want to recover the contents of this workbook? If you trust the source of this workbook, click Yes."

Offline formula in cell (2, 2). Tell me what am I doing wrong?

Viewing all articles
Browse latest Browse all 1877

Trending Articles



<script src="https://jsc.adskeeper.com/r/s/rssing.com.1596347.js" async> </script>