Your Privacy Matters: We use our own and third-party cookies to improve your experience on our website. By continuing to use the website we understand that you accept their use. Cookie Policy
1770
When styling border of added table FitTableToWindow does not work
posted

RichTextBorder tableBorder = new RichTextBorder()
{
Color = Color.FromRgb(0, 180, 245),
BorderType = RichTextBorderType.Single,
Size = new Extent(1, ExtentUnitType.LogicalPixels),
};

TableSettings tableSettings = new TableSettings();
tableSettings.Borders = new TableBorderSettings();
tableSettings.Borders.Top = tableBorder;
tableSettings.Borders.Bottom = tableBorder;
tableSettings.Borders.Start = tableBorder;
tableSettings.Borders.End = tableBorder;


var table1Node = ReportDocument.InsertTable(13, 3, 3, out error, TableExtentBehavior.FitTableToWindow);
table1Node.Settings = tableSettings;

In the above code FitTableToWindow does not work if I have table1Node.Settings = tableSettings; so when I style the border. Removing the styling fits the table to the window size.

Am I doing something wrong?

Thanks.

  • 16495
    Verified Answer
    Offline posted

     

    Hello  KrisVice,

     

    Thank you for your post.

     

    I have been looking into the code snippet you have provided and it seems that the behavior that you reported is expected. In order to be able  to achieve this functionality you should set the  PreferredWidth property of TableSettings to 100 and type Percent.

     

     For example:

     

    tableSettings.PreferredWidth = new TableExtent(100, TableExtentUnitType.Percent);

     

     

    Please let me know if you require any further assistance on the matter.