user1531714
user1531714

Reputation: 111

How to set empty value to excel specific cell in delphi?

As title, there are some solution I had tried, but all of them didn't work.

XLApp.Application.cells[1, 1].Value := '';

XLApp.Application.cells[1, 1].Value := nil;

XLApp.Application.cells[1, 1].Value := EmptyParam;

Upvotes: 0

Views: 2063

Answers (1)

David Heffernan
David Heffernan

Reputation: 613053

The variant value that can be used to clear the contents of a cell is Unassigned.

Cells[1,1].Value := Unassigned;

Alternatively you can use the Clear method on a cell.

Cells[1,1].Clear;

Personally I find the latter to be more readable.

Upvotes: 4

Related Questions