listObjects.PutCellValue doesn't write formuls properly

Hi,

We have a question about how to write properly formulas in a table so that the table behavior is considered.

In the attachment is a simple example how to work:
worksheet.Cells[“A6”].Formula = “=SUM(A1:A3)”; inside and outside of a table
and
listObjects[1].PutCellValue(4, 0, “=SUM(C1:C3)”); inside of a table

So we can properly write formula inside a table only with direct call of cell.formula = “formula”, but in that case the table behavior logic isn’t considered. I mean when we call listObjects.PutCellValue new cells inside of table are inserted and table changes its size automatically

formulas.zip (87.2 KB)

Thx

@ILVO,

This is expected behavior. Please note, ListObject.PutCellValue() method is used to set value to the list object cell. So, when you try to specify the formula (“=SUM(C1:C3)”) via this method, it will be taken and inserted as string and won’t be set as formula. Please directly use Cell.Formula attribute to set your desired formulas.

ok yes we do it such way, but its like a workaround.
Jetzt we call listObjects[0].Formula(“some_formula”) so thet table was properly handled and then we should write in the same cell the same formula by calling cell.formula so that it was correctly calculated

but it was more logical if there was a method
listObjects[0].Formula(“some_formula”) that write properly formulas and expanded properly tables as by listObjects[0].PutCellValue(“some_value”) and exactly so have we for cells: cell.PutValue for values and cell.Formula for formuls

@ILVO
Thank you for sharing your thought about the apis. We will investigate it soon. And we have opened the following new ticket(s) in our internal issue tracking system to trace the progress for you.

Issue ID(s): CELLSNET-53064

The issues you have found earlier (filed as CELLSNET-53064) have been fixed in this update. This message was posted using Bugs notification tool by johnson.shi