Free Support Forum - aspose.com

Autofilter problem

Dear Aspose Team,

I've some problem with cell.

I put some code to create a summary in a cell with some formula, like this :

Dim cellSumJan As Cell = cells(0, 0)

cellSumJan = cells("I397")

cellSumJan.Formula = "=SUM(I7:I396)"

And it works, there is some value in cell "I397". But if i filter the data with an autofilter ( for example, i choose "BMW" in Brand category ), the summary in that cell was disappear.

How to fix this problem?? I beg you please...

Thanks..

I create a file with following code:

Dim wb As Workbook = New Workbook()
wb.Worksheets(0).Cells(0, 0).PutValue("BMW")
Dim i As Integer
For i = 1 To 9
wb.Worksheets(0).Cells(i, 0).PutValue(i)
Next
wb.Worksheets(0).Cells(10, 0).Formula = "=SUM(A2:A10)"
wb.Save("d:\test\abc.xls")

When I set AutoFilter on A1, I don't find any problem.

Which version of Aspose.Cells are you using? Could you please post a simple sample project to show your problem? Thank you.

Hi,

Following is my code and it's fine:

Dim workbook As Workbook = New Workbook()

Dim sheet As Worksheet = workbook.Worksheets(0)

Dim cells As Cells = sheet.Cells

cells("I1").PutValue("Veh")

cells("J1").PutValue("Price")

cells("I2").PutValue("Honda")

cells("J2").PutValue(2000000)

cells("I3").PutValue("Suzuki")

cells("J3").PutValue(1000000)

cells("I4").PutValue("BMW")

cells("J4").PutValue(35000000)

cells("I5").PutValue("Diah")

cells("J5").PutValue(1500000)

sheet.AutoFilter.Range = "I1:J397"

'sheet.AutoFilter.Filter(0, "BMW") ' you may filter your data dynamically too.

cells("I7").PutValue(100)

cells("I396").PutValue(200)

Dim cellSumJan As Cell = cells("I397")

cellSumJan.Formula = "=SUM(I7:I396)"

workbook.Save("d:\autfilter.xls")

I am using Aspose.Cells (4.1). What about yours? Do post us your sample code plz to sort out your problem.

Thank you.

Regards

Amjad Sahi

Aspose Nanjing Team