I'm trying to figure out how to create a formula cell. A simple SUM for a column. When I try to open the Excel sheet. I get the following Excel message:
"Excel found unreadable content in '*xlsx'. Do you want
to recover the contents of this workbook? If you trust the source of
this workbook, click yeas.
I'm using VB.NET and OpenXML2.0
Protected Overridable Function CreateFormulaCell(ByVal formula As String, ByVal cellReference As String) As Cell Dim cell As New Cell() Dim cellformula As New CellFormula(formula) cell.CellFormula = cellformula cell.CellReference = cellReference Return cell End Function
It is difficult to tell from the information that you give. One common mistake is to put the equal sign at the start of the formula. If that is not it, then there are a couple of ways to find the problem. First, you can create a spreadsheet that looks just like you want, save it, then compare to the generated spreadsheet. Another approach is to make changes to the generated spreadsheet until it works. I often use a combination of these two approaches.