Obsolete. Use StretchColumns instead.
Namespace:
C1.C1PreviewAssembly: C1.C1Report.2 (in C1.C1Report.2.dll)
Syntax
C# |
---|
[ObsoleteAttribute("Use StretchColumns instead.")] public StretchTableEnum Stretch { get; set; } |
Visual Basic |
---|
<ObsoleteAttribute("Use StretchColumns instead.")> _ Public Property Stretch As StretchTableEnum Get Set |
Examples
The following example uses the Stretch property to stretch the last column on the page to the right edge of the page:
Copy CodeVisual Basic
Private Sub Form1_Load(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles MyBase.Load ' Because we want to show a wide table, we adjust the properties of the preview accordingly: ' Hide all margins. C1PrintPreviewControl1.PreviewPane.HideMarginsState = C1.Win.C1Preview.HideMarginsFlags.All ' Do not allow the user to show margins. C1PrintPreviewControl1.PreviewPane.HideMargins = C1.Win.C1Preview.HideMarginsFlags.None ' Set padding between pages with hidden margins to 0, so that no gap is visible: C1PrintPreviewControl1.PreviewPane.PagesPaddingSmall = New Size(0, 0) ' Set zoom mode: C1PrintPreviewControl1.PreviewPane.ZoomMode = C1.Win.C1Preview.ZoomModeEnum.PageWidth ' Make the document. MakeDoc1(C1PrintDocument1) C1PrintDocument1.Generate() End Sub Private Sub MakeDoc1(ByVal doc As C1.C1Preview.C1PrintDocument) Const ROWS As Integer = 20 Const COLS As Integer = 8 Dim rt As C1.C1Preview.RenderTable = New C1.C1Preview.RenderTable rt.Width = "auto" Dim col As Integer For col = 0 To COLS rt.Cols(col).Width = "5cm" Next ' We want the last column on page to stretch to the right edge of the page, so that there is no white space left before the margin. rt.Stretch = C1.C1Preview.StretchTableEnum.LastColumnOnPage ' For the rightmost column, we turn stretching off: rt.Cols(rt.Cols.Count - 1).Stretch = C1.C1Preview.StretchColumnEnum.No ' Tell the table that it can split horizontally, otherwise the right part of the table will be clipped: rt.CanSplitHorz = True ' Fill table with sample data. Dim row As Integer For row = 0 To ROWS For col = 0 To COLS rt.Cells(row, col).Text = String.Format("Cell ({0}, {1})", row, col) Next Next doc.Body.Children.Add(rt) ' Set up table style. rt.Style.GridLines.All = New C1.C1Preview.LineDef("2pt", Color.Black) rt.Style.GridLines.Horz = New C1.C1Preview.LineDef("1pt", Color.Gray) rt.Style.GridLines.Vert = New C1.C1Preview.LineDef("1pt", Color.Gray) End Sub |
Copy CodeC#
private void Form1_Load(object sender, EventArgs e) { // Because we want to show a wide table, we adjust the properties of the preview accordingly: // Hide all margins. c1PrintPreviewControl1.PreviewPane.HideMarginsState = C1.Win.C1Preview.HideMarginsFlags.All; // Do not allow the user to show margins. c1PrintPreviewControl1.PreviewPane.HideMargins = C1.Win.C1Preview.HideMarginsFlags.None; // Set padding between pages with hidden margins to 0, so that no gap is visible. c1PrintPreviewControl1.PreviewPane.PagesPaddingSmall = new Size(0, 0); // Set zoom mode. c1PrintPreviewControl1.PreviewPane.ZoomMode = C1.Win.C1Preview.ZoomModeEnum.PageWidth; // Make the document. MakeDoc1(c1PrintDocument1); c1PrintDocument1.Reflow(); } private void MakeDoc1(C1PrintDocument doc) { const int ROWS = 20; const int COLS = 8; // Make the table. C1.C1Preview.RenderTable rt = new C1.C1Preview.RenderTable(); // For tables, "auto" width means that the width of the table will be equal to the widths of all columns, so we MUST also set the columns' widths. rt.Width = "auto"; for (int col = 0; col < COLS; ++col) rt.Cols[col].Width = "5cm"; // We want the last column on page to stretch to the right edge of the page, so that there is no white space left before the margin. rt.Stretch = C1.C1Preview.StretchTableEnum.LastColumnOnPage; // For the rightmost column, we turn stretching off: rt.Cols[rt.Cols.Count - 1].Stretch = C1.C1Preview.StretchColumnEnum.No; // Tell the table that it can split horizontally, otherwise the right part of the table will be clipped: rt.CanSplitHorz = true; // Fill table with sample data. for (int row = 0; row < ROWS; ++row) { for (int col = 0; col < COLS; ++col) { rt.Cells[row, col].Text = string.Format("Cell ({0}, {1})", row, col); } } // Add the table to the document. doc.Body.Children.Add(rt); // Set up table style. rt.Style.GridLines.All = new C1.C1Preview.LineDef("2pt", Color.Black); rt.Style.GridLines.Horz = new C1.C1Preview.LineDef("1pt", Color.Gray); rt.Style.GridLines.Vert = new C1.C1Preview.LineDef("1pt", Color.Gray); } |
For more information on this example, see the WideTables sample.