× The internal search function is temporarily non-functional. The current search engine is no longer viable and we are researching alternatives.
As a stop gap measure, we are using Google's custom search engine service.
If you know of an easy to use, open source, search engine ... please contact support@midrange.com.



Since the rows and cells within the spreadsheet are zero-based,
inserting new cells "in front" of existing cells would seem to require
that the existing cells be copied to the right and renumbered.

There is a cloneSheet method available in the HSSFWorkbook class. I
don't believe Scott Klement provided that prototype in his HSSF_H header
file, but it is a very simple method.

D HSSFWorkbook_cloneSheet...
D PR like(HSSFSheet)

D EXTPROC(*JAVA

D :'org.apache.poi.hssf.usermodel-

D .HSSFWorkbook'

D :'cloneSheet')
D sheetnum like(jint)

These is a getLastCellNum method in the HSSFRow class. You could walk
the rows, get the last cell used in the row, walk the cells back from
the last to the first in the row and shift the existing cells over the 3
cells you need to insert. Then set up those first three cells the way
you need them for the start of the new year.

Just some quick thoughts.

-----
Scott A. Schollenberger
Director, R&D
Schools Division

2011 Renaissance Blvd., Suite 100
King of Prussia, PA 19406
Phone: 610-239-9988 x305
Fax: 610-239-9995
Email: sschollenberger@xxxxxxxxxxxxxxxxxx

-----Original Message-----
From: rpg400-l-bounces@xxxxxxxxxxxx
[mailto:rpg400-l-bounces@xxxxxxxxxxxx] On Behalf Of DLee@xxxxxxxx
Sent: Wednesday, April 25, 2007 4:41 PM
To: rpg400-l@xxxxxxxxxxxx
Subject: POI excel - copy/Inserting cells

Afternoon all.

I have a problem I'm trying to workout with POI excel sheets

My users have some worksheets where I am updating certain cells each
quarter, and this is working fine, and they love it.

Currently at the beginning of a new year, the user manually inserts a
set of 3 new cells at the beginning of the existing sheet for each row
in the sheet, which will be where the new years data will be stored.
They manually do this to about 100 workbooks

What I want to do is generate those 3 new cells by copying and inserting
the previous years 3 cells and formulas and cell styles to the new
location.
This will save the users from doing it themselves, and messing up the
formulas and cell styles, and causing me problems down the way.

I know how to create new sheets and rows, and update cells in sheets,
but how to copy/insert cells is a mystery.

I didn't see anything in Scott's work, that I could use, but maybe I'm
missing something. I also looked thru the UserModel source for some
hint about how to do this but nothing rang a bell for me.

Appreciate any help.

Darrell Lee
Information Technology
Extension 7127
--
This is the RPG programming on the AS400 / iSeries (RPG400-L) mailing
list To post a message email: RPG400-L@xxxxxxxxxxxx To subscribe,
unsubscribe, or change list options,
visit: http://lists.midrange.com/mailman/listinfo/rpg400-l
or email: RPG400-L-request@xxxxxxxxxxxx
Before posting, please take a moment to review the archives at
http://archive.midrange.com/rpg400-l.



As an Amazon Associate we earn from qualifying purchases.

This thread ...

Follow-Ups:
Replies:

Follow On AppleNews
Return to Archive home page | Return to MIDRANGE.COM home page

This mailing list archive is Copyright 1997-2024 by midrange.com and David Gibbs as a compilation work. Use of the archive is restricted to research of a business or technical nature. Any other uses are prohibited. Full details are available on our policy page. If you have questions about this, please contact [javascript protected email address].

Operating expenses for this site are earned using the Amazon Associate program and Google Adsense.