Cell background colour

hi,
  can anyone give me idea on changing cell background colour,
  i used,<b>setCellBackgroundColor(int row,int col,Color colorNew),</b>
but it's not working.
thanks,
karthick.

Hi Karthick,
As I see here :  cell bg color, you've already asked this question before !
Please keep in mind the following points before you post another question :
1) NEVER EVER double post ! If your problem was not solved, please append in the existing thread.
2) Assign points and close the thread if your question was answered. As I can see in the link above, you've not assigned points.
If you are facing any problem in using this forum or have any questions, feel free to contact me !
Regards
Abesh

Similar Messages

  • Excel cell background colour in POI

    hi all,
    i know this probably isnt the right place to post this but has anyone used the POI package to read Excel files?
    Im trying to get the background colour of a cell
    using
    HSSFCellStyle bgCol=checkCell.getCellStyle();
    String myCol=String.valueOf(bgCol.getFillBackgroundColor());but it doesnt return my colour index as it just returns 64 or 65
    (it returns 64 if there is a colour background and 65 if there isnt a colour background, but always returns 64 regardless of the background colour)
    any ideas why it does this and how i actually do get the unique identifyer of the colour.

    this is my code
    int maxRows=sheet.getPhysicalNumberOfRows();
    for (int i=0;i<maxRows;i++)
         //check background colour
         HSSFRow checkRow = sheet.getRow(i);
         HSSFCell checkCell = checkRow.getCell((short)0);
         HSSFCellStyle bgCol=checkCell.getCellStyle();
         String myCol=String.valueOf(bgCol.getFillBackgroundColor());
         System.out.println(i+" "+myCol+ " : "+checkCell.getNumericCellValue()+" "+bgCol.getFillPattern());     
         }my first 3 rows in my sheet have 3 different colour backgrounds then the rest of 30 rows have no colour
    the returned data looks like this
    0 64 : 1.0 1
    1 64 : 2.0 1
    2 64 : 3.0 1
    3 65 : 4.0 0
    4 65 : 5.0 0
    5 65 : 6.0 0
    6 65 : 7.0 0
    7 65 : 8.0 0
    8 65 : 9.0 0
    9 65 : 10.0 0
    10 65 : 11.0 0
    11 65 : 12.0 0
    12 65 : 13.0 0
    13 65 : 14.0 0
    14 65 : 15.0 0
    15 65 : 16.0 0
    16 65 : 17.0 0
    17 65 : 18.0 0
    18 65 : 19.0 0
    19 65 : 20.0 0
    20 65 : 21.0 0
    21 65 : 22.0 0
    22 65 : 23.0 0
    23 65 : 24.0 0
    24 65 : 25.0 0
    25 65 : 26.0 0
    26 65 : 27.0 0
    27 65 : 28.0 0
    28 65 : 29.0 0
    29 65 : 30.0 0
    as you can see the getFillBackgroundColor() is not returning the right stuff

  • White border in cell when adding background colour.

    In Numbers for Mac. When I add a background color there is a white border inside the cell. How do I have the entire cell filled with the colour? I go through, the 'format'menu, 'text','layout', 'border' and 'background colour'.

    Use the Cell tab to apply a fill color to the cell instead of applying a background color to the text.

  • Unable to set background colour JTableHeader in Java 1.6_18

    We're moving our application from Java 1.4.2 to 1.6_18, so far without major problems but there's some small issues with the GUI. Originally we'd change the background colour of the JTableHeader, but in 1.6_18 that doesn't seem to work. Instead of colouring the complete header it just seems to draw an outline. It kind of gives the impression that there's something on top of the table header which hides the coloured background.
    The code below shows what I'm trying to do, and gives different results when compiled in Java 1.4.2 and Java 1.6_18. It makes no difference whether I'm using the UIManager or setting the background directly on the JTableHeader.
    The application still works fine of course, but it bugs me that I can't work out what the problem is, so any suggestions would be greatly appreciated! I've already had a look at bug [6521138|http://bugs.sun.com/bugdatabase/view_bug.do?bug_id=6521138], but it makes no difference whether a new JTableHeader is set, so I think it's different. Also, the workaround for bug [4776303|http://bugs.sun.com/bugdatabase/view_bug.do?bug_id=4776303] has no effect so I think that doesn't apply either.
        public static void main(String[] args) {
            try {
                UIManager.setLookAndFeel(UIManager.getSystemLookAndFeelClassName());
                // Doesn't give the expected result in Java 1.6_18, the background remains white-ish with only a coloured border.
                // UIManager.put("TableHeader.background", Color.GREEN);
                // UIManager.put("TableHeader.foreground", Color.BLUE);
            } catch (Exception exception) {
                exception.printStackTrace();
            final JFrame frame = new JFrame();
            frame.getContentPane().add(createPanel());
            frame.getContentPane().setLayout(new FlowLayout());
            frame.setDefaultCloseOperation(WindowConstants.DISPOSE_ON_CLOSE);
            frame.pack();
            frame.setVisible(true);
        private static JPanel createPanel() {
            final JPanel panel = new JPanel();
            final DefaultTableModel model = new DefaultTableModel(3, 2);
            final JTable table = new JTable(model);
            // Tableheaders.
            final TableColumnModel columnModel = table.getColumnModel();
            columnModel.getColumn(0).setHeaderValue("First");
            columnModel.getColumn(1).setHeaderValue("Second");
            // Doesn't give the expected result in Java 1.6_18, the background remains white-ish with only a coloured border.
            table.getTableHeader().setBackground(Color.GREEN);
            table.getTableHeader().setForeground(Color.BLUE);
            final JScrollPane scrollPane = new JScrollPane(table);
            panel.add(scrollPane);
            scrollPane.setSize(400, 100);
            panel.setSize(500, 500);
            panel.setPreferredSize(panel.getSize());
            return panel;

    Hillster wrote:
    Ah yes, when I change that setting the background of the table header indeed gets the expected background colour. Unfortunately it also makes my desktop look hopelessly outdated :-( And I can't really expect my end-customers to change their settings just to run my little application. Still, I suppose this proves that the problem lies in the L&F?Seconded Jeanette's sentiment, this is definitely a feature, not a problem. You want system LaF, you get System LaF, with all the bells and whistles. If you're sure you don't want the system embellishments, you could consider using my [_default table header cell renderer_|http://tips4java.wordpress.com/2009/02/27/default-table-header-cell-renderer/].
    db

  • Chanage background colour of adjacent column in xMII 11.5

    Hi All,
    Is it possible to change background color of adjacent column based on values.
    e. g.
    col1     col2     col3     col4     col5     col6
    0     A     0     A     0     A
    1     B     1     B     1     B
    0     C     0     C     0     C
    1     D     1     D     1     D
    0     E     0     E     0     E
    is it possible to set background colour of col2 based on value of col1.
    col2 red if col1 value is 0 and col2 green if col1 value is 1
    Regards,
    Sachin
    Edited by: sachinjadhavar on Jul 20, 2011 1:10 PM
    Edited by: sachinjadhavar on Jul 20, 2011 1:11 PM

    Hi Sachin,
    I hope the columns are of iGrid. You can do it by writing iGrid methods.
    For all rows, get the cell value using:
    document.iGrid.getGridObject().getCellValue(ROWNUMBER,COLNUMBER)
    Write the logic of color and apply the color to specific column using
    document.iGrid.getGridObject().setCellBackgroundColor(ROWNUMBER,COLNUMBER,COLOR)
    Hope this solves your problem.
    Best Regards,
    Kedar

  • Background colour expression brings up a surprising result

    0
    down vote
    favorite
    I have a report where I want a cell colour to change if a duplicate value appears. I have used this expression for Background Colour:
    IIF(Previous(Fields!CustomerSurname.Value) = Fields!CustomerSurname.Value, "Red", Fields!CustomerSurname.Value)
    This works fine but if the customer surname is 'Brown' or 'Grey' then the cell colour matches the colour of the surname, eg the surname 'Brown' creates a brown cell background, not red. This doesn't happen with other surnames, eg ones that are not the names
    of colours...
    Any tips / guidance on how to avoid this would be appreciated - thanks.

    IIF(Previous(Fields!CustomerSurname.Value) = Fields!CustomerSurname.Value, "Red", Nothing)
    Please Mark This As Answer if it solved your issue
    Please Vote This As Helpful if it helps to solve your issue
    Visakh
    My Wiki User Page
    My MSDN Page
    My Personal Blog
    My Facebook Page

  • Right way to change datagrid row, column, cells background colors in code-behind?

    Hi all,
    I have a winform program that I'm upgrading to wpf (I'm new to wpf). The wpf code for the function (SetdataGridBackgroundColors()) is below with the winform code commented out so I can fix it.  I have a datagrid with a Cornsilk background color alteranating
    with LightGreen depending on the content of datetime  cell. If the day portion of the datetime is different then the color changes from one to the other. I used a colorIndex variable because at the end of the month it could go from 31 to 1 and that would
    not work if I use the day directly.
    I tried this line to change the background color:
    optionsDataDatagrid.RowBackground = new SolidColorBrush(Colors.Cornsilk);
    this works but it changes every row. I found this other stuff:
    DataGridRow currentRowColor = optionsDataDatagrid.ItemContainerGenerator.ContainerFromIndex(i) as DataGridRow;
    //DataGridRow currentRowColor = optionsDataDatagrid.ItemContainerGenerator.ContainerFromItem(optionsDataDatagrid.Items[i]) as DataGridRow;
    currentRowColor.Background = new SolidColorBrush(Colors.Cornsilk);
    Either ContainerFromIndex or ContainerFromItem throw an exception because currentRowColor is null. I looked at optionsDataDatagrid.Items[i] and is not null. Then I read that using ItemContainerGenerator is not a good idea.
    BTW I'm calling SetdataGridBackgroundColors() after datagrid is been filled with data.
    So... what is the proper way to set each row, column or cell background color in wpf?
    Thanks
    private void SetdataGridBackgroundColors()
    optionRowData rowData = new optionRowData();
    if (optionsDataDatagrid.Items.Count == 0)
    return;
    int colorIndex = 1;
    DateTime savedDate, currentRowDate;
    rowData = optionsDataDatagrid.Items[0] as optionRowData;
    savedDate = rowData.col_datetime.Date; //only compare the date not the time
    for (int i = 0; i < optionsDataDatagrid.Items.Count; i++)
    //currentRowDate = Convert.ToDateTime(optionsDataDatagrid.Rows[i].Cells[3].Value); //winform code
    //currentRowDate = currentRowDate.Date; //winform code
    rowData = optionsDataDatagrid.Items[i] as optionRowData;
    currentRowDate = rowData.col_datetime.Date;
    if (currentRowDate != savedDate)
    colorIndex++;
    savedDate = currentRowDate;
    if (colorIndex % 2 == 0)
    //optionsDataDatagrid.Rows[i].DefaultCellStyle.BackColor = Color.Cornsilk;
    //------------------- testing new code --------------begin
    optionsDataDatagrid.RowBackground = new SolidColorBrush(Colors.Cornsilk); //this changes all rows
    //DataGridRow currentRowColor = optionsDataDatagrid.ItemContainerGenerator.ContainerFromIndex(i) as DataGridRow;
    //DataGridRow currentRowColor = optionsDataDatagrid.ItemContainerGenerator.ContainerFromItem(optionsDataDatagrid.Items[i]) as DataGridRow;
    //currentRowColor.Background = new SolidColorBrush(Colors.Cornsilk);
    //------------------- testing new code --------------end
    //optionsDataDatagrid.Columns[4].DefaultCellStyle.BackColor = Color.DarkSalmon;
    //optionsDataDatagrid.Columns[5].DefaultCellStyle.BackColor = Color.Aquamarine;
    //optionsDataDatagrid.Rows[i].Cells[4].Style.ApplyStyle(optionsDataDataGridView.Columns[4].DefaultCellStyle);
    //optionsDataDatagrid.Rows[i].Cells[5].Style.ApplyStyle(optionsDataDataGridView.Columns[5].DefaultCellStyle);
    else
    //optionsDataDatagrid.Rows[i].DefaultCellStyle.BackColor = Color.LightGreen;
    //------------------- testing new code --------------begin
    optionsDataDatagrid.RowBackground = new SolidColorBrush(Colors.LightGreen); //this has no effect
    //------------------- testing new code --------------end
    //optionsDataDatagrid.Columns[4].DefaultCellStyle.BackColor = Color.Coral;
    //optionsDataDatagrid.Columns[5].DefaultCellStyle.BackColor = Color.LimeGreen;
    //optionsDataDatagrid.Rows[i].Cells[4].Style.ApplyStyle(optionsDataDataGridView.Columns[4].DefaultCellStyle);
    //optionsDataDatagrid.Rows[i].Cells[5].Style.ApplyStyle(optionsDataDataGridView.Columns[5].DefaultCellStyle);

    I (also) strongly recommend mvvm.
    Setting values is a particularly bad idea in this case.
    I don't mean to be rude but your explanation of the requirement is kind of vague.
    I would bind solidcolourbrushes.
    Set the properties based on whatever your logic is within the viewmodel.
    You can switch out what each of the brushes holds when the user clicks wherever.
    So you use a highlightbrush when something or other is true.
    That highlightbrush is set to a blue brush when the user clicks left and a red brush when they click right.
    Please don't forget to upvote posts which you like and mark those which answer your question.
    My latest Technet article - Dynamic XAML

  • How can I change the background colour when working on a doc in full screen view (pages)?

    Recently I have been working on docs without the distraction of having to see my desktop around my page file by using the full screen view in pages. I do find the contrast to an all black screen too harsh though and it makes my eyes more tired than seeing the clutter of my desktop around the page. Is there any way I can change the background colour?
    Any help much appreciated!

    When you are in Full screen mode move the cursor up to the top to show the Format bar. Then look to the far right. There you'll see Background  and a rectangle. Click on the rectangle and change the colour.
    For information on Pages download the Pages User Guide from your Pages Help menu.

  • How do I change the background colour on notes. I need a darker background due to a visual issue. Apple has now discriminated those with visual issues.  I am so not happy with many of the new changes because of this.

    I am so not happy with the new changes especially when it come to the ability to change background colours, fonts and font sizes/ colours... Does Apple really think that their only audience is the young cool crowd or people who do not have a visual impairment.  Think before you make changes to your software and programs.  You WILL lose more people to androids if you continue this way.
    At least give users the ability to make apps like notes their owned by allowing them to pick the style, theme, background and colour, font size and colour. 
    A very ****** off Apple user who is now looking at Androids.

    Hi Tricia,
    I'm sorry but I don't see an ideal way to do this. Is it the yellow label text, e.g:  "New" against the white background which is causing the difficulty?
    The only way I've found of getting the colors to change in Notes is via Settings>General>Accessibility>Invert Colors but then it looks like something has barfed all over your screen.
    I'd be very, very surprised if Apple do not fix this, firstly because I believe "Accessibility" is a legal matter and secondly because they will not want to cause difficulty for their customers.  We have to remember that this is a major, major overhaul of iOS, it has essentially been taken back to the drawing board and done from scratch again, it may take a little time, but I'm sure they will fix these issues.
    Regards,
    Steve

  • Just uploaded iso7 , . . .hate it!  Can you change background colours?  How do you add a new item/activity to the schedule? In notes the font has changed, can I change it back and the link colour is now yellow instead of blue, can I change it?  Thanks

    Just uploaded iso7 , . . .hate it!  Can you change background colours?  How do you add a new item/activity to the schedule? In notes the font has changed, can I change it back and the link colour is now yellow instead of blue, can I change it?  Yellow on white is harder to read. Thanks

    Another question. How do you bookmark something.  It was so easy before, why did they change it?  Can I uninstall it?

  • Cell background image problem

    Please tell me exactly how to add only one background gif to
    a cell. I have
    told it "no repeat" but it does just that. See:
    http://www.pskewedp.info/content.htm
    Thank you, Eleanor
    Eleanor T. Culling
    Leavenworth, WA
    European Alps Photos
    http://www.eleanorstravels.com/photoblog-issue19.htm

    Thank you so very much! Please watch this thread, I'll
    probably need a bit
    more help. I have 3-4 images I need to use this way, as table
    or cell
    backgrounds. Will I have
    #cellBg2 and 3 and 4?
    Eleanor T. Culling
    Leavenworth, WA
    European Alps Photos
    http://www.eleanorstravels.com/photoblog-issue19.htm
    "Osgood" <[email protected]> wrote in
    message
    news:[email protected]...
    > E. T. Culling wrote:
    >
    >> Please, what do you mean by this:
    >> "Refer deesadler's reply in this thread." I don't
    see that.
    >>
    >
    > Hi Eleanor,
    >
    > You need to use some css to apply the background image
    to the cell. The
    > complete page code you need is beneath these
    instructions, just in case
    > you have trouble in implementing the changes.
    >
    > The css is below (add it to the css styles which already
    exist in the head
    > section of your page)
    >
    > #cellBg {
    > background-image:
    url(Graphics/Content-box-top-775.gif);"
    > background-repeat: no-repeat;
    > }
    >
    > Then you need the add the id 'cellBg' to the cell as
    below and remove
    > 'background="Graphics/Content-box-top-775.gif'
    >
    > Like this:
    >
    >
    > <td id="cellBg" width="774" height="201"
    valign="top">
    >
    >
    > Here is the complete revised page:
    >
    >
    > <!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0
    Transitional//EN"
    > "
    http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
    > <html xmlns="
    http://www.w3.org/1999/xhtml">
    > <head>
    > <meta http-equiv="Content-Type" content="text/html;
    charset=iso-8859-1" />
    > <title>Untitled Document</title>
    > <style type="text/css">
    > <!--
    > body,td,th {
    > font-family: Arial, Helvetica, sans-serif;
    > }
    > body {
    > background-color: #CCCCCC;
    > }
    > a:link {
    > color: #006699;
    > text-decoration: none;
    > }
    > a:visited {
    > text-decoration: none;
    > color: #006699;
    > }
    > a:hover {
    > text-decoration: underline;
    > color: #006699;
    > }
    > a:active {
    > text-decoration: none;
    > color: #006699;
    > }
    > #cellBg {
    > background-image:
    url(Graphics/Content-box-top-775.gif);"
    > background-repeat: no-repeat;
    > }
    > -->
    > </style>
    > </head>
    >
    > <body>
    > <table width="1000" border="0" cellspacing="0"
    cellpadding="10">
    > <tr>
    > <th width="1019" bgcolor="#f8f8dc"
    scope="row"><table width="1000"
    > border="0" cellspacing="0" cellpadding="0">
    > <tr>
    >
    > <th colspan="2" scope="row"><img
    src="Graphics/content header.jpg"
    > alt="Content Page" width="995" height="87"
    /></th>
    > </tr>
    > <tr>
    > <th width="226" rowspan="3" align="left" valign="top"
    > scope="row">Navigation</th>
    > <td id="cellBg" width="774" height="201"
    valign="top"><center>
    > </center> </td>
    > </tr>
    >
    > <tr>
    >
    > <td valign="top"><center>
    > Footer
    > </center> </td>
    > </tr>
    >
    > </table></th>
    > </tr>
    > </table>
    > </body>
    > </html>
    >
    >

  • My iTunes 11.0 (mac) has a black background colour and I can not see all of the information.  How do I change the background colour in iTunes 11.0 (mac)

    My iTunes 11.0 (mac) has a black background colour and I can not see all of the information for each song.    How do I change the background colour in iTunes 11.0 (mac) so I can see check boxes etc.  My download window shows no information, it is entirely black.

    Trent o
    Someone else in the forum told me how to do this.  If you have Onyx on your system then select Parameters, iTunes and turn off high contrast mode.  If you don't have Onyx, I'd suggest getting it.  It is freeware and used to help maintain your system.  Good luck
    Paul

  • Changing background colour for a new Workspace page

    Hi everybody,
    can anybody help me?
    I want to create a new Workspace Page. When i create a new page in the workspace, the colour is white. How can i change the background colour?
    Thanks for any suggestion!
    Eddy

    Eddy,
    This forum is for workspace manager - a database product that has no UI itself. I'm not sure what product you are using, but it's not WM.
    Bryan

  • Background Colour in Pages 5.0.1

    Knowing how Apple likes to have everything sent electronically, and not printed, I am surprised that I can't change the background page colour of documents.
    I can change the background of a word, sentence and paragraph. I can even select all the text on a page and change the background colour of that.
    But there is still a white border all around this document, where the margins, headers and footers are.
    It looks really NAFF.
    Anyone got any ideas please.

    Make a page size rectangle, color it and send it to the back or make it a master object.
    Peter

  • Background colour in pages document

    Is there a way of having white as my background colour for my document and using white script?

    Peter, thank you for your response.
    I wasn't trying to lock horns with you.
    Your story about your sister in law made me laugh.
    To be certain, I am NOT arguing that black text on white background is less legible
    [I'm sure you are correct that it is more legible. That would stand to reason].
    I am saying that staring at lots of white light hurts my eyes and I don't like looking at it for a long time.
    I'm sorry you disagree with what I have experienced that applies to me personally over many years.
    However,
    I don't think that's superstition.
    That's years of personal experience, related to my own personal eyeballs [not yours].
    To drop pretensions of science,
    I'm afraid what this boils down to is I can't be told what I like to see, or look at for long periods, and what is more comfortable for me personally.
    To use a very rough analogy : 
    Would it be more painful for you to stare at a very intense little ball of light [or a few of them] / [or a neutral-coloured ball of light] against a dark night sky?
    OR at a few black dots in front of , perhaps not the sun, but some other similarly but far less intense light across say, the sky as a backdrop, all of that light shining in your eyes?
    Would you rather try and read small text on a dim lightbulb, or against a fully-lit lightbulb?
    You may be different. I personally prefer the text on the more neutral lightbulb.
    I'm perfectly happy to be surprised, but I don't think you were addressing a slightly separate topic: legibility, rather than photoreceptors being bombarded with hot-light all day.
    While legibility is a factor related to eyestrain, I would suspect for different reasons,
    and ultimately, what negligible-difference I may lose in legibility is far-more than made up for by not having to stare at a flat panel beaming hot-light into my eyes all day.

Maybe you are looking for

  • Driver errors reported when trying to start objects

    We have a standard PCI can card, and are developing in the following environment: Software written in VC++ Version6, running under NT4.0, Port configured as 'CAN0', using extended arbitration IDs. We create one network interface object, and, dependin

  • Has anyone develped an EM plug-in for Cisco switches or routers

    Folks, Has anyone develped an EM plug-in for Cisco switches or routers? Please reply to this thread if you have developed one and would like to share your experience in developing this plug-in? Thanks,

  • Regarding Active directory configuration

    We have one PDC and one backup PDC and 272 ADC in our Organization .all server will communicate to PDC for replication as per the design. we are facing the the issue in replication domain dns zone and forest dns zone is not replicating getting 1722 e

  • ComboBox and button symbol interaction

    (Sorry-- I had this posted in ActionScript as well -- not really an AS issue...) I thought it would be easier for folks if they didn't have to create this from scratch: Here is the Sample SWF and the Souce FLA Greetings -- I traced back a bug that I

  • MacBook Pro Yosemite Very Slow Ethernet

    Hello everyone and a happy new year by the way Yesterday while I was trying to transfer a file over one of the computer attached to home network (all set up in gigabit ethernet) I realised that the speed dramatically reduced: That is more evident in