Skip to content

Instantly share code, notes, and snippets.

@khous
Created March 6, 2016 05:17
Show Gist options
  • Save khous/ea503a9b61b6989f7d72 to your computer and use it in GitHub Desktop.
Save khous/ea503a9b61b6989f7d72 to your computer and use it in GitHub Desktop.
private void loadTable(Spreadsheet sheet) {
String fileName = "text.txt";
try {
Scanner scanner = new Scanner(new File(fileName));
int row = 0;
int column = 0;
while (scanner.hasNext()) {
String str = scanner.next();
System.out.print(str);
if(column == 26) {
column = 0;
row ++;
System.out.println();
}
Cell cell = sheet.getCell(row, column);
cell.setFormula(str, sheet);
table.setValueAt(cell.getFormula(), row, column);
column++;
}
repaint();
}
catch (FileNotFoundException e) {
e.printStackTrace();
}
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment