How to clear a TWebXLSX

I have a TWebXLSX on my form. I use it to save various data as XLSX and have the need to clear the content before reusing the TWebXLSX.

I looked for a method TWebXLSX.clear but failed.

How can I clear the content of a TWebXLSX?

tx Bernd

Hi,

It looks like the library itself doesn't come with a method to clear the contents.
Are you looking for something that removes all the sheets?
Or should it keep the sheets and remove the data only?

I want to "reset" the component. Clearing data, of course, but if I added sheets, they must be removed, too.

Workaround: Free/Create, I suppose?

That is one workaround, but you could also remove all sheets manually:

procedure TForm1.WebButton2Click(Sender: TObject);
var
  I: Integer;
begin
  for I := WebXLSX1.SheetNameCount - 1 downto 0 do
    WebXLSX1.RemoveSheet(WebXLSX1.SheetNames[I]);
end;

We can put this behind a RemoveAllSheets method for the next version.