|
I'm not sure how you'd do that in RPG. In Java, you check: InputStream myxls = null; HSSFWorkbook wb = null; HSSFSheet sheet = null; HSSFRow row = null; HSSFCell cell = null; String fileName = "my.xls"; myxls = new FileInputStream(fileName); wb = new HSSFWorkbook(myxls); sheet = wb.getSheetAt(0); myxls = new FileInputStream(fileName); row = sheet.getRow(0); boolean validFormat = true; cell = row.getCell((short) 0); if ((cell == null) || !cell.getStringCellValue().equalsIgnoreCase("Author/s")) { validFormat = false; } This code (the last 5 lines) checks to make sure the first cell in the first row contains the text "Author/s". Matt -----Original Message----- From: Peter Dow [mailto:maillist@xxxxxxxxxxxxxxx] Sent: Monday, December 06, 2004 12:21 PM To: RPG programming on the AS400 / iSeries Subject: Re: Using Java in RPGLE - cell comments and document properties How do I do that without extracting the value first? That's where it blows: cell = HSSFRow_getCell(row: 2); Maybe HSSFRow_getCellType? And look for value CELL_BLANK? The HSSFSheet_getRow didn't get an error, and I believe the entire row was null. Peter Dow Dow Software Services, Inc. 909 793-9050 voice 909 793-4480 fax 951 522-3214 cell ----- Original Message ----- From: "Haas, Matt" <Matt.Haas@xxxxxxxxxxx> To: "RPG programming on the AS400 / iSeries" <rpg400-l@xxxxxxxxxxxx> Sent: Monday, December 06, 2004 6:34 AM Subject: RE: Using Java in RPGLE - cell comments and document properties > Peter, > > You generally test both rows and cells to see if they're null before doing anything with them. > > Matt > > -----Original Message----- > From: Peter Dow [mailto:maillist@xxxxxxxxxxxxxxx] > Sent: Monday, December 06, 2004 9:19 AM > To: RPG programming on the AS400 / iSeries > Subject: Re: Using Java in RPGLE - cell comments and document properties > > > Thanks Matt, Mike! > > That's a good idea about the template spreadsheet Matt; the sample program > Scott provided reads in a spreadsheet, modifies it, and writes it out, which > should work for my purposes -- the Jakarta website says they've tried very > hard not to disturb records they don't operate on so that this kind of thing > will be possible. > > If I knew enough Java it would be fun to try adding a NOTE record. > > That just reminded me of something else. When I was running Scott's demo > programs, I failed to put enough records in the DIVSALES physical file > that's used to populate the spreadsheet, and as a result, the cell that the > update program was going to modify did not exist, and Java threw an > exception. Is there some way to test for the existence of a cell before > trying to read it? Or to catch the Java exception? > > Peter Dow > Dow Software Services, Inc. > 909 793-9050 voice > 909 793-4480 fax > 951 522-3214 cell > > > > --- > Outgoing mail is certified Virus Free. > Checked by AVG anti-virus system (http://www.grisoft.com). > Version: 6.0.802 / Virus Database: 545 - Release Date: 12/3/2004 > > > -- > 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. > > > -- > 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. > > --- Outgoing mail is certified Virus Free. Checked by AVG anti-virus system (http://www.grisoft.com). Version: 6.0.802 / Virus Database: 545 - Release Date: 12/3/2004 -- 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 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.