Powershell: How to colorize cells or entire row

Hi, 
I have a little question:
Goal: Colorize cells or row only on certains values for multiple tables. 
i.e. Table 1: colorize red all cells in column "xx" with values >10 ; Table 2: colorize green all cells in column "xx" with values <5  ecc
Problem: 
$1 = Get-WBSummary |Select-Object NumberOfVersions, CurrentOperationStatus, LastSuccessfulBackupTime, NextBackupTime, LastBackupResultDetailedHR, DetailedMessage | ConvertTo-Html -PreContent "table1</p>" -Fragment
$2 = Get-WBSummary |Select-Object NumberOfVersions, CurrentOperationStatus, LastSuccessfulBackupTime, NextBackupTime, LastBackupResultDetailedHR, DetailedMessage | ConvertTo-Html -PreContent "<p>table2</p>" -Fragment
$x = ConvertTo-HTML -Title "test" -Body "$1 $2"
There is a way to find different data in different table and colorize cells or row?
Thanks
Andrea Gallazzi
windowserver.it - blog:
andreagx.blogspot.com
This posting is provided AS IS with no warranties, and confers no rights.

This requires knowing a lot about how HTML and PowerSHell work
Start here:
http://tech-comments.blogspot.com/2012/08/powershell-use-vbscript-to-color-table.html
How to dynamically colr HTML generated by PowerShell.
http://tech-comments.blogspot.com/2012/07/powershell-dynamically-color-posh.html
¯\_(ツ)_/¯

Similar Messages

  • How can we pass the entire rows of a table to a web service in a VC model ?

    Hi,
    On the click of the submit button, I have to pass the rows of two tables into an enterprise service. This service also takes other fields of a form as an input.
    How can we pass the entire rows of a table into a service ?
    Regards,
    Nitin

    Hi Nitin,
    It seems that you have two or three different structures to pass data using your webservice. In your main question, two tables, you can join both in one table and from there call the webservice. In order to pass the entire table you need:
    1. Draw a line between your joinned table and your service,
    2. Map the fields,
    3. Create a 'SUBMIT' in your table tool bar. Right click on your table and choose 'Create Toobar', '+', name and choose 'Submit' as your event.
    4. Go to Configure Element (Table View) 'Multiple' at Selection Mode.
    Reward points if helps you to solve your question.
    Regards,
    Gilson Teixeira

  • Spreadsheet question: How to apply formula to entire row?

    I am updating cells which already contain formulas. Can I select the entire row, and apply an additional formula (i.e.: 1.5*) or do I have to do it individually for each cell (there are hundreds)? I need the original formulas to stay in place, and they vary.

    Hi Pamela,
    Welcome to Apple Discussions and the AppleWorks forum.
    (The following was begun before Niel's post, and completed, with a few breaks, some time after it. It addresses a shortcoming with the solution suggested above, so I haven't altered it beyond adding this paragraph.)
    I'm not certain as to exactly what you're requesting here. Do you mean you currently have the same formula in these cells (eg. =(A1-A2) ) and you want to change all of those formulas to (same eg. =1.5*(A1-A2) ). That's cetainly possible if the formulas are in contiguous cells (or in separater groups of contiguoous cells). For the example, select the first cell containing the formula and all the others contiguous to it. Make the change in the entry box, then press command-R to fill the changed formula to selected cells in the same row and to the right, then command-D to fill the formula to all selected cells below the row containing the edited cell.
    OTOH, if you want to make the change to separate (ie. non-contiguous) cells, or to cells which do not contain what's essentially the same formula (with only the cell references changed to reference a cell located in the same relative position), I don't see any way to do it directly within the spreadsheet.
    If the existing formulas are such that you can write a description of where to insert the change, it may be possible to make such a global change through an AppleScript, or through transferring the spreadsheet content to a word processing document, using Find/Change to make the revisions there, then transferr the result back to the spreadsheet (or more cautiously, to a new spreadsheet).
    An AppleScript is someone else's territory. Here's how it could be done using the word processor.
    For the example, I'll assume you want to change ALL formulas in the spreadsheet by adding the instruction to multiply the (result of the) current calculation by 1.5.
    • Open the spreadsheet.
    • Go Options > Display...
    • Check the box "Formulas", Click OK.
    • Select ALL of the cells containing data or a formula.
    • Copy.
    • Open a new word processing document.
    • Paste.
    • Press command-F to open the Find/Change dialogue.
    • Enter "=" in the Find box, press tab, enter "=1.5*" in the Change box (no quotes in either case).
    • Click Change All. OK the two alerts that follow. Close the Find/Change dialogue.
    • Press command-A to Select All. Copy.
    • Open a new spreadsheet document.
    • Paste.
    • Done.
    Limitation: This will work only if the amended formula will give the expected result. Consider the example above, =(A1-A2) with 2 in A1 and 1 in A2.
    As written, the original formula ( =(A1-A2) ) returns a result of "1", and the amended formula ( =1.5*(A1-A2) ) returns the expected result 1.5.
    But it's unlikely the original will have included the parentheses,as they're not necessary to a correct result.
    If the original is =A1-A2, the result is still 1, but the amended formula ( =1.5*A2-A1 ) will return the result "2", not 1.5.
    Revising the beginning of the altered formula to add an opening parenthesis is easy. The difficulty here is telling Find/Change (or AppleScript) how to add the matching closing parenthesis to fomulas but not to the contents of cells containing labels, other text, or nothing at all..
    *An alternate approach:* Rather than revising the existing spreadsheet's formulas, this method transfers the labels and results to a new section of the spreadsheet, multiplies the original results by 1.5, and displays the new result.
    For discussion purposes, I'll assume the current spreadsheet contains 25 columns (A..Y) and 100 rows (1..100) of data and labels.
    • Go Format > Document...
    • Change the default 40 cells wide to 52 (or enough to accomodate twice as many columns as you have containing data now).
    • Click OK
    • Select a cell to the right of the cells containing data in the current spreadsheet. (For the example, choose cell AA1)
    • Enter the following formula:
            =IF(ISTEXT(A1),A1,IF(ISBLANK(A1),"",A1*1.5))
    • Select the block of cells extending right and down from AA1 that matches the size of the original block (for the example, AA1..AY100).
    • Fill the formula Right (command-R) and Down (command-D).
    The formula will copy the text from cells containing text, keep cells blank ("") where the originals were blank, and enter the results, multiplied by 1.5, for cells where the originals contain a formula with a numerical result or a number.
    Limitation: The formula does not distinguish between an entered number and one generated by a formula contained in the referenced cell. All numeric values will be multiplied.
    Regards,
    Barry

  • How to validate cells of selected rows in editable ALV

    Hi,
    I have created an ALV grid which is editable. Now I have entered the values in the grid, and selected some rows for which I need to validate the cells. But this is not happening. It is validating all the cells edited in the grid.
    Can anyone help me...
    Regards,
    Satish Kanteti.

    Hi Satish,
    Follow below steps,
    1. Declare a additional field for selection flag in your internal table like below,
    DATA: BEGIN OF g_t_vekp OCCURS 0,
          flag(1) TYPE c,             "  <------   Flag for selection
          venum TYPE vekp-venum,
          exidv TYPE vekp-exidv,
          vbeln_gen TYPE vekp-vbeln_gen,
          END OF g_t_vekp.
    2.  Add extra  parameter  'i_callback_user_command'  in FM 'REUSE_ALV_GRID_DISPLAY'.
      CALL FUNCTION 'REUSE_ALV_GRID_DISPLAY'
        EXPORTING
          i_callback_program      = g_r_repid
          i_callback_user_command = 'USER_COMMAND'         "   <------  Additional parameter
          is_layout               = g_wa_layout
          it_fieldcat             = g_t_fieldcat[]
        TABLES
          t_outtab                = g_t_vekp
        EXCEPTIONS
          program_error           = 1
          OTHERS                  = 2.
    3. Define a form 'USER_COMMAND'  like below  to  check or save only selected  rows.
    FORM user_command USING l_r_ucomm LIKE sy-ucomm l_r_selfield TYPE slis_selfield.
      CASE l_r_ucomm.
    *Updating database when 'Save' is pressed
        WHEN '&DATA_SAVE'.
          LOOP AT g_t_vekp INTO g_wa_vekp WHERE flag = 'X'.    "   <----   Loop through only  selected rows
          "  Ur  operation on  selected  records
          ENDLOOP.
      ENDCASE.
      l_r_selfield-refresh = 'X'.
    ENDFORM.                    "user_command
    Might solve ur problem.
    Thanks,
    Edited by: Sap Fan on Oct 13, 2009 5:10 PM

  • How to return the entire row from a table

    Hi guys,
    Tabl A
    FirstName varchar2(10),
    Age Number,
    Add varchar2(100),
    Table B
    Filedname varchar2(200), -- contains all the fields of table A
    Datatype varchar2(100), -- Contains the datatypes of the filedname
    Length Number -- contains the length of the fileds
    Now how can i return the entire row from table A with the datatype and its length.
    Any help would be appreciated ?
    Here is the query I wrote but it how to take the datatype and its length..
    create or replace procedure disp_table_data
    as
    type r_cursor is REF CURSOR;
    c_A r_cursor;
    er A%rowtype;
    begin
    open c_A for select * from A;
    loop
    fetch c_A into er;
    exit when c_A%notfound;
    dbms_output.put_line(er.FirstName||'--'||er.Age);
    end loop;
    close c_A;
    END;
    /

    Guys,
    I want column value from table A and its corresponding data_type and length from table B. I think I cant do it through joins.
    Any idea would be appreciated ?.
    Example ..
    Tabl A
    FirstName varchar2(10),
    Age Number,
    Add varchar2(100)
    insert into A values('John',24,'Boston');
    Table B
    Filedname varchar2(200), -- contains all the fields of table A
    Datatype varchar2(100), -- Contains the datatypes of the filedname
    Length Number -- contains the length of the fileds
    insert into B values('FirstName','varchar2',10); -- this is coming from table A.
    Output should be like this...
    John,Varchar2,10
    Here (John is the FirstName - coming from table A, Varchar2 is a Datatype and 10 is the Length which are coming from table B ). Only column values are coming from table A , corresponding datatype and length are coming from B.
    Any idea would be appreciated ?
    Thanks.

  • How do I sort specific cells without affecting entire rows?

    In Excel I can sort specific cells ascending/descending and only what I highlight will sort.
    In Numbers, when I try to do that the entire row sorts.
    Is there a way to only sort the highlighted cells and not have the rest of the rows sort as well?

    Here's a link (Dropbox download) to a Copy Sort Acending service, that in your menu would look similar to this:
    To use it, select the cells you want to sort, just as in Excel, and make the choice from the menu.
    After that, unlike Excel, click once in the first cell where you want the sorted values to start appearing (either the original range, or a different range if you want) and type command-v or option-shift-command-v to paste.
    The one-time installation takes a double-click on the .workflow package and a click on 'Install'. You may also have to go to System Preferences > Security & Privacy and click 'Download anyway'.  Installing simply moves the service to your Library > Services folder so that it will appear in your menu. It does nothing to the innards of your Mac, and does not run unless you specifically tell it to by choosing it from the menu or running it from within Automator. You can view the script by opening it in Automator.  You can remove the service if you don't need it by holding down the option key in Finder, choosing Go from the menu and navigating to Library > Services, where you can delete it the way you would any other folder or package.
    SG

  • How to change the semantic color of entire rows in a table.

    Hi, in the past I already managed to change the semantic color of a cell by a condition (for example all the cells with negative number -> I set negative semantic color)
    My question is how can I change the semantic color of the entire row where this cell belong, and not only the cell. Im using NW2004.
    BTW, Im not a java programmer, neither a Webdynpro expert, just an ABAP Programmer. So try to be very explicit, Thx.

    Rodrigo,
    You can just bind correspondign property of every cell editor (TextView) of every column to the very same context attribute. Next, when you change attribute value for certain elemnt, the whole row (every cell editor in row) will get same value.
    Valery Silaev
    SaM Solutions
    http://www.sam-solutions.net

  • How do you set the font color for a specific entire row inside a JTable?

    How do you set the font color for a specific entire row inside a JTable?
    I want to change the font color for only a couple of rows inside a JTable.
    I've seen some ways to possibly do this with an individual cell.
    Clarification on changing the font color in an individual cell would be helpful too if
    there is no easy way to do this for a row.

    hai,
    Try out with this piece of code.Create your table and assign the renderer to each column in the table.
    CellColorRenderer m_CellColorRenderer = new CellColorRenderer();
    for(int i=0;i<your_JTable.getColumnCount();i++)
    your_JTable.getColumnModel().getColumn(i).setCellRenderer(m_CellColorRenderer);
    class CellColorRenderer extends JLabel implements TableCellRenderer
    CellColorRenderer()     
    setOpaque(true);     
    setHorizontalAlignment(LEFT);
    setVerticalAlignment(CENTER);
    setBackground(Color.white);
    setForeground(Color.black);
    protected void setValue(Object value)
         setText((value == null) ? "" : value.toString());
    public Component getTableCellRendererComponent(JTable table,Object value,boolean isSelected, boolean hasFocus, int row,int column)
         if(isSelected == true)
              setForeground(Color.red);
         else
              setForeground(Color.black);
         setValue(value);
         return this;
    regards,
    bala

  • Jtable: How to change the color of an entire row?

    How can I change the color on an entire row in a Jtable based upon the value in one of the cells in that row.
    For example: Lets say:
    I have 5 rows. Each row has 4 columns.
    If column 4 has a value "A" in any of the rows, all the text in that row should be red.
    If column 4 has a value "B" in any of the rows, all the text in that row should be blue.
    Just point me in the right direction and I will try to take it on from there.
    Thanks

    In the future, Swing related questions should be posted in the Swing forum.
    But there is no need to repost because you can search the Swing forum for my "Table Prepare Renderer" (without the spaces) example which shows how this can be done.
    But first read the tutorial link given above.

  • Exaprom PDF: how may cells span multiple rows in the table body?

    I'm using Exaprom PDF but I have a case I just can't get to work.
    I would like to generate a table where a cell spans on an entire row in the table body, the table should result as:
    |__|__|__|__|
    |__|__|__|__|
    |___________|
    |__|__|__|__|
    Dear Jean-Marc,
    could you post an example how to span a cell on an entire row in the table body with the function "Append Customized Table.vi."
    For the example, please use the 2009 version.
    Thanks,
    Asper
    This post refers to the Exaprom PDF report generation toolkit:
    https://decibel.ni.com/content/docs/DOC-10952
    Solved!
    Go to Solution.

    Maybe this.
    Jean-Marc
    LV2009 and LV2013
    Free PDF Report with iTextSharp
    Attachments:
    Test Table Merge LV2009.vi ‏113 KB

  • How do I copy content from an entire row into a different table?

    How do I copy content from an entire row of one table into a different table?  When I try to copy/paste the selected row into a row of the same size  and configuration in another table in the same document, the cells change width, the formatting and border thicknesses change, and the text gets squeezed.  When I was working with tables in Microsoft Word, there was no problem selecting text from a row in one table and placing it into a similar row and configuration in another table.

    Hi Christopher Morgan
    And welcome to apple discussions. With regard to your main question ....
    Q: Can this be done?
    A: It can but not easily (in that you may take a hit in quality). Apps like MpegStream Clip or DVDXDV may help:
    http://www.dvdxdv.com/NewFolderLookSite/Products/DVDxDV.products.htm
    It converts it back to a QT file for use with iDvd (or iMovie).
    Hope this helps but if not just come on back.
    Disclaimer: Apple does not necessarily endorse any suggestions, solutions, or third-party software / products that may be mentioned in this topic. Apple encourages you to first seek a solution at Apple Support. The following links are provided as is, with no guarantee of the effectiveness or reliability of the information. Apple does not guarantee that these links will be maintained or functional at any given time. Use the information above at your own discretion.

  • A script to apply cell style to entire rows containing a specific text

    Hi,
    I am using InDesign CC 2014
    Does anyone know how to apply a cellstyle based on text contents found in a cell in javascript?
    I need to search the document and change cell style in entire row to "cellStyle01" if the text "someText" appear in cell.
    I've found similar script here in forum which apply table style, but don't know how to change it to apply cell style!
    var curDoc = app.activeDocument;
    var allTables = curDoc.stories.everyItem().tables.everyItem();
    app.findTextPreferences = app.changeTextPreferences = null;
    app.findTextPreferences.findWhat = "someText";
    var allFounds = allTables.findText();
    app.findTextPreferences = app.changeTextPreferences = null;
    for ( var i = 0; i < allFounds.length; i++ ) {
    var curFound = allFounds[i];
    if ( curFound.length == 1 ) {
    var curFoundParent = curFound[0].parent; 
    // curFoundParent.parent.appliedTableStyle = curDoc.tableStyles.itemByName( "tableStyle" ); 
    curFoundParent.parent.appliedCellStyle = curDoc.cellStyles.itemByName("cellStyle01"); 
    Thanks!

    Hi,
    Try this,
    var doc = app.activeDocument, 
        _tables = doc.stories.everyItem().textStyleRanges.everyItem().getElements(), 
        i, j, k, l, a, _rows,_cells, rowlen; 
    for(i =0;i<_tables.length;i++) 
        for(j =0;j<_tables[i].tables.length;j++) 
            _rows = _tables[i].tables[j].rows; 
            for(k =0;k<_rows.length;k++) 
                _cells = _rows[k].cells; 
                for(l =0;l<_cells.length;l++) 
                    if(_cells[l].contents == "someText") 
                        rowlen = _cells[l].parent.cells.length; 
                        while(rowlen--) 
                              _cells[rowlen].appliedCellStyle = doc.cellStyles.item("cellStyle01"); 
    Regards,
    Chinna

  • Coloring entire row ??? (TableColumn) (cell rendering)

    Hi,
    I know this question has been posted a few times but i just couldn't make it work.. i have attached my app below. the idea is to paint the whole row to red if value[row,0] = '*' but the problem here is that only that particular row and column i.e. aRow and aColumn indicated in the cell renderer class is painted red .. i want the whole row to be red not only that particular column and row.. i can get the aRow and aTable from the renderer class but can't figure out how to use these values to paint the whole row for the table RegLocationsTableModel2...... please shed some lights on this.....
    loadhandler.java
    =============
    int vcolIndex=0; //for checking '*' value
    TableColumn col = screen.regLocationsTable.getColumnModel().getColumn(vColIndex);
    col.setCellRenderer(new RenderRedGreen());
    ( (RegLocationsTableModel2) screen.regLocationsTable.getModel()).
    addPartnerProRecord(partner);
    ( (RegLocationsTableModel2) screen.regLocationsTable.getModel()).
    fireTableDataChanged();
    cell renderer class:
    ===============
    final class RenderRedGreen extends DefaultTableCellRenderer {
    RenderRedGreen () {
    setHorizontalAlignment(SwingConstants.RIGHT);
    public Component getTableCellRendererComponent(JTable aTable,
    Object aNumberValue,
    boolean aIsSelected,
    boolean aHasFocus,
    int aRow, int aColumn) {
    if (aNumberValue == null) return this;
    Component renderer = super.getTableCellRendererComponent(aTable,
    aNumberValue,
    aIsSelected,
    aHasFocus,
    aRow, aColumn);
    System.out.println("RenderRedGreen.java::aTable=" + aTable);
    System.out.println("RenderRedGreen.java::aRow=" + aRow); // how to use these values????
    if (aNumberValue.equals("*"))
    System.out.println("RenderRedGreen.java::aNumberValu is *=");
    renderer.setBackground(Color.red);
    else {
    renderer.setBackground(Color.white);
    return this;
    thanx very much....
    tamoooo

    even after changing that if(..) statement, only the first column/cell of the row that has '*' value is coloured to red... other columns of the row basically remains as white..
    as far as i understand correctly the cell rendering, in my case, the loadhandler.java calls the cell renderer class (RenderRedGreen.java) with vColIndex=0... i.e. checking the 0th column of the row.. if the value of the first cell is '*' then the background OF THE CELL is set to red otherwise the background of the cell is set to white.. and all the while, the check is only been done on the 0th column of each row... so basically no coloring will be done on the other rows.. (???)
    i think that somehow since aRow of aTable indicates the row for whose the 0th column is '*' and is the row whose entire column is to be colored.. somehow it has to be rendered from within the render class (RenderRedGreen.java).. any suggestions??? i think some of us has already done entire row coloring.. need some insight into this..

  • How to disable a Entire row in a Matrix in Find Mode (User Form)

    Hi,
    How to disable a Entire row in a Matrix in Find Mode (User Form)
    Regards
    Jambu

    Hi,
       Iam using Bubble event = false in click event but the matrix row
    is allow to edit but we cant save the document in Find Mode That is fine.
    What is my actual requirement is In find mode matrix Row not allow to enter the data .
    For examble In ADD mode i enter the data in Three rows (Item Section - Matrix) and
    save the document. Whwn i open the document in find mode the three row is not allow
    to editable like the same functionality of PO, sales Order, etc ..
    Regards
    Jambu

  • How do I change the background of a single cell or a row in a table?

    How do I change the background of a single cell or a row in a
    table? I doesn't seem to be letting me do that.

    Are you using the latest DW? If so, then it isn't letting you
    because
    bgcolor is deprecated and shouldn't be used.
    The correct way is to use css to define the background of a
    cell
    CSS:
    .blackcell {background-color: black;}
    HTML:
    <td class="blackcell">whatever in the cell</td>
    Nadia
    Adobe® Community Expert : Dreamweaver
    CSS Templates |Tutorials |SEO Articles
    http://www.DreamweaverResources.com
    ~ Template Customization ~
    http://www.csstemplates.com.au
    Spry Widget Examples
    http://www.dreamweaverresources.com/spry-widgets/
    "dm25" <[email protected]> wrote in message
    news:f4jr5h$luu$[email protected]..
    > for some reason that doesn't always work. When I click
    inside a cell, it
    > doesn't give me an option to change the background
    color.

Maybe you are looking for