How do I set column width for a table?
I want to set the same width for all the columns in a particular table. Is there anyway of doing this without having to actually manually adjust each individual column?
Thanks
Select the column headers and drag across (A,B,C for example) then select between one of the columns (your pointer will change shape). Select and drag to the new width. All selected columns will change.
Regards,
Similar Messages
-
How to set initial column widths for a table
What I'd like to do is to control the initial column widths for a table.
I'm building the table by using a class which extends AbstractTableModel. This class takes care of setting the headers and reading the data for the table.
If I do the following:
VarTableModel vtm = new VarTableModel(vi);
JTable jt = new JTable(vtm);
JScrollPane jsp = new JScrollPane(jt);
frame.getContentPane().add(jsp);
frame.setVisible(true);
I will see a table in my window. The widths of the columns are equal and are a function of the horizontal dimension of the window.
I have tried to set the width of a column by doing the following:
TableColumn aColumn;
aColumn = jt.getColumn(vtm.getColumnName(0));
aColumn.setWidth(40);
But this has no effect on what gets displayed. I can force the widths that I want by using 'setMaxWidth' but this has the unfortunate side effect of not allowing the user to make the column wider if they want.
What I'd like is a way to specify the widths of the columns when initially displayed and then let the user adjust to their liking.
I'm sure that there is a way to do this, but I don't seem to understand where to intervene in the process to produce the effect that I want.
Any help or suggestions will be greatly appreciated!Table.setAutoResizeMode(JTable.AUTO_RESIZE_OFF);
add this line and try ur codeThanks for the suggestion! Unfortunately, it doesn't seem to do the trick. Here is an abbreviated segment of my code:
vtm = new VarTableModel(vi);
JTable jt = new JTable(vtm);
// we want a horizontal scrollbar, so turn resizing off
// and we want to control column widths
jt.setAutoResizeMode(JTable.AUTO_RESIZE_OFF);
aColumn = jt.getColumn(vtm.getColumnName(0));
aColumn.setWidth(40);
. // same kind of thing for each column
aColumn = jt.getColumn(vtm.getColumnName(4));
aColumn.setWidth(400);
JScrollPane jsp = new JScrollPane(jt);
frame.getContentPane().add(jsp);
frame.setVisible(true);
If I do the above, the table gets displayed with each of the five columns the exact same width. So, the sizing of the columns is happening somewhere else despite turning auto resizing off.
Where is that occurring and how can I intervene so that I can control the widths of the columns on initial display and still allow the user to adjust the widths if they so choose? -
How can I set column width in JTable?
How can I set column width in JTable?
Also, read the JTable API before posting questions. You will find a link to the Swing tutorial on "How to Use Tables", which contains an example of doing exactly this.
-
How do I set column widths in read/write rules?
Hello structure experts,
I am reading a set of DITA files into a specific FM template format, and there is one detail I cannot get to work properly. It should be possible to define column widths in a table, even if the DITA file does not include that information. But the Structure Application Developer Reference does not give the information on which string to pass to the column widths fm property. Does anyone out there have experience in doing this ?
Thanks
JangGot it !!!
Turned out to be simple, but the info was more or less hidden in the Dev Ref Guide: I had already put the "fm property column widths is value " line in but did not know the syntax for the values. Turns out you need to delimit the values by spaces, not commas. The parser does not give ANY useful information about this, just mentions 'syntax error near somewhere' or completely ignores the values you specify.
This is how the rule for my DITA properties element now works out:
element "properties" {
is fm table element;
fm property columns value is "3";
fm property column widths value is "5cm 5cm 6cm";
It works. I earn 10 points for answering my own question. :-)
Ciao
Jang -
How to set column width for Label in Form region?
In the form region, the label value is a lengthy text, and it does not wrap. How do I make it wrap to a fixed column width?
Under Home>Application Builder>Application>Page>Edit Page Item,
i have set "HTML Table Cell Attributes" to width="300", but it still does not wrap. and pushes the field to the right end of the page.
I am quite sure there are better ways of doing this.thanks Simakas for the reply.
I had set the label template to "Optional" and that was forcing a "nowrap". After unsetting the template, I used your suggestion and it works like a charm. Thanks. -
How do I set Column Width in table displayed - have tried everything :-(
Hi,
I'm using Jdev 10.1.2, adf bc and jsp's.
Simple problem, driving me nuts. In my app i display a number of different view objects in a number of jsp's. i want to set the width of the columns so that the info (if large) in each field will stay on one line. i.e. it wont continue onto the next line and take up two rows.
i have tried setting the width property of the <th> & <td>, setting the disply width property in the entity object editor and the view object editor, nothing makes a bit of difference to how the column is displayed.
this results in the tables looking messy and squised, which is totally unsatisfactory.
so if anyone could shed any light on the subject, i would be most grateful.
Thanks in advance......hi Newbe,
if you set the option noWrap="true" on the column the text will not be wrapped;
<af:column noWrap="true" sortable="false" headerText="col5">
<af:outputText value="#{row.col5}"/>
</af:column>
Good luck
Luc Bors -
Change column width for print table to report
Hi, want to make the first column in my table to be printed to report wider than the rest, for it contains the part numbers of about 16 chars and the other columns are the data of 4 each. Don't want to make all equally wide for I want to fit as many column as possible over the page. How can I do this?? Thanks for any help. Is there maybe another way to print in a table format?? Madri
Hi Madri,
Assuming you are using the Standard Report type with the Report Generation VIs, you can check out this KnowledgeBase entry that discusses how to customize the VI to generate a report with different column widths:
http://digital.ni.com/public.nsf/websearch/7AEC2CC2618D47DF86256D280058BDA5
Hope this helps,
-D
Darren Nattinger, CLA
LabVIEW Artisan and Nugget Penman -
How to fix the column width in a table in htmlb tableview control
HI Experts,
I have an issue with my htmlb table view controller. I have created a custom iView with a htmlb table view control and placed it in quick navigation window.
When data in columns exceeds, I am getting horizontal scroll bar and column,table are getting extened. I don't want column size increases when text length increses. Instead when lenght of the text incrases in a column, I want the text displyed in multiple columns.
I have tried for this as below.
<hbj:tableView
id="statTable"
model="bean.stattableModel"
design="ALTERNATING"
headerVisible="false"
footerVisible="false"
fillUpEmptyRows="false"
navigationMode="BYPAGE"
selectionMode="NONE"
headerText="Report List"
visibleFirstRow="1"
visibleRowCount="10"
width="100%">
<%
stattableModel.getColumn("D").setWidth("5px");
stattableModel.getColumn("D").setWrapping(false);//tried true aswell
stattableModel.getColumn("H").setWidth("px");
stattableModel.getColumn("H").setWrapping(false);
%>
No change happen ever after I used the above code.
Any one has the idea, how make it work.
Thanks in Advance,
Chinna.Hi Babu,
Please go through this links.
https://www.sdn.sap.com/irj/scn/go/portal/prtroot/docs/library/uuid/80a7eef2-9a2c-2a10-12bb-abad552f3302
http://www.sapfans.com/forums/viewtopic.php?f=20&t=300326
Kind regards
Prabhakaran.P -
I've been utilizing the below script (thank you so much Ramkumar. P!) to set column widths throughout a sizable InDesign book with tables on every page and it is truly a time saver. At this point in time, I have three versions of it because there are different column widths throughout the book. Is it possible to augment the script to run only on a selected text frame (containing a table)? If so, would someone be kind enough to share the augmented script with me? I've been trying to figure out this seemingly simple change through trial and error with no success as yet. I realize this is a totally newbie request and I'm entirely at the mercy of the kindness of the Javascript gods that contribute within this forum. Seeing that in a different post related to this script, one such guru responded to a request as simple as "Where do I put the scripts in InDesign" gave me enough courage to ask for some help! Thank you in advance to anyone willing to provide a solution.
var myDoc = app.activeDocument;
var myWidths = [100, 100, 150, 150];
for(var T=0; T < myDoc.textFrames.length; T++){
for(var i=0; i < myDoc.textFrames[T].tables.length; i++){
for(var j=0; j < myWidths.length; j++){
myDoc.textFrames[T].tables[i].columns[j].width = myWidths[j];
alert("Table width updated successfully...");Hello all
I have the same problem in that I'm not a scripting person, but was able to get the above script working without problem, and it does set irregular table column widths perfectly, so thanks to Ramkumar. P for that.
BUT, it changes the column width for ALL tables in the document, whereas I would like to just target the selected table.
Any ideas as to how I might amend this script to achieve this?
Thx, Christian -
How to reduce the coulmns width for Timesheet in ESS ?
Hi,
In ESS Timesheet, how to reduce the columns width for professional self service?
It is looking fine for weekdays, but when the user is assigned as professional self service at back end, few more sales order columns are added dynamically to timesheet for professional self service user. Now these extra coulmns are jumbled and also wide.
I tried the OSS notes 989453 in 'listviewerslim.java' , but it doesn't work. Is there any other alternative work around for this. Do I need to work at backend to solve this, If so, please let me know the work around.
Points will be awarded.
Regards,
Raj.Dear Friend
Really need ur help as we are upgrading from 4.7 to ECC6.
Our client want to implement tiem sheet. Request you to provide gudiance wheher CATS i.e CATSRegular orESS timesheet would be useful.
if would be great if u could provide a kind of advantages adn disadvantages of both.
Suitable points would be rewarded
Sam -
Set Column width in query (not using SQL*Plus)
How can I Set Column width in query
I understand you can set column width using
column col1 FORMAT A5
select col1 from table1;But this only works in SQL*Plus
I want to be able to do this in a regular SQL query window (not in SQL*Plus), how can I do it.....
I am using a 'SQL window' in PL/SQL Developer IDE
and when I use this syntax it says:
ORA-00900: Invalid SQL statement
Any suggestions are appreciated...
thanks,
M.Did you try using RPAD or LPAD functions? They fill the unfilled part of a string with character you provide... either on right or left side depending on what function you use.
e.g.
SELECT RPAD('Smith', 10, ' ') Name FROM dual;http://www.adp-gmbh.ch/ora/sql/rpad.html
Edited by: Zaafran Ahmed on Nov 10, 2010 11:50 AM -
How to set displayed column width for a search help
I have created an elementary search help for a custom field with a value table behind it.
The search help functions correctly, but when displayed the column widths are all 10 characters. The user has to adjust the column to view the descriptive text.
Can anyone tell me how to set default column widths for the help?Please open you Elementary search help and see the Column width behind the Fields of your ...there increase the width of the fields
"Activate it and refresh
reward points if it is usefull .....
Girish -
How to set column width in alvgrid
hi
how to set column width in alvgrid.
thanks.Hi,
Check this,
REPORT ztest.
DATA: BEGIN OF i_scarr_tab OCCURS 0.
INCLUDE STRUCTURE scarr.
DATA: END OF i_scarr_tab.
DATA: i_scarr LIKE TABLE OF i_scarr_tab WITH HEADER LINE,
w_scarr LIKE LINE OF i_scarr_tab.
DATA: o_grid TYPE REF TO cl_gui_alv_grid,
o_container TYPE REF TO cl_gui_custom_container.
DATA: lt_fcat TYPE lvc_t_fcat,
ls_layo TYPE lvc_s_layo,
ls_sort TYPE lvc_s_sort,
lt_sort TYPE lvc_t_sort,
ls_fieldcat TYPE slis_t_fieldcat_alv WITH HEADER LINE.
START-OF-SELECTION.
CALL SCREEN 9000.
*& Module status_9000 OUTPUT
text
MODULE status_9000 OUTPUT.
SET PF-STATUS '9000'.
SET TITLEBAR '9000'.
ENDMODULE. " status_9000 OUTPUT
*& Module user_command_9000 INPUT
text
MODULE user_command_9000 INPUT.
CASE sy-ucomm .
WHEN 'BACK' OR 'EXIT'.
SET SCREEN 0.
LEAVE SCREEN.
ENDCASE.
ENDMODULE. " user_command_9000 INPUT
*& Module init_9000 OUTPUT
text
MODULE init_9000 OUTPUT.
IF o_container IS INITIAL.
SELECT * FROM scarr INTO CORRESPONDING FIELDS OF TABLE
i_scarr UP TO 100 ROWS.
IF cl_gui_alv_grid=>offline( ) IS INITIAL.
Create a custom container control for ALV Control
CREATE OBJECT o_container
EXPORTING
container_name = 'CONTROL'.
Create a ALV Control
CREATE OBJECT o_grid
EXPORTING i_parent = o_container.
PERFORM build_field_catalgue.
ls_layo-sel_mode = 'A'.
CALL METHOD o_grid->set_table_for_first_display
EXPORTING
i_save = 'A'
i_default = 'X'
is_layout = ls_layo
CHANGING
it_outtab = i_scarr[]
it_fieldcatalog = lt_fcat
it_sort = lt_sort[].
ENDIF.
ENDIF.
ENDMODULE. " init_9000 OUTPUT
*& Form build_field_catalgue
text
--> p1 text
<-- p2 text
FORM build_field_catalgue .
DATA: ls_fcat TYPE lvc_s_fcat.
CALL FUNCTION 'REUSE_ALV_FIELDCATALOG_MERGE'
EXPORTING
i_program_name = sy-cprog
i_internal_tabname = 'I_SCARR_TAB'
i_structure_name = 'SCARR'
i_client_never_display = 'X'
CHANGING
ct_fieldcat = ls_fieldcat[]
EXCEPTIONS
inconsistent_interface = 1
program_error = 2
OTHERS = 3.
IF sy-subrc <> 0.
MESSAGE 'FCAT Error' TYPE 'I'.
EXIT.
ENDIF.
LOOP AT ls_fieldcat.
CLEAR ls_fcat.
ls_fcat-fieldname = ls_fieldcat-fieldname. "Fieldname
ls_fcat-ref_table = ls_fieldcat-tabname. "DDIC ref struct
ls_fcat-inttype = ls_fieldcat-inttype. "Data type
ls_fcat-outputlen = ls_fieldcat-outputlen. "Column width
ls_fcat-coltext = ls_fieldcat-seltext_m. "Column Header
ls_fcat-seltext = ls_fieldcat-seltext_m. "Column Desc
ls_fcat-ref_field = ls_fieldcat-ref_fieldname. "Reference field
ls_fcat-ref_table = ls_fieldcat-ref_tabname. "Reference table
CASE ls_fieldcat-fieldname.
WHEN 'LUGGWEIGHT' OR 'FORCURAM'.
ls_fcat-edit = 'X'.
ls_fcat-do_sum = 'X'.
WHEN 'URL'.
ls_fcat-no_out = 'X'.
WHEN OTHERS.
ls_fcat-edit = ' '.
ls_fcat-do_sum = ' '.
ENDCASE.
APPEND ls_fcat TO lt_fcat.
ENDLOOP.
ENDFORM. " build_field_catalgue
check the programs bcalv_grid*.
check this link for more detailed example.
http://www.supinfo-projects.com/fr/2005/alv_display_fr/2/
Regards
Sruthi -
How do I set individual properties for a column in report layout at runtime
How do I set individual properties for a column in report layout at runtime? I need to change this based on a user's input. This is for v10g.
I need to change either the "Read from File" attribute or the "File Format" attribute for one column based on the user's input. IS this possible?
Thanks in advance!Hi,
define 2 columns and use format triggers to show the one or the other column.
Regards
Rainer -
Dynamic Column width for a report
Will the width property of a column be able to be set at run-time (i.e. ability to set the width of a column to an expression) in SQL Reporting Services 2008? One problem I have seen is the inability to set the width of columns in a report when you you have several columns whose order is determined based on parameters.
Lets say I have 2 columns in a report and two fields from the database which will populate those columns: 1 field that is varchar(5) and one which is varchar(50). If I do not know which column each field will go to until runtime how am I supposed to adjust the column width? Letting the column width be set by an expression would solve everything as I could pass the width in to the report. As it stands now, I would have to set each column's width to accomodate a field of type varchar(50) in order to avoid wrapping of data.
You could say just create 2 reports, one for each case, but what if I had 15 fields? 20?
Has anyone figured out how to dynamically set the width of a column? Will the width of a column be able to be set at run-time in SQL Server Reporting Services 2008 via expression or some other means?
Questions, questions, questions.
ChuckOk slight update
RDL xml files are used during deisgn of reports but when you deply they go into the Content column of a table called Catalog:
SELECT [Name],
CAST(CAST([Content] AS VARBINARY(MAX)) AS XML) AS reportXML
FROM [Catalog]
WHERE type = 2
So I think this can be edited programmatically. Widths can be found like this:
<TableColumns>
<TableColumn>
<Width>9cm</Width>
</TableColumn>
<TableColumn>
<Width>3.02646cm</Width>
</TableColumn>
<TableColumn>
<Width>3.25cm</Width>
</TableColumn>
<TableColumn>
<Width>3.5cm</Width>
</TableColumn>
<TableColumn>
<Width>3.5cm</Width>
</TableColumn>
</TableColumns>
Maybe you are looking for
-
Time Machine backup not recognized?
I have a Time Machine configured drive that I have been using since 2010. I recently tried connecting it to my Airport Extreme backup over the air. It worked, but very slowly so I attempted to connect directly to my iMac again. Now Time Machine wants
-
Need to Disable a link when a condition is failed in Web dynpro ABAP
HI Gurus, I have an requirement, I am displaying one form, above the form I am displaying the link as Overview. if some conditions failed and the form is not displayed, I want to disable that link ' OVERVIEW" should be in disable mode. Please prov
-
Not able to open SQLPLUS in Oracle 11g on linux
Whenever i tried to open SQLPLUS in Oracle 11g, it always put an error related with "SELinux" and when i run SQLPLUS through the command it gives error "CANNOT RESTORE SEGMENT PROT AFTER RELOC: PERMISSION DENIED". My SQLDeveloper working properly. So
-
Why is About:config not saving user changes?
Ok heres the problem. In about:config searched for keword.url had - chrome://browser-region/locale/region.properties as the setting tried to change to - http://www.google.com/search?hl=&q= works with the changed link, until you restart firefox. then
-
whenever i try to load earlier messages with one of my contacts it only shows a couple more of the previews texts we sent using both imessage and normal texting. Then i tried deleting a couple of our texts and tapped on load earlier messages it would