Your idea makes sense to me, but there can be good reasons why these have not been exposed. Memory consumption is extreme and keeping one of these references could cause huge memory leaks.

You should ask questions about contributions on the developer list. I have forwarded your request onto that list.

You should develop using the latest svn. We are considering a 3.5 release about the beginning of February although that is not certain. We hope to fix a lot of bugs by then.

Regards,
Dave

On Dec 16, 2008, at 9:32 AM, Robins, Joe wrote:

Following up to myself, since there hasn't been any response here, now with a slightly different question: If I wanted to submit a change to add these methods, is there any reason why anyone might object? This strikes me as an exceedingly useful thing to have, and very simple to do. But if there's some philosophical objection that will cause this to be rejected, then I wouldn't want to put time into working on it.

Joe Robins
Director, Systems & Software Development
Teach For America
Email: [email protected]
Phone: 212-279-2080, x368
One day, all children in this nation will have the opportunity to attain an excellent education.
http://www.teachforamerica.org/


-----Original Message-----
From: Robins, Joe [mailto:[email protected]]
Sent: Monday, December 08, 2008 3:28 PM
To: [email protected]
Subject: Getting book from sheet, sheet from row, etc.

Hi,

I've tried to find this answer in the docs, looking through the archives, etc., but I can't find it anywhere. I'm hoping someone here can help me out.

Is there a reason that there are not methods on HSSFSheet, HSSFRow, etc., to get the parent object? A quick look through the code reveals that they are storing those references. If I have:

 HSSFWorkbook wb = <create my workbook here>
 HSSFSheet sheet = wb.createSheet();
 HSSFRow row = sheet.createRow(0);

It would seem that I should be able to do:
 row.getSheet();
 sheet.getWorkbook();

As I mentioned, they are storing these references in private member variables. Is there some reason they are not exposed through getters?

Here is the use case that I am trying to accomplish. I have a method foo that takes as arguments an HSSFRow, a column number, and an Object, does some stuff, and writes the object to the specified cell:

public void foo(HSSFRow row, int col, Object data);

Now the problem is that I need to do some formatting depending on the type of data. If it's a number, for example, I set the cell type to NUMERIC. But if it's a Date, I want to create a cell style for the date to format it appropriately. However, I can only create a data format and a cell style off the workbook, not off the row or the cell, and I can't get a reference to the workbook at this point.

So is there some reason I can't work my way back up the chain to get the workbook? And is there any other way to accomplish this, short of creating the style in the calling method and passing it in?

Thank you,

Joe Robins
Director, Systems & Software Development
Teach For America
Email: [email protected]
Phone: 212-279-2080, x368
One day, all children in this nation will have the opportunity to attain an excellent education.
http://www.teachforamerica.org/



____________________________________________
This communication and any file transmitted with it may contain information that is confidential, privileged and exempt from disclosure under applicable law. It is intended solely for the use of the individual or entity to which it is addressed. If you are not the intended recipient, you are hereby notified that any use, dissemination or copying of this communication is strictly prohibited. If you have received this communication in error, please notify the sender. Thank you for your cooperation.

____________________________________________
This communication and any file transmitted with it may contain information that is confidential, privileged and exempt from disclosure under applicable law. It is intended solely for the use of the individual or entity to which it is addressed. If you are not the intended recipient, you are hereby notified that any use, dissemination or copying of this communication is strictly prohibited. If you have received this communication in error, please notify the sender. Thank you for your cooperation.

---------------------------------------------------------------------
To unsubscribe, e-mail: [email protected]
For additional commands, e-mail: [email protected]



---------------------------------------------------------------------
To unsubscribe, e-mail: [email protected]
For additional commands, e-mail: [email protected]

Reply via email to