Coloring a table cell with swing

Hello,
I am trying to write a java program in swing. Basically I am setting up a table and adding labels to the table's cells. Rather than displaying the label, the table is inserting the labels' string value. Here is a compilable example:
import java.awt.GridBagLayout;
import java.awt.GridBagConstraints;
import java.awt.Insets;
import javax.swing.JFrame;
import javax.swing.JLabel;
import javax.swing.JTable;
import javax.swing.JScrollPane;
import java.awt.*;
public class TableTest extends JFrame {
     private final JTable table;
     private final GridBagConstraints constraints;
     private JLabel makeLabel(Color c){
          JLabel lab = new JLabel(" ");
          lab.setOpaque(true);
          lab.setBackground(c);
          //getContentPane().add(lab, constraints);
          return lab;
     public TableTest() {
        super("Visualizer");
        setDefaultCloseOperation(JFrame.EXIT_ON_CLOSE);
        getContentPane().setLayout(new GridBagLayout());
        constraints = new GridBagConstraints();
        constraints.insets = new Insets(3, 10, 3, 10);
        String[] columnNames = {"RED","YELLOW", "BLUE"};
        Object[][] data = { {makeLabel(Color.RED), makeLabel(Color.YELLOW), makeLabel(Color.BLUE) } };       
        table = new JTable(data, columnNames);
        table.setPreferredScrollableViewportSize(new Dimension(500, 70));
        table.setFillsViewportHeight(true);
        JScrollPane scrollPane = new JScrollPane(table);
        //Add the scroll pane to this panel.
        add(scrollPane);
        pack();
        setVisible(true);
     public static void main(String[] args) {
          new TableTest();
}How do i modify this to actually show the labels? Thanks in advance.

Why are you putting labels into the table's cells?
Have a look at Sun's tutorial on tables to see how a custom renderer is used to display particular cells in a certain way. (And also for the whole rendering approach used by tables.)
http://java.sun.com/docs/books/tutorial/uiswing/components/table.html#renderer
(Swing questions are better asked in the Swing forum: http://forum.java.sun.com/forum.jspa?forumID=57)

Similar Messages

  • Table cell with more than one component

    how can i make table cell with more than one component
    like below, cell in column 3 contains few button
    col0 | col1 | col2 |
    a | b |[btn1] [btn2] [btn3]|
    a | b |[btn1] [btn2] |
    and when i click on the any of the button a dialog box pop up saying something..

    Here's link to someone who did a lot with tables. Not sure about multiple buttons, but it should get you started.
    http://www2.gol.com/users/tame/swing/examples/SwingExamples.html

  • How to add colors to table cells

    Hi ALL,
    Does anyone have any idea of adding colors to table cells?For example i am displaying monthly chart in a table view i want to fill the cells with colors when columns are saturday and sunday.
    Thanks in advance

    Hi,
    I want to pass the colors at bean level.For example
    private DefaultTableViewModel createNewTable
                                      (DefaultTableViewModel model) {
            Vector data = createData();
            Vector colName = new Vector();
            /* Define column names */
            colName.addElement("1stColumn");
            colName.addElement("2ndColumn");
            colName.addElement("3rdColumn");
            model = new DefaultTableViewModel(data, colName);
            return model;
        private Vector createData() {
            Vector dataVec = new Vector();
            Vector retVector = new Vector();
            /* 1st entry */
            dataVec.addElement("Row 1, Column 1");
            dataVec.addElement("Row 1, Column 2");
            dataVec.addElement("Row 1, Column 3");
            retVector.addElement(dataVec);
            /* 2nd entry */
            dataVec = new Vector();
            dataVec.addElement("Row 2, Column 1");
            dataVec.addElement("Row 2, Column 2");
            dataVec.addElement("Row 2, Column 3");
            retVector.addElement(dataVec);
            /* more entries */
            return retVector;
    suppose I want to pass the color at Row2,Column1.Can anyone post the sample code ?
    its little urgent.Thanks in advance

  • Table cell with invisible border?

    Hi,
    I am trying to get table-cells with e.g. the right
    border missing (invisible). I am using the
    following XSL-FO to get this:
    <fo:table-cell border="solid black 1px" border-right-width="0px" border-collapse="collapse" number-columns-spanned="1">
    This works fine with four different
    XSL-FO engines, but XMLP shows
    the right border. Is there a work around
    or different approach to get invisible
    borders?
    Thank you,
    Heinz

    Hi Tim,
    I am using an RTF template, but was not able to get
    what I need with the standard functionality available
    in the RTF template. To work around this, I have
    imported a stylesheet to create the FO for the table
    directly. I try to append to this mail:
    - code in the RTF template
    - XML sample data
    - stylesheet imported from RTF template
    - the generated FO (small table, 4 colums, 7 rows, plus headers)
    I could also provide a stylesheet to create a complete,
    self containing FO and a correct PDF output, but may
    direct mail would be better for this.
    Thank you,
    Heinz
    TemplateBuilder.RTF:
    <?start:body?>
    <?import: file:///F:/OracleForum/create_a_table.xsl?>
    <?for-each:/Sample_Data/Measured_Values?>
    <?call@inlines: parameterGroupIndividual?><?end call?>
    <?end for-each?>
    <?end body?>
    XML Data:
    <?xml version="1.0" encoding="UTF-8"?>
    <Sample_Data>
         <Measured_Values>
              <Param_Group>GENERAL PARAMGROUP<Parameter Unit="umol/l">BILIU<Item Measured="6.8">1</Item>
                        <Item Measured="8.2">2</Item>
                        <Item Measured="-">3<Value_Note>
                                  <number>*</number>
                                  <text>A sample footnote</text>
                             </Value_Note>
                        </Item>
                        <Item Measured="62.1">4</Item>
                        <Item Measured="215.9">5</Item>
                        <Item Measured="12.7">6<Item_Note>
                                  <number>a</number>
                                  <text>An Item footnote</text>
                             </Item_Note>
                        </Item>
                        <Item Measured="3.6">7</Item>
                   </Parameter>
                   <Parameter Unit="per ul">ERYU<Item Measured="7.210">1</Item>
                        <Item Measured="45.000">2<Value_Note>
                                  <number>**</number>
                                  <text>Another sample footnote</text>
                             </Value_Note>
                        </Item>
                        <Item Measured="-">3</Item>
                        <Item Measured="1234.000">4</Item>
                        <Item Measured="326.580">5</Item>
                        <Item Measured="3.658">6</Item>
                        <Item Measured="123.540">7</Item>
                   </Parameter>
                   <Parameter Unit="per ul">LEUU<Item Measured="3.00">1</Item>
                        <Item Measured="3.00">2</Item>
                        <Item Measured="-">3</Item>
                        <Item Measured="354.39">4</Item>
                        <Item Measured="3254.24">5</Item>
                        <Item Measured="1256.32">6</Item>
                        <Item Measured="326.54">7</Item>
                   </Parameter>
              </Param_Group>
              <Param_Group>CRYSTALS<Parameter Unit="umol/l">GLUHI<Item Measured="22.00">1</Item>
                        <Item Measured="5.12">2</Item>
                        <Item Measured="-">3</Item>
                        <Item Measured="23.14">4<Value_Note>
                                  <number>***</number>
                                  <text>A last footnote</text>
                             </Value_Note>
                        </Item>
                        <Item Measured="576.26">5</Item>
                        <Item Measured="3621.00">6</Item>
                        <Item Measured="0.37">7</Item>
                   </Parameter>
              </Param_Group>
         </Measured_Values>
    </Sample_Data>
    create_a_table.xsl:
    <xsl:stylesheet version="2.0" xmlns:xsl="http://www.w3.org/1999/XSL/Transform" xmlns:fo="http://www.w3.org/1999/XSL/Format" xmlns:xs="http://www.w3.org/2001/XMLSchema" xmlns:fn="http://www.w3.org/2005/xpath-functions" xmlns:xdt="http://www.w3.org/2005/xpath-datatypes">
         <xsl:output method="xml" version="1.0" indent="no" encoding="ISO-8859-1"/>
         <!-- -->
         <xsl:template name="parameterGroupIndividual">
              <xsl:call-template name="doParameterGroupTables">
                   <xsl:with-param name="currentNodeSet" select="*"/>
                   <xsl:with-param name="currentNodeChilds" select="*[1]/Parameter"/>
              </xsl:call-template>
         </xsl:template>
         <!-- -->
         <xsl:template name="doParameterGroupTables">
              <xsl:param name="currentNodeSet"/>
              <xsl:param name="currentNodeChilds"/>
              <fo:table border="solid black 1px" table-layout="fixed">
                   <!-- The "Item" column -->
                   <fo:table-column column-width="2.5cm"/>
                   <!-- Create required columns 80% space for values, 20% space for footnotes -->
                   <xsl:call-template name="defineColumnsForNode">
                        <xsl:with-param name="nodeSet" select="$currentNodeSet"/>
                        <xsl:with-param name="nodeSetChilds" select="$currentNodeChilds"/>
                        <xsl:with-param name="colWidth" select="2.4"/>
                   </xsl:call-template>
                   <fo:table-header>
                        <fo:table-row>
                             <fo:table-cell border="solid black 0px" border-collapse="collapse" number-columns-spanned="1">
                                  <fo:block> </fo:block>
                             </fo:table-cell>
                             <xsl:call-template name="doParameterGroupHeaders">
                                  <xsl:with-param name="nodeSet" select="$currentNodeSet"/>
                             </xsl:call-template>
                        </fo:table-row>
                        <fo:table-row>
                             <fo:table-cell>
                                  <fo:block font-family="sans-serif" font-size="9pt" text-align="center" font-weight="bold">Item</fo:block>
                             </fo:table-cell>
                             <xsl:call-template name="defineSecondRowOfHeaders">
                                  <xsl:with-param name="nodeSet" select="$currentNodeSet"/>
                                  <xsl:with-param name="nodeSetChilds" select="$currentNodeChilds"/>
                             </xsl:call-template>
                        </fo:table-row>
                   </fo:table-header>
                   <fo:table-body>
                        <xsl:for-each-group select="*/Parameter/Item" group-by="normalize-space(text())">
                             <fo:table-row>
                                  <fo:table-cell border="solid black 2px" border-collapse="collapse" number-columns-spanned="1">
                                       <fo:block font-family="sans-serif" font-size="9pt" text-align="center">
                                            <xsl:value-of select="./text()"/>
                                       </fo:block>
                                  </fo:table-cell>
                                  <xsl:for-each select="current-group()">
                                       <fo:table-cell border="solid black 2px" border-left-width="1px" border-collapse="collapse" number-columns-spanned="1">
                                            <fo:block font-family="sans-serif" font-size="9pt" text-align="right">
                                                 <xsl:value-of select="./@Measured"/>
                                            </fo:block>
                                       </fo:table-cell>
                                       <fo:table-cell border="solid black 2px" border-right-width="1px" border-collapse="collapse" number-columns-spanned="1">
                                            <fo:block font-family="sans-serif" font-size="9pt" text-align="left">
                                                 <xsl:value-of select="./Value_Note/number/text()"/>
                                            </fo:block>
                                       </fo:table-cell>
                                  </xsl:for-each>
                             </fo:table-row>
                        </xsl:for-each-group>
                   </fo:table-body>
              </fo:table>
         </xsl:template>
         <!-- -->
         <xsl:template name="doParameterGroupHeaders">
              <xsl:param name="nodeSet"/>
              <xsl:if test="$nodeSet[1]">
                   <fo:table-cell border="solid black 1px" border-collapse="collapse" number-columns-spanned="{count($nodeSet[1]/Parameter)*2}">
                        <fo:block font-family="sans-serif" font-size="9pt" text-align="center" font-weight="bold">
                             <xsl:value-of select="$nodeSet[1]/text()"/>
                        </fo:block>
                   </fo:table-cell>
                   <xsl:call-template name="doParameterGroupHeaders">
                        <xsl:with-param name="nodeSet" select="$nodeSet[1]/following-sibling::*"/>
                   </xsl:call-template>
              </xsl:if>
         </xsl:template>
         <!-- -->
         <xsl:template name="defineSecondRowOfHeaders">
              <xsl:param name="nodeSet"/>
              <xsl:param name="nodeSetChilds"/>
              <xsl:choose>
                   <xsl:when test="$nodeSetChilds[1]">
                        <fo:table-cell border="solid black 1px" border-collapse="collapse" number-columns-spanned="2">
                             <fo:block font-family="sans-serif" font-size="9pt" text-align="center" font-weight="bold">
                                  <xsl:value-of select="$nodeSetChilds[1]/text()"/>
                             </fo:block>
                             <fo:block font-family="sans-serif" font-size="9pt" text-align="center" font-weight="bold">
                                  <xsl:value-of select="$nodeSetChilds[1]/@Unit"/>
                             </fo:block>
                        </fo:table-cell>
                        <xsl:call-template name="defineSecondRowOfHeaders">
                             <xsl:with-param name="nodeSet" select="$nodeSet"/>
                             <xsl:with-param name="nodeSetChilds" select="$nodeSetChilds[1]/following-sibling::*"/>
                        </xsl:call-template>
                   </xsl:when>
                   <xsl:when test="$nodeSet[1]/following-sibling::*">
                        <xsl:call-template name="defineSecondRowOfHeaders">
                             <xsl:with-param name="nodeSet" select="$nodeSet[1]/following-sibling::*"/>
                             <xsl:with-param name="nodeSetChilds" select="$nodeSet[1]/following-sibling::*[1]/Parameter"/>
                        </xsl:call-template>
                   </xsl:when>
                   <xsl:otherwise>
                   </xsl:otherwise>
              </xsl:choose>
         </xsl:template>
         <!-- -->
         <xsl:template name="setValuesPGroupChilds">
              <xsl:param name="nodeSet"/>
              <xsl:param name="nodeSetChilds"/>
              <xsl:param name="ItemNumber"/>
              <xsl:choose>
                   <xsl:when test="$nodeSetChilds[1]/Item[text()=$ItemNumber]">
                        <fo:table-cell border="solid black 1px" border-right-width="0px" border-collapse="collapse" number-columns-spanned="1">
                             <fo:block font-family="sans-serif" font-size="9pt" text-align="right">
                                  <xsl:value-of select="$nodeSetChilds[1]/Item[text()=$ItemNumber]/@Measured"/>
                             </fo:block>
                        </fo:table-cell>
                        <fo:table-cell border="solid black 1px" border-left-width="0px" border-collapse="collapse" number-columns-spanned="1">
                             <fo:block font-family="sans-serif" font-size="9pt" text-align="left">
                                  <xsl:value-of select="$nodeSetChilds[1]/Item[text()=$ItemNumber]/Value_Note/number/text()"/>
                             </fo:block>
                        </fo:table-cell>
                        <xsl:call-template name="setValuesPGroupChilds">
                             <xsl:with-param name="nodeSet" select="$nodeSet"/>
                             <xsl:with-param name="nodeSetChilds" select="$nodeSetChilds[1]/following-sibling::*"/>
                             <xsl:with-param name="ItemNumber" select="$ItemNumber"/>
                        </xsl:call-template>
                   </xsl:when>
                   <xsl:when test="$nodeSet[1]/following-sibling::*">
                        <xsl:call-template name="setValuesPGroupChilds">
                             <xsl:with-param name="nodeSet" select="$nodeSet[1]/following-sibling::*"/>
                             <xsl:with-param name="nodeSetChilds" select="$nodeSet[1]/following-sibling::*[1]/Parameter"/>
                             <xsl:with-param name="ItemNumber" select="$ItemNumber"/>
                        </xsl:call-template>
                   </xsl:when>
                   <xsl:otherwise>
                   </xsl:otherwise>
              </xsl:choose>
         </xsl:template>
         <!-- -->
         <xsl:template name="defineColumnsForNode">
              <xsl:param name="nodeSet"/>
              <xsl:param name="nodeSetChilds"/>
              <xsl:param name="colWidth"/>
              <xsl:choose>
                   <xsl:when test="$nodeSetChilds[1]">
                        <fo:table-column column-width="{$colWidth*0.8}cm"/>
                        <fo:table-column column-width="{$colWidth*0.2}cm"/>
                        <xsl:call-template name="defineColumnsForNode">
                             <xsl:with-param name="nodeSet" select="$nodeSet"/>
                             <xsl:with-param name="nodeSetChilds" select="$nodeSetChilds[1]/following-sibling::*"/>
                             <xsl:with-param name="colWidth" select="$colWidth"/>
                        </xsl:call-template>
                   </xsl:when>
                   <xsl:when test="$nodeSet[1]/following-sibling::*">
                        <xsl:call-template name="defineColumnsForNode">
                             <xsl:with-param name="nodeSet" select="$nodeSet[1]/following-sibling::*"/>
                             <xsl:with-param name="nodeSetChilds" select="$nodeSet[1]/following-sibling::*[1]/Parameter"/>
                             <xsl:with-param name="colWidth" select="$colWidth"/>
                        </xsl:call-template>
                   </xsl:when>
                   <xsl:otherwise>
                   </xsl:otherwise>
              </xsl:choose>
         </xsl:template>
         <!-- -->
         <!-- create $noOfCols empty table-cells -->
         <!-- -->
         <xsl:template name="fillColumns">
              <xsl:param name="noOfCols"/>
              <xsl:if test="$noOfCols > 0">
                   <fo:table-cell border-right-style="dashed" border-left-style="dashed" border-width="1px">
                        <fo:block/>
                   </fo:table-cell>
                   <xsl:variable name="rest" select="$noOfCols - 1"/>
                   <xsl:call-template name="fillColumns">
                        <xsl:with-param name="noOfCols" select="$rest"/>
                   </xsl:call-template>
              </xsl:if>
         </xsl:template>
    </xsl:stylesheet>
                   <fo:table border="solid black 1px" table-layout="fixed">
                        <fo:table-column column-width="2.5cm"/>
                        <fo:table-column column-width="1.92cm"/>
                        <fo:table-column column-width="0.48cm"/>
                        <fo:table-column column-width="1.92cm"/>
                        <fo:table-column column-width="0.48cm"/>
                        <fo:table-column column-width="1.92cm"/>
                        <fo:table-column column-width="0.48cm"/>
                        <fo:table-column column-width="1.92cm"/>
                        <fo:table-column column-width="0.48cm"/>
                        <fo:table-header>
                             <fo:table-row>
                                  <fo:table-cell border="solid black 0px" border-collapse="collapse" number-columns-spanned="1">
                                       <fo:block> </fo:block>
                                  </fo:table-cell>
                                  <fo:table-cell border="solid black 1px" border-collapse="collapse" number-columns-spanned="6">
                                       <fo:block font-family="sans-serif" font-size="9pt" text-align="center" font-weight="bold">GENERAL PARAMGROUP</fo:block>
                                  </fo:table-cell>
                                  <fo:table-cell border="solid black 1px" border-collapse="collapse" number-columns-spanned="2">
                                       <fo:block font-family="sans-serif" font-size="9pt" text-align="center" font-weight="bold">CRYSTALS</fo:block>
                                  </fo:table-cell>
                             </fo:table-row>
                             <fo:table-row>
                                  <fo:table-cell>
                                       <fo:block font-family="sans-serif" font-size="9pt" text-align="center" font-weight="bold">Item</fo:block>
                                  </fo:table-cell>
                                  <fo:table-cell border="solid black 1px" border-collapse="collapse" number-columns-spanned="2">
                                       <fo:block font-family="sans-serif" font-size="9pt" text-align="center" font-weight="bold">BILIU</fo:block>
                                       <fo:block font-family="sans-serif" font-size="9pt" text-align="center" font-weight="bold">umol/l</fo:block>
                                  </fo:table-cell>
                                  <fo:table-cell border="solid black 1px" border-collapse="collapse" number-columns-spanned="2">
                                       <fo:block font-family="sans-serif" font-size="9pt" text-align="center" font-weight="bold">ERYU</fo:block>
                                       <fo:block font-family="sans-serif" font-size="9pt" text-align="center" font-weight="bold">per ul</fo:block>
                                  </fo:table-cell>
                                  <fo:table-cell border="solid black 1px" border-collapse="collapse" number-columns-spanned="2">
                                       <fo:block font-family="sans-serif" font-size="9pt" text-align="center" font-weight="bold">LEUU</fo:block>
                                       <fo:block font-family="sans-serif" font-size="9pt" text-align="center" font-weight="bold">per ul</fo:block>
                                  </fo:table-cell>
                                  <fo:table-cell border="solid black 1px" border-collapse="collapse" number-columns-spanned="2">
                                       <fo:block font-family="sans-serif" font-size="9pt" text-align="center" font-weight="bold">GLUHI</fo:block>
                                       <fo:block font-family="sans-serif" font-size="9pt" text-align="center" font-weight="bold">umol/l</fo:block>
                                  </fo:table-cell>
                             </fo:table-row>
                        </fo:table-header>
                        <fo:table-body>
                             <fo:table-row>
                                  <fo:table-cell border="solid black 1px" border-collapse="collapse" number-columns-spanned="1">
                                       <fo:block font-family="sans-serif" font-size="9pt" text-align="center">1</fo:block>
                                  </fo:table-cell>
                                  <fo:table-cell border="solid black 1px" border-end-style="none" border-collapse="collapse" number-columns-spanned="1">
                                       <fo:block font-family="sans-serif" font-size="9pt" text-align="right">6.8</fo:block>
                                  </fo:table-cell>
                                  <fo:table-cell border="solid black 1px" border-start-style="none" border-collapse="collapse" number-columns-spanned="1">
                                       <fo:block font-family="sans-serif" font-size="9pt" text-align="left"/>
                                  </fo:table-cell>
                                  <fo:table-cell border="solid black 1px" border-end-style="none" border-collapse="collapse" number-columns-spanned="1">
                                       <fo:block font-family="sans-serif" font-size="9pt" text-align="right">7.210</fo:block>
                                  </fo:table-cell>
                                  <fo:table-cell border="solid black 1px" border-start-style="none" border-collapse="collapse" number-columns-spanned="1">
                                       <fo:block font-family="sans-serif" font-size="9pt" text-align="left"/>
                                  </fo:table-cell>
                                  <fo:table-cell border="solid black 1px" border-end-style="none" border-collapse="collapse" number-columns-spanned="1">
                                       <fo:block font-family="sans-serif" font-size="9pt" text-align="right">3.00</fo:block>
                                  </fo:table-cell>
                                  <fo:table-cell border="solid black 1px" border-start-style="none" border-collapse="collapse" number-columns-spanned="1">
                                       <fo:block font-family="sans-serif" font-size="9pt" text-align="left"/>
                                  </fo:table-cell>
                                  <fo:table-cell border="solid black 1px" border-end-style="none" border-collapse="collapse" number-columns-spanned="1">
                                       <fo:block font-family="sans-serif" font-size="9pt" text-align="right">22.00</fo:block>
                                  </fo:table-cell>
                                  <fo:table-cell border="solid black 1px" border-start-style="none" border-collapse="collapse" number-columns-spanned="1">
                                       <fo:block font-family="sans-serif" font-size="9pt" text-align="left"/>
                                  </fo:table-cell>
                             </fo:table-row>
                             <fo:table-row>
                                  <fo:table-cell border="solid black 1px" border-collapse="collapse" number-columns-spanned="1">
                                       <fo:block font-family="sans-serif" font-size="9pt" text-align="center">2</fo:block>
                                  </fo:table-cell>
                                  <fo:table-cell border="solid black 1px" border-end-style="none" border-collapse="collapse" number-columns-spanned="1">
                                       <fo:block font-family="sans-serif" font-size="9pt" text-align="right">8.2</fo:block>
                                  </fo:table-cell>
                                  <fo:table-cell border="solid black 1px" border-start-style="none" border-collapse="collapse" number-columns-spanned="1">
                                       <fo:block font-family="sans-serif" font-size="9pt" text-align="left"/>
                                  </fo:table-cell>
                                  <fo:table-cell border="solid black 1px" border-end-style="none" border-collapse="collapse" number-columns-spanned="1">
                                       <fo:block font-family="sans-serif" font-size="9pt" text-align="right">45.000</fo:block>
                                  </fo:table-cell>
                                  <fo:table-cell border="solid black 1px" border-start-style="none" border-collapse="collapse" number-columns-spanned="1">
                                       <fo:block font-family="sans-serif" font-size="9pt" text-align="left">**</fo:block>
                                  </fo:table-cell>
                                  <fo:table-cell border="solid black 1px" border-end-style="none" border-collapse="collapse" number-columns-spanned="1">
                                       <fo:block font-family="sans-serif" font-size="9pt" text-align="right">3.00</fo:block>
                                  </fo:table-cell>
                                  <fo:table-cell border="solid black 1px" border-start-style="none" border-collapse="collapse" number-columns-spanned="1">
                                       <fo:block font-family="sans-serif" font-size="9pt" text-align="left"/>
                                  </fo:table-cell>
                                  <fo:table-cell border="solid black 1px" border-end-style="none" border-collapse="collapse" number-columns-spanned="1">
                                       <fo:block font-family="sans-serif" font-size="9pt" text-align="right">5.12</fo:block>
                                  </fo:table-cell>
                                  <fo:table-cell border="solid black 1px" border-start-style="none" border-collapse="collapse" number-columns-spanned="1">
                                       <fo:block font-family="sans-serif" font-size="9pt" text-align="left"/>
                                  </fo:table-cell>
                             </fo:table-row>
                             <fo:table-row>
                                  <fo:table-cell border="solid black 1px" border-collapse="collapse" number-columns-spanned="1">
                                       <fo:block font-family="sans-serif" font-size="9pt" text-align="center">3</fo:block>
                                  </fo:table-cell>
                                  <fo:table-cell border="solid black 1px" border-end-style="none" border-collapse="collapse" number-columns-spanned="1">
                                       <fo:block font-family="sans-serif" font-size="9pt" text-align="right">-</fo:block>
                                  </fo:table-cell>
                                  <fo:table-cell border="solid black 1px" border-start-style="none" border-collapse="collapse" number-columns-spanned="1">
                                       <fo:block font-family="sans-serif" font-size="9pt" text-align="left">*</fo:block>
                                  </fo:table-cell>
                                  <fo:table-cell border="solid black 1px" border-end-style="none" border-collapse="collapse" number-columns-spanned="1">
                                       <fo:block font-family="sans-serif" font-size="9pt" text-align="right">-</fo:block>
                                  </fo:table-cell>
                                  <fo:table-cell border="solid black 1px" border-start-style="none" border-collapse="collapse" number-columns-spanned="1">
                                       <fo:block font-family="sans-serif" font-size="9pt" text-align="left"/>
                                  </fo:table-cell>
                                  <fo:table-cell border="solid black 1px" border-end-style="none" border-collapse="collapse" number-columns-spanned="1">
                                       <fo:block font-family="sans-serif" font-size="9pt" text-align="right">-</fo:block>
                                  </fo:table-cell>
                                  <fo:table-cell border="solid black 1px" border-start-style="none" border-collapse="collapse" number-columns-spanned="1">
                                       <fo:block font-family="sans-serif" font-size="9pt" text-align="left"/>
                                  </fo:table-cell>
                                  <fo:table-cell border="solid black 1px" border-end-style="none" border-collapse="collapse" number-columns-spanned="1">
                                       <fo:block font-family="sans-serif" font-size="9pt" text-align="right">-</fo:block>
                                  </fo:table-cell>
                                  <fo:table-cell border="solid black 1px" border-start-style="none" border-collapse="collapse" number-columns-spanned="1">
                                       <fo:block font-family="sans-serif" font-size="9pt" text-align="left"/>
                                  </fo:table-cell>
                             </fo:table-row>
                             <fo:table-row>
                                  <fo:table-cell border="solid black 1px" border-collapse="collapse" number-columns-spanned="1">
                                       <fo:block font-family="sans-serif" font-size="9pt" text-align="center">4</fo:block>
                                  </fo:table-cell>
                                  <fo:table-cell border="solid black 1px" border-end-style="none" border-collapse="collapse" number-columns-spanned="1">
                                       <fo:block font-family="sans-serif" font-size="9pt" text-align="right">62.1</fo:block>
                                  </fo:table-cell>
                                  <fo:table-cell border="solid black 1px" border-start-style="none" border-collapse="collapse" number-columns-spanned="1">
                                       <fo:block font-family="sans-serif" font-size="9pt" text-align="left"/>
                                  </fo:table-cell>
                                  <fo:table-cell border="solid black 1px" border-end-style="none" border-collapse="collapse" number-columns-spanned="1">
                                       <fo:block font-family="sans-serif" font-size="9pt" text-align="right">1234.000</fo:block>
                                  </fo:table-cell>
                                  <fo:table-cell border="solid black 1px" border-start-style="none" border-collapse="collapse" number-columns-spanned="1">
                                       <fo:block font-family="sans-serif" font-size="9pt" text-align="left"/>
                                  </fo:table-cell>
                                  <fo:table-cell border="solid black 1px" border-end-style="none" border-collapse="collapse" number-columns-spanned="1">
                                       <fo:block font-family="sans-serif" font-size="9pt" text-align="right">354.39</fo:block>
                                  </fo:table-cell>
                                  <fo:table-cell border="solid black 1px" border-start-style="none" border-collapse="collapse" number-columns-spanned="1">
                                       <fo:block font-family="sans-serif" font-size="9pt" text-align="left"/>
                                  </fo:table-cell>
                                  <fo:table-cell border="solid black 1px" border-end-style="none" border-collapse="collapse" number-columns-spanned="1">
                                       <fo:block font-family="sans-serif" font-size="9pt" text-align="right">23.14</fo:block>
                                  </fo:table-cell>
                                  <fo:table-cell border="solid black 1px" border-start-style="none" border-collapse="collapse" number-columns-spanned="1">
                                       <fo:block font-family="sans-serif" font-size="9pt" text-align="left">***</fo:block>
                                  </fo:table-cell>
                             </fo:table-row>
                             <fo:table-row>
                                  <fo:table-cell border="solid black 1px" border-collapse="collapse" number-columns-spanned="1">
                                       <fo:block font-family="sans-serif" font-size="9pt" text-align="center">5</fo:block>
                                  </fo:table-cell>
                                  <fo:table-cell border="solid black 1px" border-end-style="none" border-collapse="collapse" number-columns-spanned="1">
                                       <fo:block font-family="sans-serif" font-size="9pt" text-align="right">215.9</fo:block>
                                  </fo:table-cell>
                                  <fo:table-cell border="solid black 1px" border-start-style="none" border-collapse="collapse" number-columns-spanned="1">
                                       <fo:block font-family="sans-serif" font-size="9pt" text-align="left"/>
                                  </fo:table-cell>
                                  <fo:table-cell border="solid black 1px" border-end-style="none" border-collapse="collapse" number-columns-spanned="1">
                                       <fo:block font-family="sans-serif" font-size="9pt" text-align="right">326.580</fo:block>
                                  </fo:table-cell>
                                  <fo:table-cell border="solid black 1px" border-start-style="none" border-collapse="collapse" number-columns-spanned="1">
                                       <fo:block font-family="sans-serif" font-size="9pt" text-align="left"/>
                                  </fo:table-cell>
                                  <fo:table-cell border="solid black 1px" border-end-style="none" border-collapse="collapse" number-columns-spanned="1">
                                       <fo:block font-family="sans-serif" font-size="9pt" text-align="right">3254.24</fo:block>
                                  </fo:table-cell>
                                  <fo:table-cell border="solid black 1px" border-start-style="none" border-collapse="collapse" number-columns-spanned="1">
                                       <fo:block font-family="sans-serif" font-size="9pt" text-align="left"/>
                                  </fo:table-cell>
                                  <fo:table-cell border="solid black 1px" border-end-style="none" border-collapse="collapse" number-columns-spanned="1">
                                       <fo:block font-family="sans-serif" font-size="9pt" text-align="right">576.26</fo:block>
                                  </fo:table-cell>
                                  <fo:table-cell border="solid black 1px" border-start-style="none" border-collapse="collapse" number-columns-spanned="1">
                                       <fo:block font-family="sans-serif" font-size="9pt" text-align="left"/>
                                  </fo:table-cell>
                             </fo:table-row>
                             <fo:table-row>
                                  <fo:table-cell border="solid black 1px" border-collapse="collapse" number-columns-spanned="1">
                                       <fo:block font-family="sans-serif" font-size="9pt" text-align="center">6</fo:block>
                                  </fo:table-cell>
                                  <fo:table-cell border="solid black 1px" border-end-style="none" border-collapse="collapse" number-columns-spanned="1">
                                       <fo:block font-family="sans-serif" font-size="9pt" text-align="right">12.7</fo:block>
                                  </fo:table-cell>
                                  <fo:table-cell border="solid black 1px" border-start-style="none" border-collapse="collapse" number-columns-spanned="1">
                                       <fo:block font-family="sans-serif" font-size="9pt" text-align="left"/>
                                  </fo:table-cell>
                                  <fo:table-cell border="solid black 1px" border-end-style="none" border-collapse="collapse" number-columns-spanned="1">
                                       <fo:block font-family="sans-serif" font-size="9pt" text-align="right">3.658</fo:block>
                                  </fo:table-cell>
                                  <fo:table-cell border="solid black 1px" border-start-style="none" border-collapse="collapse" number-columns-spanned="1">
                                       <fo:block font-family="sans-serif" font-size="9pt" text-align="left"/>
                                  </fo:table-cell>
                                  <fo:table-cell border="solid black 1px" border-end-style="none" border-collapse="collapse" number-columns-spanned="1">
                                       <fo:block font-family="sans-serif" font-size="9pt" text-align="right">1256.32</fo:block>
                                  </fo:table-cell>
                                  <fo:table-cell border="solid black 1px" border-start-style="none" border-collapse="collapse" number-columns-spanned="1">
                                       <fo:block font-family="sans-serif" font-size="9pt" text-align="left"/>
                                  </fo:table-cell>
                                  <fo:table-cell border="solid black 1px" border-end-style="none" border-collapse="collapse" number-columns-spanned="1">
                                       <fo:block font-family="sans-serif" font-size="9pt" text-align="right">3621.00</fo:block>
                                  </fo:table-cell>
                                  <fo:table-cell border="solid black 1px" border-start-style="none" border-collapse="collapse" number-columns-spanned="1">
                                       <fo:block font-family="sans-serif" font-size="9pt" text-align="left"/>
                                  </fo:table-cell>
                             </fo:table-row>
                             <fo:table-row>
                                  <fo:table-cell border="solid black 1px" border-collapse="collapse" number-columns-spanned="1">
                                       <fo:block font-family="sans-serif" font-size="9pt" text-align="center">7</fo:block>
                                  </fo:table-cell>
                                  <fo:table-cell border="solid black 1px" border-end-style="none" border-collapse="collapse" number-columns-spanned="1">
                                       <fo:block font-family="sans-serif" font-size="9pt" text-align="right">3.6</fo:block>
                                  </fo:table-cell>
                                  <fo:table-cell border="solid black 1px" border-start-style="none" border-collapse="collapse" number-columns-spanned="1">
                                       <fo:block font-family="sans-serif" font-size="9pt" text-align="left"/>
                                  </fo:table-cell>
                                  <fo:table-cell border="solid black 1px" border-end-style="none" border-collapse="collapse" number-columns-spanned="1">
                                       <fo:block font-family="sans-serif" font-size="9pt" text-align="right">123.540</fo:block>
                                  </fo:table-cell>
                                  <fo:table-cell border="solid black 1px" border-start-style="none" border-collapse="collapse" number-columns-spanned="1">
                                       <fo:block font-family="sans-serif" font-size="9pt" text-align="left"/>
                                  </fo:table-cell>
                                  <fo:table-cell border="solid black 1px" border-end-style="none" border-collapse="collapse" number-columns-spanned="1">
                                       <fo:block font-family="sans-serif" font-size="9pt" text-align="right">326.54</fo:block>
                                  </fo:table-cell>
                                  <fo:table-cell border="solid black 1px" border-start-style="none" border-collapse="collapse" number-columns-spanned="1">
                                       <fo:block font-family="sans-serif" font-size="9pt" text-align="left"/>
                                  </fo:table-cell>
                                  <fo:table-cell border="solid black 1px" border-end-style="none" border-collapse="collapse" number-columns-spanned="1">
                                       <fo:block font-family="sans-serif" font-size="9pt" text-align="right">0.37</fo:block>
                                  </fo:table-cell>
                                  <fo:table-cell border="solid black 1px" border-start-style="none" border-collapse="collapse" number-columns-spanned="1">
                                       <fo:block font-family="sans-serif" font-size="9pt" text-align="left"/>
                                  </fo:table-cell>
                             </fo:table-row>
                        </fo:table-body>
                   </fo:table>

  • Table cell with 2 colors

    Hi Guys,
    I have a JTable which I need its cells to have 2 colors (indicating different type of data for the same cell). I could not find a way to do this. Anyone can help me out here?
    Thanks in advance
    Eman

    PhHein wrote:
    eman_c wrote:
    Hi,
    I already checked that page, and as far as i understood (and please correct me if I am wrong) the renderer lets you control one cell (which is great) but one cell can be applied with one ForGround color. What I needed is that in the same cell, part of the data is colored red for example and the other in green. If it is indeed possible using cell render, could you please explain how?
    Thanks again
    EmanSorry, I don't think it is possible at all to have different background colors in one cell. But you could however set different text colors in the same cell by using html.Err...
    import java.awt.*;
    import java.awt.event.*;
    import javax.swing.*;
    import javax.swing.table.*;
    import java.util.*;
    import java.util.regex.*;
    import java.text.*;
    public class ShadeCellDependingOnValue extends JPanel
        static final Object[][] tableData =
            {1, new Double(10.0)},
            {2, new Double(20.0)},
            {3, new Double(50.0)},
            {4, new Double(10.0)},
            {5, new Double(95.0)},
            {6, new Double(60.0)},
        static final Object[] headers =
            "One",
            "Two",
        public ShadeCellDependingOnValue() throws Exception
            super(new BorderLayout());
            final DefaultTableModel model = new DefaultTableModel(tableData, headers);
            final JTable table = new JTable(model);
            table.getColumnModel().getColumn(1).setCellRenderer( new LocalCellRenderer(120.0));
            add(table);
            add(table.getTableHeader(), BorderLayout.NORTH);
        public class LocalCellRenderer extends DefaultTableCellRenderer
            private double v = 0.0;
            private double maxV;
            private final JPanel renderer = new JPanel(new GridLayout(1,0))
                public void paintComponent(Graphics g)
                    super.paintComponent(g);
                    g.setColor(Color.CYAN);
                    int w = (int)(getWidth() * v / maxV + 0.5);
                    int h = getHeight();
                    g.fillRect(0, 0, w, h);
                    g.drawRect(0, 0, w, h);
            private LocalCellRenderer(double maxV)
                this.maxV = maxV;
                renderer.add(this);
                renderer.setOpaque(true);
                renderer.setBackground(Color.YELLOW);
                renderer.setBorder(null);
                setOpaque(false);
                setHorizontalAlignment(JLabel.CENTER);
            public Component getTableCellRendererComponent(JTable table, Object value, boolean isSelected, boolean hasFocus, int row, int col)
                super.getTableCellRendererComponent(table, value, isSelected, hasFocus, row, col);
                if (value instanceof Double)
                    v = ((Double)value).doubleValue();
                return renderer;
        public static void main(String[] args) throws Exception
            final JFrame frame = new JFrame("Fred120");
            frame.setDefaultCloseOperation(JFrame.EXIT_ON_CLOSE);
            frame.setContentPane(new ShadeCellDependingOnValue());
            frame.pack();
            frame.setLocationRelativeTo(null);
            frame.setVisible(true);
    }

  • Fill table cells with color % depending on cell content

    Hi.
    I'm working on a document with a lot of tables filled with percentages. The tables are originally on a Word document and the table cells are tinted according to their content: a value of 20% on the cell corresponds to a tint of 20%. This is done automatically on the Word document through a conditional formatting option that applies a graded color scale. Is there any way to do this in InDesign? I tried placing the tables and tried all options, but the color is not imported. Perhaps a script or a GREP style?
    Thank you.

    Conditional formatting in Word is done via formula, but in Excel it is handled more "on the surface" and Excel's conditional formatting carries into InDesign nicely via Place or Paste. It could be worth considering moving those tables into Excel.
    InDesign doesn't do this kind of formatting as a native function, but it couldn't hurt to ask about possible scripted solutions in the Scripting Forum.

  • Coloring an ALV Cell with DYNAMIC INTERNAL TABLES

    Hello Gurus,
    I need your help regarding coloring of a cell in my ALV Grid report with DYNAMIC tables.
    I have used the call method in calling my ALV. (CALL METHOD gr_alvgrid->set_table_for_first_display).
    Now my problem is, I can not bring out the cellcolor succesfully, I always ended up to dump (GETWA_NOT_ASSIGNED = You attempted to access an unassigned field symbol     
    (data segment 32807).                                  
    What I have done:
    I've created 2 internal tables:
    *1st table
    *After appended all of my columns to  gt_fieldcat
      CALL METHOD cl_alv_table_create=>create_dynamic_table
        EXPORTING
          it_fieldcatalog = gt_fieldcat
        IMPORTING
          ep_table        = gp_both.
      ASSIGN gp_both->* TO <i_xtab1>.
    *2nd table
    Appended these column for CellColor
      CLEAR wa_gtfldcat.
      wa_gtfldcat-fieldname = 'CELLCOLOR'.
      wa_gtfldcat-ref_table = 'CALENDAR_TYPE'.
      wa_gtfldcat-ref_field = 'COLTAB'.
      APPEND wa_gtfldcat TO gt_fieldcat.
      CALL METHOD cl_alv_table_create=>create_dynamic_table
        EXPORTING
          it_fieldcatalog = gt_fieldcat
        IMPORTING
          ep_table        = gp_alvgrid.
      ASSIGN gp_alvgrid->* TO <i_xtab2>.
    *Work Areas for tab1 and tab2
    CREATE DATA dref1 LIKE LINE OF <i_xtab1>.
      ASSIGN dref1->* TO <wa_xtab1>.
      CREATE DATA dref2 LIKE LINE OF <i_xtab2>.
      ASSIGN dref2->* TO <wa_xtab2>.
    *Move contents of table1 to table2 and modify cellcolor column
    LOOP AT <i_xtab1> ASSIGNING <wa_xtab1>.
    *-----Cell color assignment
        DESCRIBE TABLE gt_fieldcat.
        DO sy-tfill TIMES.
          READ TABLE gt_fieldcat INTO wa_gtfldcat INDEX sy-index.
          ASSIGN COMPONENT wa_gtfldcat-fieldname
            OF STRUCTURE <wa_xtab1> TO <fs4>.
          IF sy-subrc NE 0. EXIT .ENDIF.
          ASSIGN COMPONENT wa_gtfldcat-fieldname
            OF STRUCTURE <wa_xtab2> TO <fs3>.
          IF sy-subrc NE 0. EXIT .ENDIF.
            <fs3> = <fs4>.
        ENDDO.
        ASSIGN COMPONENT 'CELLCOLOR' OF STRUCTURE <wa_xtab2> TO <fs3>.
        IF sy-subrc = 0.
          PERFORM modify_cell_color USING 'ZZMATNR' <fs3>.
        ENDIF.
        APPEND <wa_xtab1> TO <i_xtab2>.
    ENDLOOP.
    *Call ALV
    gs_layout-ctab_fname = 'COLORCELL'
        CALL METHOD gr_alvgrid->set_table_for_first_display
          EXPORTING
            is_layout                     = gs_layout
          CHANGING
            it_outtab                     = <i_xtab2d>[]
            it_fieldcatalog               = gt_fieldcat
            it_sort                       = lt_sort
          EXCEPTIONS
            invalid_parameter_combination = 1
            program_error                 = 2
            too_many_lines                = 3
            OTHERS                        = 4.
        IF sy-subrc <> 0.
    *--->Exception handling
        ENDIF.
    FORM modify_cell_color  USING p_fieldname   TYPE lvc_fname
                                  pt_cellcolor  TYPE table.
      DATA l_cellcolor TYPE lvc_s_scol.
      CLEAR l_cellcolor.
      l_cellcolor-fname = p_fieldname.
      l_cellcolor-color-col = 6.       " Red.
      l_cellcolor-color-int = 0.
      l_cellcolor-color-inv = 0.
      INSERT l_cellcolor INTO TABLE pt_cellcolor.
    ENDFORM.                    " MODIFY_CELL_COLOR

    Hi,
    The internal tabl which you are using to display the output should have one column in the end.
    The cell in this column will contain an internal table of type 'lvc_s_scol'.
    The contents of this internal table will be the field names of all other columns of your main internal table in the field FNAME and the required color in the field COLOR.
    Please note that the field COLOR will have a hex value for different colors.
    In the stucture is_layout  whihc you pass to the method 'set_table_for_first_display'
    the name of this last column should be given to the field 'ctab_fname'.
    This will help you to give the colors to each cell.
    for example
    I have my data table as follows:-
    ITAB1
    MATNR  MAKTX        COLOR_TAB
    1           ABC            FNAME  COLOR  NOKEYCOL
                                    MATNR 8000
                                    MAKTX 8000
    2          XYZ             MATNR 10000
                                  MAKTX  10000
    So my internal table ITAB1 had 3 columns MATNR MAKTX and COLOR_TAB.
    And COLOR_TAB will contain an internal table with 3 columns FNAME COLOR and NOKEYCOL.
    The value to importing parameter IS_LAYOUT-CTAB_FNAME will be COLOR_TAB.
    This will help you to assign various colors to the cell of the internal table ITAB.
    When you have to change any color, then you will have to just change the entries in cell COLOR_TAB for the particular row and cell.
    Regards,
    Ankur Parab

  • Need Help with giving Colors to Table Cells and Table Borders in Dreamweaver CC - Please!

    Hi,
    I am a teacher and use Dreamweaver CC to make my class web page.
    How do I give colors to the cell borders of a table I inserted?  How do I give colors and line thickness
    to table borders, too?
    I bought the David Powers DVD and it doesn't show that.
    Please help.
    Thank you,
    John

    Assuming that you have placed a table in your document and your CSS Designer panel is open
    1. Click the '+' sign
    2. Choose your option. I will choose 'Define in Page'
    3. Follow the above sequence, 1.click on table, 2.ensure table is selected, 3.click on style, 4.click the '+' sign, 5. see the selector appear.
    4. Click on the selector and choose the required Properties.
    You can do the same for the row (<tr>) or a cell (<td>). In fact, this is how you would go about styling anything in your document.

  • Rendering of table cell with jcheckbox in cloumn.

    Hi
                   table.getColumn("Select").setCellEditor(new DefaultCellEditor(new JCheckBox()));
                   table.getColumnModel().getColumn(1).setPreferredWidth(10);
                   table.getColumnModel().getColumn(1).setCellRenderer( new DefaultTableCellRenderer(){
                        public Component getTableCellRendererComponent(JTable table, Object value, boolean isSelected, boolean hasFocus, int row, int column) {
                             if(value.equals(false) )
                                  chkBox.setSelected(false);
                             else{
                                  chkBox.setSelected(true);
                             setOpaque(true);
                             setBackground(Color.WHITE);
                             setHorizontalAlignment(JCheckBox.CENTER);
                             return chkBox;
                        }i have put a checkbox in a table cell. now i am not able to set the alignment to center and background as white.
    can anyone tell me what i am missing.
    i have checked many places , they seem to do the same thing. but couldnt see anything where component is checkbox. Can anybody help ?
    thanks

    now i am not able to set the alignment to center and background as whiteSwing related questions should be posted in the Swing forum.
    But there is no need to repost your question because all you need to do is
    read the JTable API and follow the link to the Swing tutorial on "How to Use Tables"
    where you have a working example because your requirement is the default behaviour.

  • How to control background color of table cell in an html report?

    I am using Labview 6.1 to generate a report.  In that report there is a table created using the Append Numeric Table to Report VI.  I want to be able to programmatically control the background color of each cell in the table.  Also, how can I programmatically control the background color of the row and header cells of the same table.  I am also generating a second table in the same report using the Append Text Table to Report VI and I would like to programmatically control the background colors of the cells in that table as well.  Thanks.

    Hi epsilon-d...,
    i´m not sure if there is an ready to use function to do what you want, but you can enlarge the available function. Open the "Append Numeric Table to Report.vi" and go to the HTML Case. There you can see another vi which creates the html table. In the VI "HTML Report Table Row" you can add the option: bgcolor="your color" inside of the "TR" tag.
    Hope it helps.
    Mike

  • Table Cells with dotted or dashed borders

    I created a table and to a number of cells created either dashed or dotted borders of various sizes. When I create a PDF, the dashed and dotted lines only show up as shaded lines. I have tried changing a number of PDF settings and still no luck. Can anyone help? I am working in FrameMaker 10 and Acrobat XI Pro.

    > ... a way to create a border for a table cell that has a dotted or dashed line?
    If you don't need FM access to cell contents (variables, xrefs, list-of-Tables, etc.), consider doing the tables in a spreadsheet. If the data originates in a spreadsheet, of course, it's usually not worth the effort to transfer the cell data to FM tables anyway, if only due to the risk of transcription error.
    LibreOffice or OpenOffice "calc", for example, have many more border/cell options than FM, and can trivially Export Selection to PDF. FM then imports the PDF. Although FM hasn't access to the cell text, it is worth noting that it will be full-text searchable/selectable in the PDF, and not just a graphic. The visible preview image during FM edit is low res (72 dpi) however, unless you use scaling tricks.
    MS Excel might also work for this data flow. I only ever use it to re-save a .xls or .xlsx to .ods. What little playing around with it I've tried suggests that rendering a print region to PDF might work, but I don't see any quick way to export selections.
    In FM versions earlier than 8, convert such PDFs to EPS using Illustrator or Acrobat Pro. PDF import is unstable in 7x and earlier. We have an AI batch process set up for this, and doing tables this way is easily worth this extra step.

  • Can't vertically center text within a table cell with a picture next to it

    I have a table and each cell has a picture in it (which was "cut" from another part of the document and "pasted" into the cells). Next to it, I typed a few words. I want the words to be centered vertically within the cell. However, everytime I click on the vertical centering in the inspector, it moves the picture and the text remains at the very bottom of the cell. The text is "tied" to the picture. I've tried everything... highlighting the text, same thing. Can't figure it out!! Is there any way to do this without inserting text boxes??

    Vertical align works on text within text boxes and within table cells.
    I have just checked this using a table with:
    *1st cell* Inline Picture with caption under. Cell sizes to fit
    *2nd cell* Same as first, picture scaled down. Text and image centre vertically.
    *3rd cell* Caption only, vertically centred.
    It works and I have wrap turn off on the image, before I pasted it in.
    On rereading the O.P.'s post it seems to be saying contradictory things. That the text is "tied to the picture" which is what you would expect of inline graphics and that the text is stuck in the bottom the cell.
    Without a picture and a better description of the problem we are none the wiser.
    I am just guessing but perhaps the O.P. has the image and Inline graphic on the same line and can't understand why the bottom of the text and the bottom of the image are aligned.
    If this is the case it is a misunderstanding of what inline graphic means. The image acts just like a character in the text and sits on the text baseline, it is not an independent object.
    It is possible to shift text next to the image or the image itself by selecting either and altering:
    +Inspector > Text > More > Baseline Shift+
    But frankly you would be better separating the 2 and putting the text in the cell to the left or right of the image.
    Peter

  • Grep: How to fill a table cell with certain color

    I have an excel sheet with 5000 rows that needs to be formatted in Indesign.
    1. Is there a way to get a certain color fill of the cell depending on text. Lets say if the text is "apple", the cell should fill with red (and text also color red to make it disappear).
    2. How do I make two different character styles to appear in the same cell (information is tab-separeted but sometimes I would like to have 2 "paragraphs" in one cell sometimes – with that I mean two tab-delimited cells from excel to appear in ONE cell in indesign).
    Thanks in advance
    Example of what I would like to accomplish:  http://tinypic.com/r/vo4och/6

    Yes but wouldn't that make the field contain a string?
    I tried something like that, and every field I edit becomes left-justified, and String (instead of int, float which is right-justified)
    Matthew

  • ABAP WebDynpro: Table cells with different values.

    Hello,
    I am not sure how the following can be achieved.
    I have a table with 10 rows in it. First column should have different values in cells (static value that do not come from anywhere). For example, colors: black, green, yellow, etc.
    I inserted a table column. In that column I inserted a Cell Editor of type TextView. If I define a 'text' property of this element than it marks all cells in this column with this text. I need to assign different values to each cell.
    How can this be done?
    Thank you.

    Probably you should post this the Web Dynpro Forum
    Web Dynpro Java
    Regards,
    Ravi
    Note : Please close this thread.

  • How to color single column cells with different colors in classic report based different conditions

    Hi ,
      Am working on Oracle Apex 4.2 version. Am trying to generate a  classic report with different cell colors based on the conditions.
      I tried the solution provided in the below link.
      https://forums.oracle.com/message/9518723#9518723.
      I tried the same query given in that link.
       SELECT e.*,
      CASE
        WHEN sal < 1000
        THEN 'red'
        WHEN sal BETWEEN 1000 AND 2000
        THEN 'yellow'
        WHEN sal > 2000
        THEN 'green'
      END the_color
    FROM emp e
      And, I hidded the column 'the_color' in Report Attributes,
              the Column Template1 has the code , <td #ALIGNMENT# headers="#COLUMN_HEADER_NAME#">#COLUMN_VALUE#</td>.
    After this, what are the steps did I miss here. Because am not getting the report which I need.
    Kindly do provide solution.
    Thanks,
    yashu.

    SAL column values should visible with different color based on the conditions. Same way i did in my report it was working for me. Please refer the below links for more information,
    https://forums.oracle.com/thread/1047891
    http://dbswh.webhop.net/htmldb/f?p=BLOG:READ:0::::ARTICLE:351800346145832
    Thanks
    Lakshmi

Maybe you are looking for