Browse Source

REPORT-57251 修复设计器无法打开环境之外cptx的问题

fix-lag
loy 3 years ago
parent
commit
6c4cb1c89b
  1. 14
      designer-realize/src/main/java/com/fr/nx/app/designer/CptxApp.java

14
designer-realize/src/main/java/com/fr/nx/app/designer/CptxApp.java

@ -4,6 +4,7 @@ import com.fr.base.extension.FileExtension;
import com.fr.design.mainframe.AbstractAppProvider;
import com.fr.design.mainframe.JTemplate;
import com.fr.file.FILE;
import com.fr.log.FineLoggerFactory;
import com.fr.main.impl.WorkBook;
import com.fr.nx.cptx.utils.CptxFileUtils;
@ -35,16 +36,17 @@ public class CptxApp extends AbstractAppProvider<WorkBook> {
*/
@Override
public JTemplate<WorkBook, ?> openTemplate(FILE tplFile) {
WorkBook workBook = CptxFileUtils.getWorkBook(CptxFileUtils.getFormatPath(tplFile.getPath()));
if (workBook == null) {
workBook = new WorkBook();
}
return new JStreamBook(workBook, tplFile);
return new JStreamBook(asIOFile(tplFile), tplFile);
}
@Override
public WorkBook asIOFile(FILE file) {
WorkBook workBook = CptxFileUtils.getWorkBook(CptxFileUtils.getFormatPath(file.getPath()));
WorkBook workBook = null;
try {
workBook = CptxFileUtils.getWorkBook(file.asInputStream());
} catch (Exception e) {
FineLoggerFactory.getLogger().error(e.getMessage(), e);
}
if (workBook == null) {
workBook = new WorkBook();
}

Loading…
Cancel
Save