1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53
|
for(int i=0;i<table.getColumnCount();i++)
{
for(int j=0;j<table.getRowCount();j++){
if(i==0 )
{
SimpleDateFormat formatter = new SimpleDateFormat("dd/MM/yyyy");
java.util.Date date =( java.util.Date )(formatter.parse(table.getValueAt(j, 0).toString()));
CellFormat cf = new WritableCellFormat (DateFormats.FORMAT1);
DateTime dateCell = new DateTime(0, j+1, date,cf);
s.addCell(dateCell);
} else if(i==1)
{
//c'est la ou je coince :p
final DateFormat valueFormatDate = new DateFormat( "HH:mm" );
valueFormatDate.getDateFormat().setTimeZone( TimeZone.getTimeZone( "GMT" ) );
final WritableCellFormat formatDate = new WritableCellFormat( valueFormatDate );
SimpleDateFormat formatter = new SimpleDateFormat("HH:mm");
DateTime dt=new DateTime( 1, j+1,( java.util.Date )(formatter.parse(table.getValueAt(j, 1).toString())) ,formatDate, DateTime.GMT );
s.addCell(dt);
}
else if(i==2)
{
final DateFormat valueFormatDate = new DateFormat( "HH:mm" );
valueFormatDate.getDateFormat().setTimeZone( TimeZone.getTimeZone( "GMT" ) );
final WritableCellFormat formatDate = new WritableCellFormat( valueFormatDate );
SimpleDateFormat formatter = new SimpleDateFormat("HH:mm");
DateTime dt=new DateTime( 2, j+1,( java.util.Date )(formatter.parse(table.getValueAt(j, 2).toString())) , formatDate, DateTime.GMT );
s.addCell(dt);
}
else if(i==3 ||( i>=5 && i<=8 ))
{
Object object=table.getValueAt(j, i);
s.addCell(new Number(i,j+1,Double.parseDouble(String.valueOf(object))));
} else
{
Object object=table.getValueAt(j, i);
s.addCell(new Label(i,j+1,String.valueOf(object)));
} |
Partager