Free Support Forum - aspose.com

Single Quote added to formula

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

Hi,


Well, since you are using some older version (e.g v5.0.0) of the product for which I am not sure if this is an issue with that version or not. We also cannot evaluate or fix the issue if it was there in that version.

We recommend you to kindly try our latest version, it should works fine with it:
http://www.aspose.com/community/files/51/.net-components/aspose.cells-for-.net/entry420470.aspx
If you still find any issue with latest version, please create a sample console application (runnable) and zip it to post it here, we will check it soon. If we found the issue using your sample project, we will log it as an issue into our database and fix it as soon as possible.

Thank you.

Yeah, I thought about that after I posted and while you where typing your response I was downloading the lastest version.

I will need a little help converting my WorkBook.Save over to the new format. currently I'm using

Dim param As String = "List"
pWorkbook.Save(param + ".xls", SaveType.OpenInExcel, FileFormatType.Excel97To2003, Me.Response)

Looks like I'm getting the same problem with single quotes being added.

Hi,


In the new version, you may try e.g:
pWorkbook.Save(Me.Response, param + “.xls”, ContentDisposition.Attachment, New XlsSaveOptions())

Please check the document for complete reference:
http://www.aspose.com/docs/display/cellsnet/Saving+Files

Thank you.