package org.xbib.datastructures.xslx;

import org.junit.jupiter.api.Disabled;
import org.junit.jupiter.api.Test;

import java.io.OutputStream;
import java.nio.file.Files;
import java.nio.file.Path;
import java.nio.file.Paths;

public class SimpleWriterTest {

    @Disabled("we need an existing test.xslx file")
    @Test
    public void testXLSXWrite() throws Exception {
        Path path = Paths.get("test.xlsx");
        SimpleXLSXWorkbook workbook = new SimpleXLSXWorkbook();
        Sheet sheet = workbook.getSheet(0);
        int columnCount = 5;
        int rowCount = 10;
        int offset = 0;
        for (int r = offset; r < offset + rowCount; r++) {
            for (int c = 0; c < columnCount; c++) {
                sheet.modify(r, c, "Text " + r + "," + c, null);
            }
        }
        OutputStream outputStream = Files.newOutputStream(path);
        workbook.commit(outputStream);
    }
}
