2016-07-11 9 views
0

私はweb dynpro java 7.0を7.4に移行しました。私はExcelファイルをアップロードする際に問題があります。 jxl.read.biff.BiffException:OLEストリームを認識できませんSap Portal NetWeaver 7.4:jxl.read.biff.BiffException:OLEストリームを認識できません

「Excel用のWeb DyproをJava用にアップロードする」というドキュメントがありますが、まだエラーがあります。

(私はAAAA.xls(97-2003)を保存し、

file.getAbsolutePath/AAAA()=は/ usr/SAP/DEP/J00/J2EE /クラスタ/ server0をアップロードするには、オフィス2007を使用しています。ワークブックWB = Workbook.getWorkbook(新しいファイル( "C:Excelファイル(* .XLS)

コードを読み取るときにXLS)私は自分のデスクトップ上で、プロジェクトのJavaアプリケーションにjxl.jar使用してみました

、それは大丈夫です。 /Users/pcname/Desktop/AAAA.xls "));

しかし、ポータル上で、それは「OLEストリームを認識することができません」

を以下の例外をスローするコードは以下の通りです:

type of Va_Resource = com.sap.ide.webdynpro.uielementdefinitions.Resource 
    .... 
InputStream inpStr = null; 
int temp = 0; 
File file = new File(wdContext.currentContextElement() 
    .getVa_Resource().getResourceName().toString()); 

FileOutputStream opStr = new FileOutputStream(file); 

if(wdContext.currentContextElement().getVa_Resource()!=null){ 

    inpStr = wdContext.currentContextElement().getVa_Resource().read(false); 

    while((temp = inpStr.read())!= -1){ 
     opStr.write(temp); 
    } 
} 

opStr.flush(); 
opStr.close(); 
path = file.getAbsolutePath(); 
     if(path.substring(path.length()-3,path.length()).trim().equalsIgnoreCase("xls")) 
{ 
    //call method for upload 
    Execute_UploadOperation(); 
} 

..... 
public void Execute_UploadOperation{ 
    try{ 
     //path = /usr/sap/DEP/J00/j2ee/cluster/server0/AAAA.xls 
     Workbook wb = Workbook.getWorkbook(new File(path)); error this line, throw exception here 

.... 
    } 
    catch (BiffException e) { 
     e.getMessage() = jxl.read.biff.Biff Exception: Unable to recognize OLE stream 
    } 
} 

答えて

0

あなたのコーディングは、罰金のようです。
どのExcelバージョンをお使いですか? TheExcelApiは現在obsoleteで、Excelバージョンまでは2003年まで、2009年に更新されました。
MS Officeの後者のバージョンにはApache POIを使用してください。

関連する問題