首页 > 解决方案 > 使用 Anylogic 在 excel 中保存信息时出现 XmlValueDisconnectedException

问题描述

我正在尝试用我的 java 代码覆盖一个 excel 文件:

List <Tuple> copy = 
    selectFrom(delivery_plan).
    list();
int row = 2;
int lastrow2 = main.DeliveredData.getLastRowNum(2);
for(int row2=2; row2<= lastrow2; row2++){
    main.DeliveredData.clearCell(2,row2,1);
    main.DeliveredData.clearCell(2,row2,2);
    main.DeliveredData.clearCell(2,row2,3);
    main.DeliveredData.clearCell(2,row2,4);
    main.DeliveredData.clearCell(2,row2,5);
    main.DeliveredData.clearCell(2,row2,6);

};
//iterating through all entries and saving into our excel sheet
for(Tuple tup : copy){
    main.DeliveredData.setCellValue(tup.get(delivery_plan.data),2,row,1);
    main.DeliveredData.setCellValue(tup.get(delivery_plan.product),2,row,2);
    main.DeliveredData.setCellValue(tup.get(delivery_plan.original_committed_qty),2,row,3);
    main.DeliveredData.setCellValue(tup.get(delivery_plan.updated_committe),2,row,4);
    main.DeliveredData.setCellValue(tup.get(delivery_plan.min_qty),2,row,5);
    main.DeliveredData.setCellValue(tup.get(delivery_plan.max_qty),2,row,6);
    row ++;
};

main.DeliveredData.writeFile();

但是,当我的代码执行时,我收到以下错误消息:

org.apache.xmlbeans.impl.values.XmlValueDisconnectedException java.lang.RuntimeException: org.apache.xmlbeans.impl.values.XmlValueDisconnectedException

我该如何解决这个问题?

标签: anylogic

解决方案


推荐阅读