poi-user mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From "Karr, David" <david.k...@wamu.net>
Subject Still struggling with "Coding Error: Expected ExpPtg to be converted from Shared to Non-Shared Formula"
Date Tue, 07 Aug 2007 00:07:17 GMT
A while ago I started to see cases where I would get the following

Coding Error: Expected ExpPtg to be converted from Shared to Non-Shared

I saw this when I tried to read cells from a "wide" spreadsheet.  I
don't see it when I only read from low-numbered columns, but I found a
threshold where it's ok on one column and fails on the next column (for
instance, if I only read up to column BR, it's fine, but it fails on BS

The error happens in this block in
"org.apache.poi.hssf.model.FormulaParser.toFormulaString(Workbook book,
Ptg[] ptgs)":

           // Excel allows to have AttrPtg at position 0 (such as
Blanks) which
           // do not have any operands. Skip them.

When this doesn't fail, when I look at the ptgs list, I see a bunch of
Ptg subclass instances, like RefVPtg (the 0th one), FuncPtg, AttrPtg,
and others.

When it fails, the only entry in the list is ExpPtg.  When this is here,
it's not surprising that I get this exception, as this is what it does:

    public String toFormulaString(Workbook book)
        throw new RecordFormatException("Coding Error: Expected ExpPtg
to be converted from Shared to Non-Shared Formula");

I did file a bug report for this quite a while ago, and I wrote again
about it in this list 3 months ago, but I've never heard anything from
the bug report or the note I wrote 3 months ago.  I would update the bug
report with a little more info that I've determined from looking at the
source (only what you see here), but I'm currently getting a 504 gateway
error trying to get to the bug db.

I tried searching through the source tree for references to the ExpPtg
class, since the error message makes me think something might be trying
to convert ExpPtg instances to something else.

The only thing I got from that search is the following:

* In org.apache.poi.hssf.dev.FormulaViewer.listFormula(FormulaRecord

            if (token instanceof ExpPtg) return;

* In org.apache.poi.hssf.usermodel.HSSFFormulaEvaluator, in the static

        OPERATION_EVALS_MAP.put(EqualPtg.class, EqualEval.class);
        //OPERATION_EVALS_MAP.put(ExpPtg.class, ExpEval.class); // TODO:
        // this
        OPERATION_EVALS_MAP.put(FuncPtg.class, FuncVarEval.class); //

In the past, when we've seen this, we've been able to segment the
spreadsheet into multiple worksheets, and process each one
indidividually.  This indicates that there's some issue with how Excel
stores its formula data for "wide" spreadsheets.  After a certain point,
it must store them differently.

To unsubscribe, e-mail: user-unsubscribe@poi.apache.org
For additional commands, e-mail: user-help@poi.apache.org

View raw message