如何从.ods文件在JTable中查看工作表?我使用odftoolkit,这就是我打开文件的方式
String filepath;
if (openfile.showOpenDialog(null) == JFileChooser.APPROVE_OPTION) {
filepath = openfile.getSelectedFile().getAbsolutePath();
try {
doc = SpreadsheetDocument.loadDocument(filepath);
} catch (Exception e) {
JOptionPane.showMessageDialog(null,
Locale.getString("fileError.message"),
Locale.getString("fileError.title"),
JOptionPane.ERROR_MESSAGE);
return;
}此时,我得到了doc.getTableList().get(0).getRowList()的每一行。如何将每一行转换为数组?
发布于 2013-08-05 20:47:27
如何将每一行转换为数组?
不要。相反,构建一个实现基本方法的TableModel,如这里所示,使用ODF API接口提供的方法。
@Override
public String getColumnName(int col) {…}
@Override
public int getColumnCount() {…}
@Override
public int getRowCount() {…}
@Override
public Object getValueAt(int row, int col) {…}https://stackoverflow.com/questions/18066540
复制相似问题