|
|
|
@ -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(); |
|
|
|
|
} |
|
|
|
|