Dynamic size of column header

How do I make the header row of a column in a Jtable to dynamically adjust it's size to it's contents??
Need this
|HEADER COL1||HEADER COL2.....|H C3|
Have this
|HEADER C||HEADER C|H C3|
Thanks!

You need to get the column model and each column in turn and then set the width there.

Similar Messages

  • How to change the font size of Column Heading  in webdynpro java

    Hi,
    I have a table with 4 columns, Can any one tell me how can i increase the text size and apply different fonts in webdynpro java application.
    Thanks
    Satish J

    Hi Satish,
    To expain it bit more clearly.
    Copy the images you need to use in the application
    Open your application in package explorer<Navigator>
    Now Expend node  src -> mimes -> components -> your application name with full package now right click on it and paste all the images here.
    Now go to web Dynpro prospective and use the  image name  (full name of image like columnName.jpg )to assign it to imageSource  property of the  Table_Header (Caption Header). The image will be seen.
    Hope this will clarify.
    Regards
    Narendra

  • Dynamically generate the Column header

    Hi friends,
    I am using Binary Cache method for Export to Excel. I am using a separate method for generating the column headers. My question is : Is there a way to put the attribute names from the node directly instead of the one I am currently using.
      public java.util.Map getOrderColumnInfos( )
        //@@begin getOrderColumnInfos()
              //     Returns Header for the Table to be passed on to method toExcel()
              Map columnInfosMap = new LinkedHashMap();          
    columnInfosMap.put(
                   IPrivateABC.ISearchResultstoExcelElement.ATTRIBUTE1,
                   "Name");
              columnInfosMap.put(
                   IPrivateABCSearchResultstoExcelElement.ATTRIBUTE2,
                   "Reference");
              columnInfosMap.put(
                   IPrivateABC.ISearchResultstoExcelElement.ATTRIBUTE3,
                   "Created By");
              columnInfosMap.put(
                   IPrivateABC.ISearchResultstoExcelElement.ATTRIBUTE4,
                   "Input Date");
              return columnInfosMap;
        //@@end
    Instead of putting the header texts, I want the attribute names to be displayed on the Excel file headers. Please let me know if this is possible.

    Hello Rasim,
    The idea was to create the Column headers dynamically. This means basically at runtime the Application would recognize what is there in the screen and use it for Column headers. This involved reading the from the View Table->The Table Column Element-> The header and saving those values in a Context. This context is then mapped to the Excel Custom Controller and then all we have to do is read from the context, Convert to XML (The usual way that is.... )
    And ...There it is....!!!!
    Bit hectic to code this than the obvious Map and stuff. But it saves a lot of headache for future additions/deletions of columns to the table.
    Sample Code :
      public void populateExcelColumnsFromView( java.lang.String tableName, com.sap.tc.webdynpro.progmodel.api.IWDView view )
        //@@begin populateExcelColumnsFromView()
              //Created By : AVIK SANYAL Date : 28 March 2008
              //This method will fetch the header names from the Table in the View and set the
              // Attributes in nodeExcelTableColumns(). These nodes are mapped to
              //Excel Custom Controller and hence used to set the Column headers for the Excel File.
              IWDTable searchTable = (IWDTable) view.getElement(tableName);
              wdContext.nodeExcelTableColumns().invalidate();
              String tableDataSource = searchTable.bindingOfDataSource();
              wdContext.currentContextElement().setDataSource(tableDataSource);
              for (int i = 0; i < searchTable.numberOfGroupedColumns(); i++) {
                   //               Read the Column
                   IWDTableColumn col =
                        (IWDTableColumn) searchTable.getGroupedColumn(i);
                   IWDTableCellEditor TCE = col.getTableCellEditor();
                   IWDCaption header = col.getHeader();
                   //               This will check if the column is visible in the View only then it will
                   //               go for further processing.
                   if (WDVisibility.VISIBLE.equals(col.getVisible())) {
                        IExcelTableColumnsElement columnElement =
                             wdContext
                                  .nodeExcelTableColumns()
                                  .createExcelTableColumnsElement();
                        //               If the header is not null then set the header as in the View
                        if (header != null) {
                             columnElement.setHeading(header.getText());
                        } else {
                        //               Add the column name to the nodeExcelTableColumns()
                        //This checks the type of column in the View and then take the value.
                        if (TCE != null) {
                             if (TCE instanceof IWDTextView) {
                                  IWDTextView element = (IWDTextView) TCE;
                                  columnElement.setBinding(element.bindingOfText());
                                  wdContext.nodeExcelTableColumns().addElement(
                                       columnElement);
        //@@end

  • Dynamic values for column header / "AS" using XMLFOREST

    Hello,
    I was wondering if it was possible to show data from a select statement into an AS column, e.g. SELECT col.a AS col.b.
    The reason I need this is for XMLFOREST, as I need the value of a SELECT statement to be the column name, so that it will be the value of the element. e.g. <col.b></col.b>
    Anyone know if/how I can do this?

    SQL> ed
    Wrote file afiedt.buf
      1  WITH t AS (SELECT 'fred' name FROM DUAL UNION SELECT 'bob' FROM DUAL)
      2* SELECT XMLELEMENT(EVALNAME name, name) FROM t
    SQL> /
    ERROR:
    ORA-19039: Keyword EVALNAME reserved for future use
    no rows selected
    SQL> ed
    Wrote file afiedt.buf**** Throws a bit of magic dust into SQL...... ****
    SQL> WITH t AS (SELECT 'fred' name FROM DUAL UNION SELECT 'bob' FROM DUAL)
      2  SELECT XMLELEMENT(EVALNAME name, name) FROM t
      3  /
    XMLELEMENT(EVALNAMENAME,NAME)
    <bob>bob</bob>
    <fred>fred</fred>
    SQL>This is an example of what you'll be able to do with 10.2.0.2 when it's released

  • Changing the Column Header and Hiding the Column dynamically???

    Hi friends..
    I'm new to OBIEE field. I'm working in a OBIEE project that requires to dynamically change the column header, and dynamically hide the column depending on the prompt value.
    I know we can dynamically change the table header using the presentation variable but I couldn't do that same thing with column header.
    I searched some forums that suggest to use java script for this purpose but I'm not able to do the same also. If anyone had same issue before please help.

    toony, I'm not sure it's possible to do all that you want exactly the way you want, but here are some ideas you can pursue.
    To dynamically change column headers without javascript, check this blog out...
    http://oraclebizint.wordpress.com/2008/01/25/oracle-bi-ee-101332-dynamic-column-headers-using-presentation-variables-sets-and-conditional-formatting/
    As far as dynamically hiding a column, I don't think you can do this, but since you don't provide any details on how the PV is supposed to hide a column based on the value, are you talking about hiding a column for one PV value and another (different) column for a different PV value? Or are you talking about hiding one column when a PV has certain values and displaying it when the PV has a different set of values?
    I have managed to create both scenarios via a work-around, but the procedures require some writing so I don't want to put both. Please detail how you want your PV to "hide" a column or columns.
    P.S. I don't think column selectors will do the trick for you. Basically column selectors work like this: Say you have a report using Sales Region ID, Region Name, and Sales. Now let's say you want the user to choose if he/she wants to see annual sales, or quarter sales or weekly sales, etc. The column selector view would allow you to put the various columns (Year Sales, Quarter Sales, Weekly Sales) as an option the user can select. Once selected, the sales figure will change for the time period selected. For an example of how this is done, check out the section in this "Oracle by Example" link.
    Waited too long to publish this... Madan beat me to it, so there is some overlap here...
    http://www.oracle.com/technology/obe/obe_bi/bi_ee_1013/saw/saw.html
    Edited by: LC143 on Oct 27, 2008 9:21 AM

  • Dynamically change column heading without Dashboard Prompt

    Hi All,
    My requirement is change the column heading dynamically in a report. I have achieved this through setting the presentation variable to the dashboard prompt.
    I have 5 columns in the dashboard prompt. Out of these 5 columns, I want to use only 1 column as dashboard prompt.
    But still I want to dynamically change the column heading of the other 4 columns based on the only 1 column selected in the dashboard prompt.
    Is there anyway to achieve this?

    You need to have some logic to change other 4 columns based on 1 selected column.. where you want put that logic?
    BTW: Check these
    http://total-bi.com/2011/03/obiee-dynamic-column-headings/
    http://rampradeeppakalapati.blogspot.com/2012/02/dynamically-change-column-names-in.html
    If helps mark or also update back if you are thru with this.

  • Show the period value in column header using Text Variable

    We are using Posting Period & Financial Year to calculate YTD & MTD, for current year and previous years. These posting period and financial year characteristics are custom created characteristics we are using due to customer specific requirement.
    Input values are posting period, financial year and numeric value. To calculate previous year, I need to subtract numeric value from the input financial year. Every thing is working fine up to this.
    In the report I need to show the posting period and financial year values dynamically in each column header of the report for MTD, YTD for current year & previous year. I tried to achieve this using Text Variables, but I didn’t succeed. If some one can give me some idea to resolve this, it would be very helpful.
    I am excellent in ABAP coding. If you can specify me to code in User Exit, I can do it.
    Column headers should be 08.1999 Sales Qty, 08.2008 Sales Qty, 1999 Sales Qty, 2008 Sales Qty.

    Hi Abhinav,
    Try using the content text variables 0T_FYEAR and 0T_FPER3, when used in the head these variable should display the year and period specified in the RKF.
    e.g
    &0T_FPER3&. &0T_FYEAR& Sales Qty = 08.1999 Sales Qty
    If that doesnt work, try creating text replacement path variables referencing the variables you created for the year and period input. To do this click on the RKF and click on the dropdown by the yellow box next to the description on the general tab and select New Variable, enter the description, tech name and set processng by to Replacment Path, then select period as the ref. characteristic, then on the replacement path tab change replace variable with to variable and then select the variable you are using for the period input, save then hit ok, this is now a text representation of the variable your are inputing for period and can be used in the column headers, you will need to repeat the process for the fiscal year.
    Hope this helps
    Josh

  • Problem::Table Column Heading Font control

    Hi experts!
    Do we have any way to change font and its size in column heading, in Table Component.
    I tried but looks like we dont have access to table column heading. We can only enter heading but cant change its font and size.
    Thanking you in anticipation.
    Annu

    Hi!
    As workaround You can try to set size of text for table to what You want to have for headers and then set size for every <webuijsf:tableColumn> tag to what You want to have for rows.
    Thanks,
    Roman.

  • Resize Column Heading Dynamically

    I have an AdvancedDataGrid for which the user can separately
    and independently set the font size used in the column headings and
    the rows. Upon saving the form, if the font size used in the rows
    changes, I call the function setRowFont() (shown below).
    The regenerateStyleCache(true) causes the rows to dynamically
    adjust their height to accommodate the text. (The groupRowHeight is
    there to adjust the size of the data groupings.) This works just
    fine.
    I use a similar function for the headings,
    setColumnHeadingFont(). When this is run, there is no change. If
    you close the app and restart it, the changes are reflected. Is
    there some way to change this height dynamically without
    restarting? Or is there a reason why this cannot be done?

    You can do this by placing the name of your hidden item in the heading column on the 'report attribute' tab of your report region.
    For example if you have an item called P1_GRP_BY that you want to display as a column header, type &P1_GRP_BY. in the header column.
    David

  • Popluate Column Heading Dynamically in UI

    HI Experts,
    I have a requirement where i  need to get column descriptions dynamically at item level in UI  depending on the process type.
    I have an order with two items, when i display the order from search result i go to order detail where i can see the items also.
    There is a column called net value as column heading, this populates the net price for each item.
    I need to show base price instead of NET PRICE which i am able to do that and column heading name is DNP.
    But DNP column heading  along with base price is required only for a particular process types , for remaining process types the NET VALUE column heading followed by net price should remain same.

    Hi,
    User can Maintain the Column Heading's, by the way you mentioned....
    Else you can use TOP-OF-PAGE event to build Dynamic Coulmn Headers.

  • Dynamic column heading in csv export not working

    Hi,
    I have a SQL report where the column headings are defined dynamically. for an example let's say I have a report
    SELECT NAME, TODAY'S_DATE FROM TABLE A.
    Under report attribute column I have defined column heading as "&P_todays_date.”. This item has source value “Select sysdate from dual. When I export the data into csv file the dynamic column headings are coming as blank.
    Any suggestions?
    Thanks,
    Manish

    You are posting this question in the PeopleSoft forums. I think it belongs in the BI section:
    https://forums.oracle.com/forums/category.jspa?categoryID=16

  • Dynamic Column Heading in Table Control

    Hi
    I have a table Control which needs dynamic heading for the first column. So i dragged a label and placed it on the Column 1 header. I gave the corresponding declaration and assignment in TOP include for that screen field. I also tried assigning values in the PBO of the screen also. I even tried replacing the Label with an I/O field. It is not allowing.
    Nothing is working. Any suggestions.

    Instead of the text field for your column heading, put an input/output field there, and specify the field for output only. Then assign the field with the header that you want on your PBO.

  • Change column header text dynamically

    Hi,
    I have requirement to change the column header text dynamically in sap gui programming. but couldn't see straight forward way to achieve this.
    i tried following link but no success:
    [Re: Dynamic header text in table control - Dialog programming;
    Please share your suggestions if it can be acheived.
    Thanks,
    Rahul
    Edited by: Rahul Yadav on Oct 25, 2010 7:29 PM

    >
    anmol112 wrote:
    > Hi,
    >   So you can try 1 thing,
    > * Dont use default Column Headings
    > * Create I/O and choose ouput only and fix them in place of Column headings.
    > * pass the values to these I/O accordingly.
    >
    >
    > Thanks,
    > Anmol.
    How is this different from the previous post?
    Rob

  • Dynamic Columns, using the element name as the column header name

    BI Publisher Experts,
    I'm a relative newbie in the RTF layout world and i'm trying to acheive a layout which dynamically nominates the column headers as the element name.
    For example using the XML below:
    <?xml version="1.0" encoding="UTF-8" ?>
    - <ROWSET>
    - <DATA>
    - <THREECOLUMNDATA>
    <FIRST_NAME>First Name</FIRST_NAME>
    <LAST_NAME>Last Name</LAST_NAME>
    <EMAIL>[email protected]</EMAIL>
    </THREECOLUMNDATA>
    </DATA>
    </ROWSET>
    Excuse formatting, looked ok in preview!
    I'd like to acheive the following output:
    | FIRST_NAME | LAST_NAME | EMAIL |
    |-----------------------|---------------------- |--------------------------------------------------------|
    | First Name | Last Name | [email protected] |
    I've managed to get the row data columns working using:
    <?for-each@cell:current()/*?><?.?><?parent::*/text()?> <?end for-each?>
    And i've been working on the header for a while now, using
    <?for-each@column:current()/THREECOLUMNDATA[1]/*?><?name(.)?><?end for-each?>
    But no luck with the header. I only ever get a blank header.
    I've also reviewed the following syntax:
    <?split-column-header:THREECOLUMNDATA?> <?/FIRST_NAME?>
    But of course, this pulls specific element data out as the header, not quite what I need.
    Question is: Is there specific functionality to pull the element name out as the header, or do I somehow specifically need to include the header name as a data value in the XML?
    Advice appreciated!

    If you could get your XML to look like this instead of what you have, you will be able to use split-column-header and split-column-data
    <?xml version="1.0" encoding="UTF-8" ?>
    <ROWSET>
    <DATA>
    <THREECOLUMNDATA>
    <COL_DTLS>
    <COL_LABEL>FIRST_NAME</COL_LABEL>
    <COL_VALUE>First Name</COL_VALUE>
    </COL_DTLS>
    <COL_DTLS>
    <COL_LABEL>LAST_NAME</COL_LABEL>
    <COL_VALUE>Last Name</COL_VALUE>
    </COL_DTLS>
    <COL_DTLS>
    <COL_LABEL>EMAIL</COL_LABEL>
    <COL_VALUE>[email protected]</COL_VALUE>
    </COL_DTLS>
    </THREECOLUMNDATA>
    </DATA>
    </ROWSET>
    Now if you <?split-column-header:COL_DTLS?><?COL_LABEL?> and <?split-column-data:COL_DTLS?><?COL_VALUE?> you'll get the required output...

  • How to change the column header name dynamically based on sysdate

    Post Author: senthi_gokul
    CA Forum: WebIntelligence Reporting
    Dear All,
            i have designed some reports. i would like to change the column header dynamically based on sysdate. up to 24 months. can u help me, which add month function using the universe. i dont know if-then-else function is having the universe tool or not?

    Post Author: prasingh
    CA Forum: WebIntelligence Reporting
    Are you saying you are not able to create an object by value (select: statement) as sysdate and put it onto the headers of your report? You can use the add_months() function on the object to add the numbers of months you wish.
    Please let me knnow for more.. You can get in touch with me on [email protected] for quick reply. 

Maybe you are looking for