Tag: javafx 2

如何迭代来自Tableview的数据将其导出到Microsoft Excel?

我需要帮助从表视图迭代数据将其导出到Excel中,每当我按下button,它只是从我的Excel表中显示表视图的第一行数据。 我希望你能得到这是我的代码 package application; import java.io.File; import java.io.FileNotFoundException; import java.io.FileOutputStream; import java.io.IOException; import java.net.URL; import java.util.ArrayList; import java.util.List; import java.util.ResourceBundle; import org.apache.poi.hssf.usermodel.HSSFCell; import org.apache.poi.hssf.usermodel.HSSFRow; import org.apache.poi.hssf.usermodel.HSSFSheet; import org.apache.poi.hssf.usermodel.HSSFWorkbook; import org.apache.poi.ss.usermodel.RichTextString; import javafx.beans.property.SimpleStringProperty; import javafx.collections.FXCollections; import javafx.collections.ObservableList; import javafx.event.ActionEvent; import javafx.fxml.FXML; import javafx.fxml.Initializable; import javafx.scene.control.Button; import javafx.scene.control.ComboBox; import javafx.scene.control.DatePicker; import javafx.scene.control.TableColumn; import javafx.scene.control.TableView; import javafx.scene.control.TextArea; import […]

JavaException:(进程无法访问该文件,因为该文件被另一个进程使用)

在JavaFx中。 我试图导出表 – 查看内容使用Apache POI excel。所以,当我第一次点击button导出每一件事情都很好,并导出tableView的内容,当我想打开导出的文件.xls使用excel并尝试再次单击程序调用此exception: Caused by: java.io.FileNotFoundException: example.xls ( (The process can not access the file because this file is used by another process)) at java.io.FileOutputStream.open0(Native Method) at java.io.FileOutputStream.open(FileOutputStream.java:270) at java.io.FileOutputStream.<init>(FileOutputStream.java:213) at java.io.FileOutputStream.<init>(FileOutputStream.java:162) at hmproject.MenuController.Print(MenuController.java:7985) … 66 more 。 这是我的代码: public void Print() throws JRException ,IOException,FileNotFoundException{ HSSFWorkbook workbook = new HSSFWorkbook(); HSSFSheet spreadsheet […]