×
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.
I am writing a program to read a excel spreadsheet and validate the
data. When an error is detected, I change the color of the font to red
and insert an error message in a cell further down the row.
The problem I am having is that when I change a cell's font color, the
adjacent cells also change color. I guess all these cells have the same
cell style and changing one will change them all.
What I need to do is retrieve the current cell style, change the font
color, then change the cell without changing all the adjacent cells.
Here is the RPG/LE code. This code is part of a subprocedure that
handles changing the cell color and inserting the error message. This
code deals with changing the cell color. I have to do it this way
because some of the cells have special formatting, like a date format
for instance.
// get cell style
cell_style = HSSFCell_getCellStyle(cell);
// change font to red letter
HSSFCellStyle_setFont(cell_style: red_font);
// set style of cell - red letter
HSSFCell_setCellStyle(cell:cell_style);
I am certain that the program only changes one cell. What I don't
understand is how and why the others are changing.
I have done a test but I don't know what it means. I changed the color
of all the surrounding cells to different colors and then only the cell
in error changed to red and not the adjacent ones.
In another test, I created another cell style and used that cell style
to change the font color of the cell but that didn't work either. The
adjacent cells also changed color.
Does anyone have any ideas on what is happening and how I can change
only the cell I want to change?
Thanks in advance.
Marvin
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.