diff --git a/designer-base/src/main/java/com/fr/nx/app/designer/utils/CptAndCptxCompatibilityUtil.java b/designer-base/src/main/java/com/fr/nx/app/designer/utils/CptAndCptxCompatibilityUtil.java index 2e08a8ae9..0b1a65657 100644 --- a/designer-base/src/main/java/com/fr/nx/app/designer/utils/CptAndCptxCompatibilityUtil.java +++ b/designer-base/src/main/java/com/fr/nx/app/designer/utils/CptAndCptxCompatibilityUtil.java @@ -23,7 +23,7 @@ public class CptAndCptxCompatibilityUtil { String path = editingFILE.getPath(); //只有在旧文件是cptx文件并且新文件是cpt文件时才会改变报表引擎属性 boolean isCptxConvertToCpt = FileExtension.CPTX.matchExtension(oldName) && FileExtension.CPT.matchExtension(path); - if (isCptxConvertToCpt && !changeFrEngineAttr(jTemplate)){ + if (isCptxConvertToCpt && !setFrEngineAttr(jTemplate)){ isCptxConvertToCpt = false; } return (isCptxConvertToCpt || isSaveAs(jTemplate, oldName, path)); @@ -39,7 +39,7 @@ public class CptAndCptxCompatibilityUtil { /** * cptx另存为cpt需要修改报表引擎属性 **/ - private static boolean changeFrEngineAttr(JTemplate jTemplate){ + private static boolean setFrEngineAttr(JTemplate jTemplate){ WorkSheet workSheet = gainWorkSheet(jTemplate.getTarget()); if (workSheet == null){ return false; diff --git a/designer-base/src/main/java/com/fr/nx/app/designer/utils/CptCompileUtil.java b/designer-base/src/main/java/com/fr/nx/app/designer/utils/CptCompileUtil.java index cb414589c..36c184670 100644 --- a/designer-base/src/main/java/com/fr/nx/app/designer/utils/CptCompileUtil.java +++ b/designer-base/src/main/java/com/fr/nx/app/designer/utils/CptCompileUtil.java @@ -1,5 +1,6 @@ package com.fr.nx.app.designer.utils; +import com.fr.base.extension.FileExtension; import com.fr.design.mainframe.JTemplate; import com.fr.file.FILE; import com.fr.file.FileNodeFILE; @@ -34,16 +35,18 @@ public class CptCompileUtil { } FILE file = jtemplate.getEditingFILE(); String path = file.getPath(); - WorkBook workbook = (WorkBook) jtemplate.getTarget(); + Object target = jtemplate.getTarget(); /* * 如果是cpt并且引擎设置正确,执行预编译,如果是cptx文件也执行预编译。在JStreamWork中,保存和另存为流程都进行了重新编译。 * 但是由于之前的DefaultTemplateResource.saveTemplate的原因导致JStreamWork::saveFile()不能执行--cptx的保存不能进行预编译, * 应该是流程的误改动,这里改回来,保存时仍然执行预编译。 * 预编译本不应该受引擎模式的影响,但是cpt文件在设置为新引擎后是需要进行编译的 * */ - if (!CptAndCptxCompatibilityUtil.isEngineXEnable(workbook, path)){ + + if (!CptAndCptxCompatibilityUtil.isEngineXEnable(target, path)){ return; } + WorkBook workbook = (WorkBook) jtemplate.getTarget(); TransformResultInfo resultInfo = compile0(workbook, file); unSupportLog(resultInfo); @@ -143,4 +146,8 @@ public class CptCompileUtil { FineLoggerFactory.getLogger().error(transformResultInfo.getTransformLog()); } } + + private static boolean isUnSupportFileType(String path){ + return FileExtension.CPT.matchExtension(path) || FileExtension.CPTX.matchExtension(path); + } }