/*
 * To change this license header, choose License Headers in Project Properties.
 * To change this template file, choose Tools | Templates
 * and open the template in the editor.
 */
package clases;

import java.io.File;
import java.io.IOException;
import javax.swing.table.DefaultTableModel;
import javax.swing.table.TableModel;
import org.jopendocument.dom.OOUtils;
import org.jopendocument.dom.spreadsheet.Sheet;
import org.jopendocument.dom.spreadsheet.SpreadSheet;


public class Guardar_tabla {
 
    
public void crearods() throws IOException{
    

final Object[][] data = new Object[6][2];

  data[0] = new Object[] { "Abril", 1 };
  data[1] = new Object[] { "Marzo", 2 };
  data[2] = new Object[] { "Junio", 8 };
  data[3] = new Object[] { "April", 10 };
  data[4] = new Object[] { "May", 15 };
  data[5] = new Object[] { "June", 18 };

final Object[][] data2 = new Object[6][2];

  data2[0] = new Object[] { "Hola", 1 };
  data2[1] = new Object[] { "segunda hoja", 2 };
  data2[2] = new Object[] { "Junio", 8 };
  data2[3] = new Object[] { "April", 10 };
  data2[4] = new Object[] { "May", 15 };
  data2[5] = new Object[] { "June", 18 };

  String[] columns = new String[] { "Month", "Temp" };

  TableModel model = new DefaultTableModel(data, columns);  
  TableModel model2 = new DefaultTableModel(data2, columns);  
    
  // Save the data to an ODS file and open it.
  final File file = new File("temperature.ods");
  SpreadSheet.createEmpty(model).saveAs(file);


    
  OOUtils.open(file);  
  
    System.out.println("ods creado :)");
   } 
}
