The initial intent of the project was to create a very low level API for writing XLS.
Rather than creating very high level interfaces most contributors have been focused on extending coverage to more Office document formats. If you take a look the documentation that Microsoft now provides it is vast, this has only recently become available. Take a look at the number of POI committers, it is small. I don't think that any of us do it full-time, we all got involved because we wanted something in POI that was not there. Examples include writing PPT accurately at the drawing layer and supporting Formula evaluation directly from an Excel model. If you would like to discuss the API and where efforts are or will be please start a discussion on the POI-Dev list. All contributions are welcome. >> WorkBook wb >> WorkBook newwb >> HSSFSheet oldSheet = wb.getSheetAt(0) >> HSSFSheet newSheet = wb.createSheet("new sheet") >> >> loopping over some rows in oldSheet >> I want these five >> newSheet.setRows(oldSheet.getRows(8,12)) A better style might be: newSheet.copyExternalRows(oldSheet,8,12) and you would need to consider how to handle any formulas and formatting in those rows. For example, care must be taken to re-use style records as much as possible. HTH and encourage w/o time to delve deeply. Regards, Dave On Jul 20, 2010, at 9:49 AM, Roger wrote: > Oh of course. I was just surprised that in 5 years of dev it wasn't there yet > :) > > "Szostak, Jonathan" <jonathan.szos...@jackson.com> wrote: > >> The great part about this being open source is that you could add a >> getRows(int,int) function to the API, even if it's just for your own >> personal use. >> >> -----Original Message----- >> From: Roger Studner [mailto:rstud...@gmail.com] >> Sent: Tuesday, July 20, 2010 12:04 PM >> To: POI Users List >> Subject: Re: I'm sure this has been asked 1000x times >> >> Oh.. like..(pseudo code follows): >> >> WorkBook wb >> WorkBook newwb >> HSSFSheet oldSheet = wb.getSheetAt(0) >> HSSFSheet newSheet = wb.createSheet("new sheet") >> >> loopping over some rows in oldSheet >> I want these five >> newSheet.setRows(oldSheet.getRows(8,12)) >> >> I mena.. I know that is very high level.. but it.. "isnt" really.. given how >> great the API/product is in general >> >> Roger >> >> On Jul 20, 2010, at 11:41 AM, MSB wrote: >> >>> >>> Basically, yes you do, but is this not what copying is? Can you tell >>> me please, what were you expecting the api to do for you? >>> >>> Yours >>> >>> Mark B >>> >>> >>> OreoC wrote: >>>> >>>> So, in essence, no.. there is no means to *copy* anything. One >>>> simply recreates, fully, cell for cell, entire workbooks. >>>> >>>> amazing >>>> >>>> Roger >>>> >>>> >>>> >>>> >>>> On Jul 20, 2010, at 2:36 AM, MSB wrote: >>>> >>>>> >>>>> You will not be able to copy rows from one workbook to another but >>>>> you can copy cells. >>>>> >>>>> Setting aside the issue of styles for a moment - although even that >>>>> is fairly straightforward as there is a method available to clone a >>>>> style from another workbook and the only major hurdle that leaves is >>>>> preventing the creation of too many styles, so style pooling I guess >>>>> you could call it - all you will need to do is; >>>>> >>>>> Open the 'source' and 'destination' workbooks. >>>>> Get the sheet the data should be written to from the 'destination' >>>>> workbook. >>>>> Get a sheet from the 'source' workbook. >>>>> While there are rows to be processed on the source sheet. >>>>> Get a row from the source sheet. >>>>> While there are cells to be processed on that row. >>>>> Read a cell from the 'source' workbook. >>>>> Test it to see whether it meets your citeria. >>>>> If it does pass; >>>>> Get the type of the cell so that you can recover the value in >>>>> the appropriate format >>>>> Create a new cell in the 'destination' workbooks sheet. >>>>> Initialise the newly created cell. >>>>> >>>>> If your test is to see what the contents of the first cell in the >>>>> row are and then copy all of the cells in that row should it pass, >>>>> then there need only be a slight modification to the algorithm. >>>>> >>>>> That ought to do the trick for now, styles are something that you >>>>> could look into later when you have the copying part of the routine >>>>> working correctly. >>>>> >>>>> Yours >>>>> >>>>> Mark B >>>>> >>>>> >>>>> OreoC wrote: >>>>>> >>>>>> I'm trying to duplicate parts of a spreadsheet (the other option >>>>>> being to use creative shiftRows). >>>>>> >>>>>> Anyway.. i'd like to be able to copy rows, from one spreadsheet to >>>>>> another. >>>>>> I realize workbook/worksheet styles are a particular issue >>>>>> >>>>>> THat being said.. I can't seem to, even using groovy/violating the >>>>>> protected methods (get/set row record) find any way to do this >>>>>> >>>>>> Is there any easy method, than literally a cell by cell >>>>>> introspection/recreation? >>>>>> >>>>>> essentially 'im juust trying to include rows that pass a boolean >>>>>> operation.. seemingly trivial stuff >>>>>> >>>>>> Thanks, >>>>>> Roger >>>>>> >>>>>> >>>>>> ------------------------------------------------------------------- >>>>>> -- To unsubscribe, e-mail: user-unsubscr...@poi.apache.org For >>>>>> additional commands, e-mail: user-h...@poi.apache.org >>>>>> >>>>>> >>>>>> >>>>> >>>>> -- >>>>> View this message in context: >>>>> http://old.nabble.com/I%27m-sure-this-has-been-asked-1000x-times-tp2 >>>>> 9210376p29211837.html Sent from the POI - User mailing list archive >>>>> at Nabble.com. >>>>> >>>>> >>>>> -------------------------------------------------------------------- >>>>> - To unsubscribe, e-mail: user-unsubscr...@poi.apache.org For >>>>> additional commands, e-mail: user-h...@poi.apache.org >>>>> >>>> >>>> >>>> --------------------------------------------------------------------- >>>> To unsubscribe, e-mail: user-unsubscr...@poi.apache.org For >>>> additional commands, e-mail: user-h...@poi.apache.org >>>> >>>> >>>> >>> >>> -- >>> View this message in context: >>> http://old.nabble.com/I%27m-sure-this-has-been-asked-1000x-times-tp292 >>> 10376p29215927.html Sent from the POI - User mailing list archive at >>> Nabble.com. >>> >>> >>> --------------------------------------------------------------------- >>> To unsubscribe, e-mail: user-unsubscr...@poi.apache.org For additional >>> commands, e-mail: user-h...@poi.apache.org >>> >> >> >> --------------------------------------------------------------------- >> To unsubscribe, e-mail: user-unsubscr...@poi.apache.org For additional >> commands, e-mail: user-h...@poi.apache.org >> >> >> --------------------------------------------------------------------- >> To unsubscribe, e-mail: user-unsubscr...@poi.apache.org >> For additional commands, e-mail: user-h...@poi.apache.org >> > > -- > Sent from my Android phone with K-9 Mail. Please excuse my brevity. > > --------------------------------------------------------------------- > To unsubscribe, e-mail: user-unsubscr...@poi.apache.org > For additional commands, e-mail: user-h...@poi.apache.org > --------------------------------------------------------------------- To unsubscribe, e-mail: user-unsubscr...@poi.apache.org For additional commands, e-mail: user-h...@poi.apache.org