I have created the below sample using apache poi
using the following code
import org.apache.poi.ss.usermodel.Cell;
import org.apache.poi.ss.usermodel.Row;
import org.apache.poi.ss.usermodel.Sheet;
import org.apache.poi.ss.usermodel.Workbook;
import org.apache.poi.xssf.usermodel.XSSFWorkbook;
import java.io.File;
import java.io.FileOutputStream;
import java.io.IOException;
public class Main {
public static final String file = "C:\\Users\\Deepak\\IdeaProjects\\Test\\src\\main\\resources\\test.xlsx";
public static void main(String[] args) throws IOException {
Workbook workbook = new XSSFWorkbook();
Sheet sheet = workbook.createSheet("sheet1");
for(int row = 0;row < 10;row++) {
Row rowI = sheet.createRow(row);
Cell cell = rowI.createCell(0);
cell.setCellValue("cell"+row+'0');
}
sheet.groupRow(1, 5);
sheet.setRowGroupCollapsed(1, true);
sheet.protectSheet("dummy");
workbook.write(new FileOutputStream(new File(file)));
}
}
The sheet is locked but the collapse(+) feature is also locked. I don't want the collapse button to be locked. Is there a way to solve this problem?
I googled this but didn't find anything for apache POI. I found a solution for VBA here and tried to find a similar method (enableOutlining) in apache poi but didn't find any.
I am using Apache POI 3.9
Any help/guidance will be appreciated
