× 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.



Hi Kent,

When HSSFRow_GetCell() returns *NULL (0 in the debugger is *NULL), it means that it couldn't find the cell you requested. Perhaps you requested a cell that doesn't exist? (Cells that haven't been created look the same as blank cells when you view them in Excel, but cells that haven't been created don't technically exist, and aren't saved to the XLS file.)

Either you're specifying a cell that doesn't exist, or you've got one of the parameter wrong (like the Row object, or the Sheet object that you previously used to get the row object, etc...)

Anyway, in my code, I usually want to change a cell that exists, or add a cell that doesn't, so I do something like this:

cell = HSSFRow_getCell(row: colno);
if (cell = *null);
HSSFRow_createCell(row: colno);
endif;

... then proceed to set the cell value....

Good luck




Hohlen, Kent wrote:
I am modifying a program that converts a spool file to a spreadsheet. I
added multiple lines of comments to the report and now I am trying to
get the comments on the spreadsheet. If the comments are for the same
detail line, then the user wants all those comments in the same cell.
We read one line from the report and determine what kind of line it is
on the report and then create the cell or a new row.

The report looks sort of like this


Page Headings

Selection Criteria

Column headings

Detail Line

Comment

Comment


Detail line

Comment


And so on...


The program's logic goes sort of like this.


If this is a detail line, break each column into a cell.

If this is a comment line, put comment into next cell after last column
cell.


If a second comment line is read, I would like to append what is in the
cell with the comment line just read. Can I use the following
procedures to get an existing cell and update it?

// Do this to get the cell object and get the cell's value.

Cell = HSSFRow_GetCell( Rw : CellNumber ) - to get the comment cell

String = String_getBytes( HSSFCell_getStringCellValue( Cell ) - get the
string in the cell


// build new string here.

// Update the ccell

NewString = Create_String( String ) - convert the new string to a java
string

HSSFCell_setCellValueStr( Cell : NewString ) - update the cell with the
new string



I am trying to update a cell in a spreadsheet before the book has been
saved. Is this possible? The JVM fails at String = String_getBytes(
HSSFCell_getStringCellValue( Cell ). When I put it into debug Cell = 0.
Cell is defined like HSSFCell. I don't have all the error messages in
the job log when it fails right now, but the one that sticks out is the
"pointer not set" error. It almost looks to me like it can't find the
cell and fails.


Any help would be greatly appreciated.


Thanks,


Kent Hohlen



As an Amazon Associate we earn from qualifying purchases.

This thread ...

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.