Set Text field from ObservableList [JavaFX]

luca120 <[email protected]>
Newsgroups gmane.comp.jakarta.poi.user
Message-ID <[email protected]>
Hello to all,

i'm tryng to generate one excel file from ObservableList by adding one
column like Text because without this paramiter in this specific column I
can loose some informations.


field MainTableGlobalWip  is -->   @FXML private
TableView<ListTableGlobalWip> MainTableGlobalWip;
field ListTableGlobalWip is ---> @FXML private
ObservableList<ListTableGlobalWip> data ;

below is possible to see the code which I'm using to generate the excel file
by using Apache POI 4.1

XSSFWorkbook workbook = new XSSFWorkbook();
	XSSFCellStyle textFormatStyle = workbook.createCellStyle();
	XSSFSheet masterDataSheet= workbook.createSheet("Master_Data");
	XSSFRow firstRow= masterDataSheet.createRow(0);	
	XSSFRow row  = null;
	//XSSFCell cell =row.createCell(0);
	public void ExportXlsx(ActionEvent actionEvent) throws IOException  {
		//prelevo le intestazioni delle colonne
		for (int i=0; i<MainTableGlobalWip.getColumns().size();i++) {
	           
firstRow.createCell(i).setCellValue(MainTableGlobalWip.getColumns().get(i).getText());
	            
	    }
		//inizio a prelevare i vari record dalla tabella e li trasferisco
all'interno del file EXEL
		for(int row=0; row&lt;MainTableGlobalWip.getItems().size();row++){
	    	 XSSFRow xssfRow= masterDataSheet.createRow(row+1);
	    	 for (int col=0; col&lt;MainTableGlobalWip.getColumns().size();
col++){
	    		 Object celValue =
MainTableGlobalWip.getColumns().get(col).getCellObservableValue(row).getValue();
	    		 
	    		 try {
	    			 if (celValue != null &amp;&amp;
Double.parseDouble(celValue.toString()) != 0.0) {
	    				
xssfRow.createCell(col).setCellValue(Double.parseDouble(celValue.toString()));
	                 }
	             }catch(NumberFormatException e){
	            	 xssfRow.createCell(col).setCellValue(celValue.toString());
	             }
	         }
	      }
	    workbook.write(new
FileOutputStream(&quot;C:\\Users\\lroscio\\Desktop\\Wip_&quot;+timeStamp+&quot;.xlsx&quot;));
	 }&lt;/h2>

someone could help me to put the column 16 like text for don't loos the
informations?





--
Sent from: http://apache-poi.1045710.n5.nabble.com/POI-User-f2280730.html
lmpx.com only provides a reader for public news (NNTP) servers. It is not affiliated with the servers or forums shown here and is not responsible for the content of articles, which is written by their respective authors.