Use IRangeAddressBuilder to build IRangeAddress.


  • buildCell() - build address of single cell;
  • buildRange() - build address. Return single cell or range address depends on range size.
import com.intechcore.scomponents.scell.api.spreadsheet.model.address.IRangeAddress;

import java.util.Optional;

public class ConsoleApp {
    private static final CompletableFuture<Optional<IScellApiResolver>> apiResolverFuture = ScellApiProvider.getApiResolverAsync();

    public static void main(String[] args) {
        apiResolverFuture.thenAccept(apiResolverOpt -> apiResolverOpt.ifPresent(apiResolver -> {

            IRangeAddressBuilder addressBuilder = apiResolver.resolve(IRangeAddressBuilder.class);

            IRangeAddress defaultAddress1 = addressBuilder.buildCell();
            IRangeAddress defaultAddress2 = addressBuilder.buildRange(); // both calls with default builder values will build single cell address A1

            IRangeAddressBuilder customBuilder = addressBuilder
                    .from(defaultAddress2)                               // taking existing address as source
                    .setBottomRight(3, 2);                               // setting bottom right corner of future range

            IRangeAddress customAddress1 = customBuilder.buildRange();   // will get address of cells range A1:B3
            IRangeAddress customAddress2 = customBuilder.buildCell();    // will get address of single cell A1

            IRangeAddress customAddress3 = addressBuilder
                    .buildRange();                                       // will get range A1:A4

            Optional<IRangeAddressBuilder> parsedAddressBuilder = addressBuilder
                    .fromA1String("A1");                                 // parse cell address from string. Not empty if string represents correct address
            Optional<IRangeAddressBuilder> parsedRangeBuilder = addressBuilder
                    .fromA1String("A1:B5");                               // parse cells range from string. Not empty if string represents correct range

See also