簡體   English   中英

Apache POI CellReference 是否能夠處理同一公式中的多個其他標簽頁?

[英]Is Apache POI CellReference able to handle multiple another tab sheets in the same formula?

我有一個引用多個工作表的單元格公式('1 - Sheet':$P,$P:'1 - Sheet',$E:$E,'Another Calc'!$A10)當我嘗試實例化一個新的 CellReference object 使用我的公式,Apache POI 從 CellReference 中的parseSheetName方法中拋出錯誤Bad sheet name quote escaping。 發生這種情況是因為公式有多個引號並且方法沒有正確處理這個問題。 CellReference 是否有另一種方法可以處理它或某種變通方法來強制 CellReference 適當處理?

我已經做了一些研究,但我發現的所有場景總是只在公式中引用另一個工作表,在這種情況下,Apache POI 工作正常。

Alex Richter評論向我表明問題在於如何將公式傳遞給CellReference構造函數。 我需要更改它,Apache POI 將正常工作。

CellReference是對一個單元格的引用,因此這應該有效:

var cellReference = new
    org.apache.poi.ss.util.CellReference(
        "'Another Calc'!$A10");

或者,有AreaReference來引用單元格范圍,所以這也應該有效:

var areaReference = new
    org.apache.poi.ss.util.AreaReference(
        "'1 - Sheet'!$P:$P", org.apache.poi.ss
            .SpreadsheetVersion.EXCEL2007);

暫無
暫無

聲明:本站的技術帖子網頁,遵循CC BY-SA 4.0協議,如果您需要轉載,請注明本站網址或者原文地址。任何問題請咨詢:yoyou2525@163.com.

 
粵ICP備18138465號  © 2020-2024 STACKOOM.COM