Aspose.Cells.dll version 5.0.0.0
When inserting a formula, single quotes are getting added.I have the formula in a DataView. If I break the execution and examine the value of
sheet.Cells(CurrentRow, CurrentColumn).Formula
everything looks fine.
=IF(RC[16]<>"",RC[-1]*RC[16],RC[-1]*DefaultSalesCostPercentage)
But when Excel opens it looks like this.
=IF('RC[16]'<>"",'RC['-'1]'*'RC[16]','RC['-'1]'*DefaultSalesCostPercentage)
Here is my code.
Dim Equation As Object = dataView(DataViewRowIndex)("ExcelEquation")
If IsDBNull(dataView(DataViewRowIndex)("ExcelEquation")) = False Then
sheet.Cells(CurrentRow, CurrentColumn).Formula = Equation.ToString()
Else
Dim UniqueName As String = Me.drgAuctions.Columns(item.Value.Split("#")(1) + ColumnOffset).UniqueName
Dim label As Label = CType(gridRow.FindControl("lbl" + UniqueName), Label)
If IsNumeric(label.Text.Replace("$", "")) Then
DoubleValue = label.Text.Replace("$", "")
sheet.Cells(CurrentRow, CurrentColumn).PutValue(DoubleValue)
pStyle.Number = 42
Else
sheet.Cells(CurrentRow, CurrentColumn).PutValue(label.Text)
pStyle.Number = 0
End If
End If
Dim Equation As Object = dataView(DataViewRowIndex)("ExcelEquation")
If IsDBNull(dataView(DataViewRowIndex)("ExcelEquation")) = False Then
sheet.Cells(CurrentRow, CurrentColumn).Formula = Equation.ToString()
Else
Dim UniqueName As String = Me.drgAuctions.Columns(item.Value.Split("#")(1) + ColumnOffset).UniqueName
Dim label As Label = CType(gridRow.FindControl("lbl" + UniqueName), Label)
If IsNumeric(label.Text.Replace("$", "")) Then
DoubleValue = label.Text.Replace("$", "")
sheet.Cells(CurrentRow, CurrentColumn).PutValue(DoubleValue)
pStyle.Number = 42
Else
sheet.Cells(CurrentRow, CurrentColumn).PutValue(label.Text)
pStyle.Number = 0
End If
End If