in my program first i have written a function to count sheets to be created according to the number of text files data to be inserted in the excel file then a function which counts rows in each text file and finally a function that counts number of columns by using StringTokenizer method countTokens then i have passed these values in the below method....but the code is not working properly as the number of sheets it creates is less than the number of text files and data in the sheets is not inserted appropriately
void store(int sheetnum, int rows, String filename, int columns) {
String datafile = filename;
FileReader fr = new FileReader(datafile);
BufferedReader in = new BufferedReader(fr);
String data = in.readLine();
for (int i = 0; i < sheetnum; i++) {
while (data != null) {
HSSFSheet sh = HSSFWorkbook.createSheet(i);
for (int j = 0; j < rows; j++) {
HSSFRow row = sh.createRow(j);
for (int k = 0; k < columns; k++) {
// createcell
// setcellvalue
}
data = in.readLine();
}
}
}
}