Seems to work. I wrote and ran this to test the idea
import java.io.*;
import org.apache.poi.xssf.usermodel.*;
public class ActiveCellTest {
public static void main(String[] args) {
File file = null;
FileOutputStream fos = null;
BufferedOutputStream bos = null;
XSSFWorkbook workbook = null;
XSSFSheet sheet = null;
XSSFRow row = null;
XSSFCell cell = null;
// Build a workbook with five sheets for testing
workbook = new XSSFWorkbook();
for(int i = 0; i < 5; i++) {
sheet = workbook.createSheet("Sheet Number " + i);
for(int j = 0; j < 30; j++) {
row = sheet.createRow(j);
for(int k = 0; k < 20; k++) {
cell = row.createCell(k);
cell.setCellValue("Row " + j + " Column " + k);
}
}
}
// Iterate through the sheets and make cell active
for(int i = 0; i < workbook.getNumberOfSheets(); i++) {
sheet = workbook.getSheetAt(i);
// Select diffeent cell in column A to show selection is working
sheet.setActiveCell("A" + (i + 1));
}
// Save book away - change path to suit on your system
try {
file = new
File("/home/markb/Public/java/testdocs/ActiveCellTest.xlsx");
fos = new FileOutputStream(file);
bos = new BufferedOutputStream(fos);
workbook.write(bos);
}
catch(IOException ioEx) {
System.out.println("Catch of saving book away and caught an " +
ioEx.getClass().getName());
System.out.println("Message " + ioEx.getMessage());
System.out.println("Stacktrace");
ioEx.printStackTrace(System.out);
}
finally {
try {
if(bos != null) {
bos.flush();
bos.close();
}
}
catch(IOException ioEx) {
System.out.println("Catch of finally clause and caught an " +
ioEx.getClass().getName());
System.out.println("Message " + ioEx.getMessage());
System.out.println("Stacktrace");
ioEx.printStackTrace(System.out);
}
}
}
}
and all you need to do is set the active cell for each sheet in the
workbook.
Hope this helps.
--
View this message in context:
http://apache-poi.1045710.n5.nabble.com/showInPane-does-not-work-tp5720321p5720353.html
Sent from the POI - User mailing list archive at Nabble.com.
---------------------------------------------------------------------
To unsubscribe, e-mail: [email protected]
For additional commands, e-mail: [email protected]