RenderTable Column Size

Posted by: darce on 5 November 2018, 12:03 pm EST

    • Post Options:
    • Link

    Posted 5 November 2018, 12:03 pm EST

    I’m creating a table with date, changing the width of the columns. Looks like the table it’s been resizes to fill the size of the page. I want to know how to stop that.

    RenderTable table = new RenderTable();

    table.StretchColumns = StretchTableEnum.None; //= SplitBehaviorEnum.Never ;// = SplitBehaviorEnum.SplitIfNeeded;

            int currentRow = table.Rows.Count;
            table.Style.GridLines.All = new LineDef(Color.DarkGray); ;
            int r1 = textRow.Split(_tableSep)[0].Split('|').Length;
            string[] columnText = textRow.Split(_tableSep)[1].Split('|');
            columnText = columnText[columnText.Count() - 1] == "" ? columnText.Take(columnText.Length - 1).ToArray() : columnText;
            string[] justification = textRow.Split(_tableSep)[0].Split('|');
    
            for(int i = 0; i < 11; i++)
            {
                table.Cols[i].Width = new Unit(0.3, UnitTypeEnum.Cm);
            }  
            for (int col = 0; col < columnText.Length; col++)
            {
             
                   
    
                table.Cells[0, col].Text = string.Format(columnText[col], 0, col);
            
    
            }
           
        
                ra.Children.Add(table);
    
  • Posted 6 November 2018, 12:16 am EST - Updated 4 October 2022, 2:01 am EST

    Hello,

    As suggested in the related thread (https://www.grapecity.com/en/forums/winforms-edition/rendertable-column-size-), you can make use of Width and ColumnSizingMode properties of RenderTable.

    This works the same for columns containing dates as well.

    We tried the same with date in 2nd column and resized its width to 0.3 cm and this is how it looks like:

    Hope it helps.

    Best Regards,

    Esha

Need extra support?

Upgrade your support plan and get personal unlimited phone support with our customer engagement team

Learn More

Forum Channels