Hello,
I'm wondering the best way is to go about implementing a formula copy
utility for taking an existing cell formula and copying it to a new cell
while updating the references in the formula to match its new location.
I've had a trawl through the archives and found this post that seem
related to what I'm trying to do:
http://article.gmane.org/gmane.comp.jakarta.poi.user/3528/match=copying+formula
Summing it up there is a comment from Avik Sengupta explaining that you
need to use the FormulaParser class to generate the array of Ptg's and
inspect the ReferencePtg and modify the row & column attributes. This
sounds like a good approach but I hit a problem with the FormulaParser
class requiring a Workbook instance that is not publicly accessible from
the HSSFWorkbook object.
I found this post of someone else with the same issue:
http://article.gmane.org/gmane.comp.jakarta.poi.user/6552/match=hssfworkbook+can't+access+workbook
So after reading these two posts I'm left with the following two questions:
1) Has this functionality already been written and included in main POI
code (I looked in contrib but did not find anything). I suspect others
have implemented this functionality but that it hasn't been added to the
main POI code tree. If that is the case is there a reason why this code
could not be added to POI (other than just no one having the time)?
2) I'm happy to implement something myself but due to the package level
access issue of Workbook it will mean me having to use a non-standard
version of POI in my production code (not too enthusiastic about that).
So going back to question 1, if I write some code to do this will it be
able to be integrated into a future POI release or will it have to
remain outside?
If someone could clarify these points for me, or even tell me about how
they implemented this functionality I would be very greatful.
Regards,
Tim Wilkins
---------------------------------------------------------------------
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]