How to dynamically set width of SSRS columns in custom code?

How can I change the width of a table column based on a parameter value using custom code in SSRS?
If the parameter value is "Excel", I'd like the width to be 2 inches. If the parameter value is "Standard", I'd like the width to be 1 inch.

Hi mmx_pdx,
Based on my research, we can only type static values for the width size in report. In Reporting Services, it not supported to set the size of width based on an expression currently. This is by design.
Personally, I recommend you that submit this suggestion at
https://connect.microsoft.com/SQLServer/. If the suggestion mentioned by customers for many times, the product team may consider to add the feature in the next SQL Server version. Your feedback is valuable for us to improve our products and increase the
level of service provided.
Thanks for your understanding.
Regards,
Katherine Xiong
Katherine Xiong
TechNet Community Support

Similar Messages

  • How to dynamically set connection string for report in C# code?

    Hi,
    I have installed CRVS2010. I have created new Crystal Report WPF Application and new report. I would like to set connection string for report in code dynamically.
    Is this possible?
    Thanks
    Ivana

    Lots of posts in this forum on how to set database connections. WPF should not be a consideration as it's just a viewer. The report engine is still the same. Search these forums. Use the search box at the top right corner of this page. Look at samples here:
    https://wiki.sdn.sap.com/wiki/display/BOBJ/CrystalReportsfor.NETSDK+Samples
    Note that none of the samples above are using WPF, but like I said, the WPF is just a different viewer and will not impact how the report engine logs on to a database. (I think of it as a gray car vs. a red car. Same engine, just the color is different)
    Ludek
    Follow us on Twitter http://twitter.com/SAPCRNetSup
    Got Enhancement ideas? Try the [SAP Idea Place|https://ideas.sap.com/community/products_and_solutions/crystalreports]

  • How to dynamically set column name in Answers

    Hi.
    How to dynamically set column name in Answers, for example I want to put presentation variable in column header. Is this possible?
    Regards,
    Goran Ocko
    http://108obiee.blogspot.com/

    May be a rude way .. but it works.
    Add narrative view and use Java script to change the column headings based on the variables.
    <script language="javascript" type="text/javascript">
    var a = document.getElementById('idResultsTableParent');
    var rows= a.getElementsByTagName('tr');
    rows[1].cells[1].innerText ="@{Presentation Variable}";
    </script>
    Editing the same post to remove irrelevant information.
    - Girish

  • How to change the width of a column in the web templete

    hai
       can anyone pl help me to solve the issue
    here is the issue
        " how to change the width of the column in web templete?" is there any chance  to change
    thanx in advance
    syam

    First use the Active Cell property and set the row value to -2 to change an entire column. The attached image shows how to set the background color of column 3 to green. I don't understand your comment about column size. It doesn't matter how wide or narrow a column is. Using the Cell Background Color property, the entire cell is colored. If you are having difficulty keeping track of the number of columns, thats a different issue.
    Attachments:
    Background_Color_of_Table.jpg ‏5 KB

  • How to increase the width of the column in Tableview

    Hi ALL,
    How to increase the width of the column in tableview?I have name column where big name is displaying in rows.Does any one have any idea how to increase the width of the column dynamically in tableview.Please respond its little urgent.
    Thanks in advance

    Hi Peter,
    Here is my Dynpage
    package com.ust.jcatotable;     
    import java.awt.Event;
    import javax.resource.cci.MappedRecord;
    import javax.resource.cci.RecordFactory;
    import com.sapportals.connector.connection.IConnection;
    import com.sapportals.connector.execution.functions.IInteraction;
    import com.sapportals.connector.execution.functions.IInteractionSpec;
    import com.sapportals.connector.execution.structures.IRecordSet;
    import com.sapportals.htmlb.DropdownListBox;
    import com.sapportals.htmlb.event.TableNavigationEvent;
    import com.sapportals.htmlb.page.DynPage;
    import com.sapportals.htmlb.page.PageException;
    import com.sapportals.portal.htmlb.page.JSPDynPage;
    import com.sapportals.portal.htmlb.page.PageProcessorComponent;
    import com.sapportals.portal.ivs.cg.ConnectionProperties;
    import com.sapportals.portal.ivs.cg.IConnectorGatewayService;
    import com.sapportals.portal.ivs.cg.IConnectorService;
    import com.sapportals.portal.prt.component.IPortalComponentContext;
    import com.sapportals.portal.prt.component.IPortalComponentProfile;
    import com.sapportals.portal.prt.component.IPortalComponentRequest;
    import com.sapportals.portal.prt.component.IPortalComponentResponse;
    import com.sapportals.portal.prt.runtime.PortalRuntime;
    public class Display extends PageProcessorComponent {
      public DynPage getPage(){
         return new DisplayDynPage();
    public static class DisplayDynPage extends JSPDynPage{
         private Object formatFlag;
         public static IConnection connection ;
         private IPortalComponentRequest request;
         private IPortalComponentContext context;
         private IPortalComponentProfile profile;
         private IPortalComponentResponse  response;
         private int visibleRow=1;
         TableBean myBean;
         public void doInitialization(){
                   response = (IPortalComponentResponse) this.getResponse();
                   request = (IPortalComponentRequest) this.getRequest();
                    context = request.getComponentContext();
                    profile = context.getProfile();
                    IPortalComponentProfile profile = context.getProfile();
                    Object o = context.getValue("myBean");
                    if(o==null || !(o instanceof TableBean)){
                       myBean = new TableBean();
                       setBeanFromProfile(profile, myBean);
                       context.putValue("myBean",myBean);
                     }else {
                       setBeanFromProfile(profile, myBean);
                        myBean = (TableBean) o;
                    this.getData();
         public void myOnNavigate(Event event) throws PageException{
              TableNavigationEvent tne = (TableNavigationEvent) event;
              this.visibleRow = tne.getFirstVisibleRowAfter();
              if(myBean!=null)
              myBean.setVisibleRow(new Integer(this.visibleRow).toString());

  • How do I set the number of columns for JTextPane

    I only found a method setSize() of JTextPane class. How can I set the number of columns in a JTextPane? Each column can be written one letter.
    Thanks.

    You're not going to use FontMetrics to change the width of the characters; you're going to use it figure out how wide a single character is. Then multiply by the number of characters you want to have in a line, and presto! You know how wide to make your JTextPane.
    Unless I've misunderstood your problem, of course.

  • How Can I set up a JTable columns?

    Dear All,
    How can I set up my JTable columns to have the amount the user specifies?
    for example when the user types in 50 in JTextField 1 I want the JTables columns to then set to 50.
    How can this be done?
    Thanks
    lol
    import javax.swing.*;
    import javax.swing.table.TableModel;
    import java.io.*;
    import java.util.*;
    import java.lang.*;
    import java.awt.*;
    import java.awt.event.ActionListener;
    import java.awt.event.ActionEvent;
    public class si1 extends javax.swing.JFrame implements ActionListener {
        JTextField name = new JTextField(15);
        JTextField name1 = new JTextField(15);
        public si1() {
            super("DataBase Loader");
            setSize(1025,740);
            setDefaultCloseOperation(JFrame.EXIT_ON_CLOSE);
            JPanel pane = new JPanel();
            JPanel pane1 = new JPanel();
            JPanel pane2 = new JPanel();
            JPanel pane3 = new JPanel();
            JPanel pane4 = new JPanel();
            pane.setLayout(new GridLayout(20,1));
            pane1.setLayout(new BorderLayout());
            int j=10;
            String[][] data = new String[j][2];
            for (int k=0; k<j; k++){
               String[] row = {"",""};
               data[k] = row;
            String[] columnNames = {"First Name", "Last Name"};
            JTable perstab = new JTable(data, columnNames);
            perstab.setGridColor(Color.yellow);
            perstab.setPreferredScrollableViewportSize(new Dimension(500,500));
            JScrollPane scrollPane = new JScrollPane(perstab);
            pane1.add(new JPanel(), BorderLayout.EAST);
            JButton btn = new JButton("What are the names?");
            btn.addActionListener(this);
            btn.putClientProperty("DATABASE", perstab);
            pane1.add(new JPanel().add(btn), BorderLayout.SOUTH);
            pane2.add(name);
            pane3.add(name1);
            pane.add(pane2);
            pane.add(pane3);
            pane1.add(pane, BorderLayout.WEST);
            pane4.add(scrollPane);
            pane1.add(pane4, BorderLayout.CENTER);
            setContentPane(pane1);
            show();
        public static void main(String[] args) {
            si1 frame = new si1();
            frame.setVisible(true);
        public void actionPerformed(ActionEvent e) {
            JTable table = (JTable)((JButton)e.getSource()).getClientProperty("DATABASE");
            TableModel model = table.getModel();
            int count = model.getRowCount();
            String[] firstnames = new String[count];
            String[] lastnames = new String[count];
            for (int i=0; i < count; i++) {
               firstnames[i] = (String)model.getValueAt(i, 0);
                System.out.println("first name at row " + i + ": " + firstnames);
    lastnames[i] = (String)model.getValueAt(i, 1);
    System.out.println("lastname name at row " + i + ": " + lastnames[i]);

    As you can see I have tried this, but no success.
    If I am doing something wrong please accept my apology, and address me in the right direction.
    Thanks
    Lol
    import javax.swing.*;
    import javax.swing.table.TableModel;
    import java.io.*;
    import java.util.*;
    import java.lang.*;
    import java.awt.*;
    import java.awt.event.ActionListener;
    import java.awt.event.ActionEvent;
    public class si1 extends javax.swing.JFrame implements ActionListener {
        JTextField name = new JTextField(15);
        JTextField name1 = new JTextField(15);
        public si1() {
            super("DataBase Loader");
            setSize(1025,740);
            setDefaultCloseOperation(JFrame.EXIT_ON_CLOSE);
            JPanel pane = new JPanel();
            JPanel pane1 = new JPanel();
            JPanel pane2 = new JPanel();
            JPanel pane3 = new JPanel();
            JPanel pane4 = new JPanel();
            pane.setLayout(new GridLayout(20,1));
            pane1.setLayout(new BorderLayout());
            int j=10;
            String[][] data = new String[j][2];
            for (int k=0; k<j; k++){
               String[] row = {"",""};
               data[k] = row;
            String[] columnNames = {"First Name", "Last Name"};
            JTable perstab = new JTable(data, columnNames);
         ((DefaultTableModel)perstab.getModel()).setColumnCount(Integer.parseInt(name.getText()));
            perstab.setGridColor(Color.yellow);
            perstab.setPreferredScrollableViewportSize(new Dimension(500,500));
            JScrollPane scrollPane = new JScrollPane(perstab);
            pane1.add(new JPanel(), BorderLayout.EAST);
            JButton btn = new JButton("What are the names?");
            btn.addActionListener(this);
            btn.putClientProperty("DATABASE", perstab);
            pane1.add(new JPanel().add(btn), BorderLayout.SOUTH);
            pane2.add(name);
            pane3.add(name1);
            pane.add(pane2);
            pane.add(pane3);
            pane1.add(pane, BorderLayout.WEST);
            pane4.add(scrollPane);
            pane1.add(pane4, BorderLayout.CENTER);
            setContentPane(pane1);
            show();
        public static void main(String[] args) {
            si1 frame = new si1();
            frame.setVisible(true);
        public void actionPerformed(ActionEvent e) {
            JTable table = (JTable)((JButton)e.getSource()).getClientProperty("DATABASE");
            TableModel model = table.getModel();
            int count = model.getRowCount();
            String[] firstnames = new String[count];
            String[] lastnames = new String[count];
            for (int i=0; i < count; i++) {
               firstnames[i] = (String)model.getValueAt(i, 0);
                System.out.println("first name at row " + i + ": " + firstnames);
    lastnames[i] = (String)model.getValueAt(i, 1);
    System.out.println("lastname name at row " + i + ": " + lastnames[i]);

  • Set Width for a column, Merge cells in Excel

    Hi all,
    I am using jacob.dll to open and modify an Excel file. And I am stucking in below trouble:
    Dispatch workbook = Dispatch.invoke(workbooks, "Open",
              Dispatch.Method,
              new Object[]"D:\\02042005.xls",
              new Variant(false), new Variant(false)},
              new int[1] ).toDispatch();
    Dispatch sheet = Dispatch.get(workbook,"ActiveSheet").toDispatch();
    System.out.print(sheet.get(sheet,"Name") + "\n");
    Dispatch a1 = Dispatch.invoke(sheet, "Columns",
              Dispatch.Get,new Object[] {"A:A"},
              new int[1]).toDispatch();     
    Dispatch.put(a1,"Width","8");
    Error message is that I can not set value Width for object RANGE! so strange... Is there any ways to set Width for a certain column?
    Any help is appreciated.
    Regards,
    YukiNguyen

    Hi all,
    :) At last I can work done with Jacob, so great :) take me all yesterday to find more... just hope this post can help someone like me save one day to find how :)
    //Get Range
    Dispatch orange = Dispatch.invoke(osheet,"Range",Dispatch.Get,new Object[]{"A1:I1"},new int[1]).toDispatch();
    //Get Column I & set Width
    ocolumn = Dispatch.invoke(orange,"EntireColumn",Dispatch.Get,new Object[]{"I"},new int[1]).toDispatch();
    Dispatch.put(ocolumn,"ColumnWidth","60");
    //Merge cell
    orange = Dispatch.invoke(osheet,"Range",Dispatch.Get,new Object[]{"C12:D12"},new int[1]).toDispatch();
    orange.call(orange,"Merge");
    Is it exciting, huh? :) I am trying to set HorizontalAlignment... beginner always stuck in somethings :)... but I have learnt so much
    Regards,
    YukiNguyen

  • How to fix the width of sorting column about adf table ?

    I develop project with ADF in jdeveloper.
    When click on the sorting column header in adf table,it will adjust the width of the sorting column header.It will make page shifting.
    How can I do to avoid the adjusting ?
    How can I do to fix the width of soting table header?
    Any hint will be appreciated.
    Thank you!
    Message was edited by:
    user618145

    I have set the column width like this:
    in style.css:
    /** Column Settings **/
    af|column::header-text
    background-color:#F0EDE1;
    color:#000000;
    font-family:Arial,Helvetica,sans-serif;
    font-size:12px;
    font-weight:bold;
    padding-left: 2px;
    padding-right: 2px;
    padding-top: 3px;
    padding-bottom:3px;
    border-color: #B5B5B5;
    WIDTH: 120px;
    af|column::sortable-header-text
    background-color:#F0EDE1;
    color:#000000;
    font-family:Arial,Helvetica,sans-serif;
    font-size:12px;
    font-weight:bold;
    padding-left: 2px;
    padding-right: 2px;
    padding-top: 3px;
    padding-bottom:3px;
    border-color: #B5B5B5;
    WIDTH: 120px;
    and in jsp page,write like this:
    <af:panelBox text="test" width="1000" background="dark" >
    <af:table emptyText="" value="#{ftOverview.listOfTransefersVect}" var="transfers" width="100%" banding="row" bandingInterval="1">
    <af:column sortable="true" sortProperty="transactionId" headerText="#{resources['ft_overview.ref']}" formatType="text" width="39"
    noWrap="true">
    <af:outputText value="#{transfers.transactionId}" escape="false"/>
    </af:column>
    </af:table>
    </af:panelBox>
    but it seems doesn't work well.

  • How to modify the width of a column?

    Hi,
    I would like to specify different values in the width for the columns in a custom report, because from Microsoft Excel I would like to print all information in an only page.
    I have tried to modify the values from "Additional formatting options" specifying different values, but when I donwload the report in Excel format, the columns doesn't modify (they have the same with as default).
    How can I do it?
    Thanks and regards.

    Hi Monica
    Craete Narrative report and then throght HTML tags set the width. Hope it helps

  • How can I set a value of column in SSIS by using Replace

    How can I set a value of a column in SSIS using a Replace in Derive columns. I have here NameCode and I need to Set = 1 Where NameCode like LIKE '____99____'
    eg. 1006993010... if 5th and 6th characters are 99
    Else 0
    Hope to hear from someone soon and I appreciate great help here.

    If NameCode column is integer then you have to cast it correctly to String.
    I am adding that to the expression provided by Rajen.
    SUBSTRING((DT_WSTR,20)ProductCode,5,2) == "99" ? 1 : 0
    -Vaibhav Chaudhari

  • How can I set up a 2 column layout in LiveCycle?

    Hi,
    I'm new to working with LiveCycle Designer. I'm using version 10.4, the OEM version bundled with SAP. Aside from being quite buggy, the capabilities seem pretty similar to LiveCycle Designer ES4, which I downloaded in a trial version. All of which is to say that this is a newbie question.
    I cannot, for the life of me, figure out how to set up a 2-column layout.
    On my master page, I have two content areas.
    When I create a new page, I am able to drag fields into the first content area I created, but not into the second content area.
    What am I doing wrong?
    Thanks,
    Janet

    Hi. 
    I am not a new LiveCycle Forms designer.  I am using Workbench ES2 (9.0.0.2.20121123.884160).  I have run into a new design problem related to a two column page. The business analytsts have designed the form in Word, where columns work great.  I have tried two subforms within the page. The problem with that is when the right column subform overflows, it overflows to the left column (as the left column has not overflowed), or when the left column overflows (whether or not the right column overflows) the right column begins on the left column's overflowed page.
    I have tried building a page with two side-by-side content areas in the Master Pages, including setting overflow parameters for each subform in the Design View, also with similar problems.
    I have tried using a table with no header and 1 row.  That one is interesting.  When only one cell overflows to another page, it works correctly.  When both columns overflow, the first text box in the subform in each cell is displayed at the top of the page and the remaining content of both cells overflow to the next page, leaving a nearly blank page containing only the one-line text label in each of the two columns.
    Is there some nearly hidden setting I am missing?  Is this possible within LiveCycle Designer Forms?
    Thanks for your attention to this request.
    Frank

  • How do I set the CoreTable sort column in the managed bean?

    I have a CoreTable with two columns, first name and company, from the managed bean in a session scope, how do I set the company column to be the default/selected sort order?
    Or is that done by binding the af:column to a CoreColumn object in the managed bean, which method would I use?
    <af:column sortProperty="company" sortable="true">
    <f:facet name="header">
    <af:outputText value="#{common.labelCompany}"/>
    </f:facet>
    <af:outputText value="#{row.company}"/>
    </af:column>
    Thanks,
    --Todd                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                               

    Yes, I know, "sortable", see, I even used it in my example. I don't want to disable default sorting.
    What I'm asking is how to have more than one sortProperty. When the user clicks the column heading, I want to sort by "myFirstProperty" AND "mySecondProperty". The sortProperty only seems to allow one sort property.
    One possibility seems to be to programatically add items to the List of SortCriterion objects as in your example, but where would I put this code so that it is executed when the user clicks the column heading, but before the table is sorted.

  • How to decrease the width of left column in the "2 column layout"?

    Hi all,
    I create two webdynpro based iViews in the EP, then I create a page use the "2 column layout(Narrow:Wide)".I put one iview in the left column and another iview in the right column. When I preview my page, I found the left column still too wide. So how to decrease the width of my page's left column?
    Thanks and Best regards
    Deyang

    Hi Deyang,
    You have to create your own layout:
    - Navigate to System Administration->Support
    - Choose Portal Runtime -> Browse Deployment
    - Navigate under pcd or under temp, and download the layouts par (com.sap.portal.layouts.default.par.bak if I recall correctly)
    - Import that par as a project to Developer Studio
    - Make your changes (create a new jsp acording to the existing examples, and update the portalapp.xml accordingly)
    - Export to par (in a different name!) and deploy
    - In the portal content: new from par -> Layout (don't forget to mark it as a template).
    - Your new layout template will now be available when you create new pages.
    good luck!

  • How to control the width of the columns in a table in the oaf page?

    hi,
    We have a requirement to adjust the width of the columns of the table so that they are in line with the width of the page.
    Please do share any feasible solution.
    thanks,
    Danish

    try to personalize and set the width property of item.
    else use below code in Controlller.
    1) public class wyseQotLinesCOEx extends QotLinesCO
    public CSSStyle cellUpperCase;
    public void processRequest(OAPageContext pageContext, OAWebBean webBean)
    2)
    get handle of inputitem as inputbean;
    cellUpperCase = new CSSStyle();
    cellUpperCase.setProperty("width","50");
    if (inputbean != null)
    {        inputbean.setInlineStyle(cellUpperCase);
    }

Maybe you are looking for

  • Broken links and javascript on OMWB page

    Link to "mysql 5 bundle" (http://www.oracle.com/technology/software/tech/migration/workbench/index.html#MySQL5) goes no where (does not scroll down the page). Link to section "2.2" also broken. Text is "** For MySQL5 Beta Release see step 2.2" takes

  • Code appearing in page

    hello all. I'm a fairly inexperienced user so go easy on me, but i'm having some code appear at the top of a page i'm working on. It does not appear in IE, but only in Mozilla Firefox. I am using layers (i know, i know). here is the code: <%@ page la

  • Is there a way to migrate an Oracle DB to MS Access using SQL Developer?

    I have to migrate an oracle db to Ms access. Is there any way to do that? Thanks

  • URGENT iPhone 5 white black screen???

    URGENT ANSWERS? iPhone 5was knocked out of my hand onto the floor, had a silicone casing however the screen flickers when I touch it and all that comes up is a black or white screen. Only got the phone in January tried rebooting it and it's fine for

  • Microsoft Outlook for Mac 2011 is Crashing w/ OSX 10.9.3

    Hello - I have been using Outlook for MAC 2011 on my MacBook Air (OSX 10.9.3). Suddenly today it started crashing the minute I log-in to the application.  Here is the detail of the info I received from the error report: Microsoft Error Reporting log