I've looked at this example but I don't understand how to change the
indexed colors. I don't have a problem creating colors that are not
indexed. The problem is that the CellUtil class (that makes it possible to
not create an abundance of cell styles) does not work if the colors are not
indexed. I therefore need to change a few of the default indexed colors to
the ones I prefer - but they still need to be indexed. When I create an
XSSFColor like the example shows, it is not an indexed color. The methods
getIndexed() and getIndex() both return 0. As a result the CellUtil class
won't work with this color (there is a known bug regarding this - the cell
will turn black).

/Bengt

Den fre 25 mars 2022 kl 17:28 skrev Bengt Rodehav <[email protected]>:

> Thanks!
>
> /Bengt
>
> Den fre 25 mars 2022 kl 16:57 skrev Kevin Seymour <[email protected]>:
>
>> There is an SO article that talks about this that might be a good start.
>>
>>
>> https://stackoverflow.com/questions/52357448/creating-custom-color-styles-for-an-xssfworkbook-in-apache-poi-4-0
>>
>> Thanks,
>>
>> Kevin Seymour | Sr. Architect, App Development
>> o: 603-354-6195
>> c: 603-505-0180
>>
>>
>> -----Original Message-----
>> From: Bengt Rodehav [mailto:[email protected]]
>> Sent: Friday, March 25, 2022 11:48
>> To: POI Users List <[email protected]>
>> Subject: Changing the color palette
>>
>> CAUTION: This email originated from outside of your organization. Do not
>> click links or open attachments unless you recognize the sender and know
>> the content. Please report any suspicious emails to IT Security.
>> ____________________________________________________________
>>
>> In order to reduce the number of styles used, I use the CellUtil class.
>> However it only works if the colors are indexed colors. See:
>>
>>
>> https://urldefense.com/v3/__https://bz.apache.org/bugzilla/show_bug.cgi?id=59442__;!!Os7eWUw!4B2EM9uJLp415Qpueb7vcsEWlNj-ISUyWI3mBkWE9oqUCFW49VeNzEOpkjeH5EEv4A$
>>
>> So, I now only use indexed colors. But I'm not really pleased with the
>> default colors and would like to change them. I know this was possible
>> using the getCustomPalette() method of the HSSFWorkbook class. But how can
>> I do this using the XSSF user model? Or is it possible to use both HSSF and
>> XSSF?
>>
>> /Bengt
>>
>> ---------------------------------------------------------------------
>> To unsubscribe, e-mail: [email protected]
>> For additional commands, e-mail: [email protected]
>>
>

Reply via email to