With the latest code, if you use usermodel, you will NOT get an exception for unsupported ptgs. You will get a #NAME? on getCellFormula(), which is also what excel will show you if you type "BITEME(A1:A2)". I think that is a better way than throwing exceptions to the user, checked or otherwise.
The fact that eventmodel is still throwing the exception is a bug that i intend to fix soon. thoughts? - Avik Quoting "Andrew C. Oliver" <[EMAIL PROTECTED]>: > Avik Sengupta wrote: > > >1. PTG stands for "Parse ThinG" !! It actually referes to the 1 byte token > type > >field in a token. We usually use it when referencing a particular token > >instance. > > > >2. The UnsopportedOperationException i thought is being caught in formula > >record, so should not be passed on to clients. You should just get a warning > > >message on screen, not an exception to catch. Which is what happens if u > read a > >file using the formula viewer or the biff viewer.. Strange .. does the > event > >api call Ptg.createPtg directly?? i'll check. > > > > > The unsupported operation exception should be a checked exception. Its > just like a file operation failing for > some reason. We should lazy parse the PTGs, only when the formula > information is asked for, that should be where > you must catch the checked exception. The high-level API should always > require you to catch it on an operation. > What if an invalid PTG got stored somehow, say file corruption? What is > a user passed "BITEME(A1:A2)"? This > is a predictable error. HSSF not handling a particular PTG is an > expectable situation, it WILL happen, you > (the client) SHOULD have code to handle it. > > The event API uses the low level records directly. > > >3. As for three values of token ids, see pgs 3.3.2-3.3.4 of the openoffice > xl > >doc. And you are right, it can be solved by adding that piece of code to > >Ptg.java. That is the proper way, since reserialising issues are handled > >already (believe me or read the code ;-) > > > >Thanks for helping us track all these better. > > > >Regards > >- > >Avik > > > > > > -Andy > > > > > > >Quoting "Hoffman, Jason" <[EMAIL PROTECTED]>: > > > > > > > >>As always, thank you to all the poi contributors, I appreciate your hard > >>work. > >> > >>Could someone explain what "Ptg" stands for? I have assumed the T is for > >>token, but what is the rest? > >> > >>I have downloaded and compiled the formula changes that were made this > >>afternoon by Avik. I now get the Unsupported...Exception ( as expected > >>from > >>looking at the latest code ) when processing one of my spreadsheets. The > >>Id > >>of the Ptg Token is "5a". The cell has the formula "='Sheet One'!A9", > and > >>the cell is located in "Sheet Two". From reading a recent bug report, I > >>understand that formula Sheet references is not yet supported, so my > >>question is this: > >> > >>From looking at the openOffice pdf file, the Token Id list in section > 3.5.5 > >>has 3 values for each Token Name. For example, in this case, it is a > >>"tRef3d", which has the values "3A", "5A", and "7A" listed. The current > >>code uses the sid "3A", whereas my spreadsheet with the above formula, > has > >>an id of "5A". Changing the sid and recompiling, correctly aleviates > THIS > >>exception. > >> > >>Can someone explain why there are 3 values for the Token Id's, and how/if > >>this is going to be addressed with the current 1 sid per class strucutre? > >>Obviously, if I change the value to "5A", then the "3A"s will never be > >>matched. > >> > >>I believe we might be able to identify this by placing multiple case > >>statements for each Ptg in Ptg.java. For Example: > >>case Ref3DPtg.sid: > >>case Ref3DPtg.sid+32: > >>case Ref3DPtg.sid+64: > >>... > >>break; > >> > >>I'm not sure this is the proper way, since the record will still only > have > >>one sid, which could cause problems when reserializing... > >> > >> > >>Jason Hoffman > >> > >> > >>-- > >>To unsubscribe, e-mail: <mailto:[EMAIL PROTECTED]> > >>For additional commands, e-mail: <mailto:[EMAIL PROTECTED]> > >> > >> > >> > >> > > > > > > > >-- > >To unsubscribe, e-mail: <mailto:[EMAIL PROTECTED]> > >For additional commands, e-mail: <mailto:[EMAIL PROTECTED]> > > > > > > > > > > > > -- > To unsubscribe, e-mail: <mailto:[EMAIL PROTECTED]> > For additional commands, e-mail: <mailto:[EMAIL PROTECTED]> > > -- To unsubscribe, e-mail: <mailto:[EMAIL PROTECTED]> For additional commands, e-mail: <mailto:[EMAIL PROTECTED]>
