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.
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.