How to save spreadsheet to xlsx file

The interface IFileWriter is used to save the current workbook as a file in a supported format.

To get IFileWriter, call getWriter() from IWorkbook:

import com.intechcore.scomponents.scell.api.init.ScellApiEntryPoint;
import com.intechcore.scomponents.scell.api.spreadsheet.IScellCoreApiFactory;
import com.intechcore.scomponents.scell.api.spreadsheet.model.IWorkbook;
import com.intechcore.scomponents.scell.api.spreadsheet.service.IFileWriter;

import java.io.File;

public class TestApp {
    public static void main(String[] args) {
        ScellApiEntryPoint.getApiResolverAsync().thenAccept(resolver -> {
            IScellCoreApiFactory apiFactory = resolver.resolve(IScellCoreApiFactory.class);

            IWorkbook existingWorkbook = apiFactory.load(new File("/path/to/existing/file.xlsx"));
            IFileWriter fileWriter = existingWorkbook.getWriter();

            fileWriter
                    .fileName("spreadsheet-copy.xlsx", true)  // set a new name
                    .save();
        }).whenComplete((unused, throwable) -> {
            if (throwable != null) {
                System.out.println(throwable.getMessage());
            }
        }).join();
    }

}

To IWorkbook