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