void flex_PrintCell(object sender, C1FlexGridPrintable2.PrintCellEventArgs e) { C1FlexGridPrintable2 flex = (C1FlexGridPrintable2)sender; // test for column break: if (flex.Cols[e.Col].UserData != null && flex.Cols[e.Col].UserData.ToString() == "*") { e.TableCell.Table.Cols[e.TableCell.Col].PageBreakBehavior = C1.C1Preview.PageBreakBehaviorEnum.MustBreak; } // test for row break: if (flex.Rows[e.Row].UserData != null && flex.Rows[e.Row].UserData.ToString() == "*") { e.TableCell.Table.Rows[e.TableCell.Row].PageBreakBehavior = C1.C1Preview.PageBreakBehaviorEnum.MustBreak; } // that's it. }
public void _flex_PrintCell(object sender, C1FlexGridPrintable2.PrintCellEventArgs e) { C1FlexGridPrintable2 flex = (C1FlexGridPrintable2)sender; // check if this is a row break if (flex.Rows[e.Row].UserData != null && flex.Rows[e.Row].UserData.ToString() == "*") { C1.C1Preview.RenderTable rtbl = e.TableCell.Table; int tblRow = e.TableCell.Row; // the marks are on LAST rows on page while PageBreakBehavior determines break BEFORE row, hence "+1": rtbl.Rows[tblRow + 1].PageBreakBehavior = C1.C1Preview.PageBreakBehaviorEnum.MustBreak; } // check if this is a column break if (flex.Cols[e.Col].UserData != null && flex.Cols[e.Col].UserData.ToString() == "*") { C1.C1Preview.RenderTable rtbl = e.TableCell.Table; int tblCol = e.TableCell.Col; // see comment above re "+1": rtbl.Cols[tblCol + 1].PageBreakBehavior = C1.C1Preview.PageBreakBehaviorEnum.MustBreak; } }
/// <summary> /// Required method for Designer support - do not modify /// the contents of this method with the code editor. /// </summary> private void InitializeComponent() { System.ComponentModel.ComponentResourceManager resources = new System.ComponentModel.ComponentResourceManager(typeof(Form1)); this._flex = new C1.Win.C1FlexGrid.C1FlexGridPrintable2(); this._btnPrint = new System.Windows.Forms.Button(); this.label1 = new System.Windows.Forms.Label(); this.label2 = new System.Windows.Forms.Label(); this._rpp = new System.Windows.Forms.TextBox(); this._cpp = new System.Windows.Forms.TextBox(); this._flex2 = new C1.Win.C1FlexGrid.C1FlexGridPrintable2(); this.splitContainer1 = new System.Windows.Forms.SplitContainer(); ((System.ComponentModel.ISupportInitialize)(this._flex)).BeginInit(); ((System.ComponentModel.ISupportInitialize)(this._flex2)).BeginInit(); this.splitContainer1.Panel1.SuspendLayout(); this.splitContainer1.Panel2.SuspendLayout(); this.splitContainer1.SuspendLayout(); this.SuspendLayout(); // // _flex // this._flex.ColumnInfo = "10,1,0,0,0,95,Columns:0{Width:22;}\t"; this._flex.Dock = System.Windows.Forms.DockStyle.Fill; this._flex.Location = new System.Drawing.Point(0, 0); this._flex.Name = "_flex"; this._flex.Rows.DefaultSize = 17; this._flex.Size = new System.Drawing.Size(237, 351); this._flex.StyleInfo = resources.GetString("_flex.StyleInfo"); this._flex.TabIndex = 0; // // _btnPrint // this._btnPrint.Location = new System.Drawing.Point(242, 5); this._btnPrint.Name = "_btnPrint"; this._btnPrint.Size = new System.Drawing.Size(85, 23); this._btnPrint.TabIndex = 1; this._btnPrint.Text = "Print"; this._btnPrint.Click += new System.EventHandler(this._btnPrint_Click); // // label1 // this.label1.Location = new System.Drawing.Point(2, 7); this.label1.Name = "label1"; this.label1.Size = new System.Drawing.Size(67, 21); this.label1.TabIndex = 2; this.label1.Text = "Rows/page:"; this.label1.TextAlign = System.Drawing.ContentAlignment.MiddleLeft; // // label2 // this.label2.Location = new System.Drawing.Point(121, 7); this.label2.Name = "label2"; this.label2.Size = new System.Drawing.Size(60, 21); this.label2.TabIndex = 2; this.label2.Text = "Cols/page:"; this.label2.TextAlign = System.Drawing.ContentAlignment.MiddleLeft; // // _rpp // this._rpp.Location = new System.Drawing.Point(74, 7); this._rpp.Name = "_rpp"; this._rpp.Size = new System.Drawing.Size(34, 20); this._rpp.TabIndex = 3; this._rpp.Text = "60"; // // _cpp // this._cpp.Location = new System.Drawing.Point(186, 7); this._cpp.Name = "_cpp"; this._cpp.Size = new System.Drawing.Size(32, 20); this._cpp.TabIndex = 3; this._cpp.Text = "6"; // // _flex2 // this._flex2.ColumnInfo = "10,1,0,0,0,95,Columns:0{Width:26;}\t"; this._flex2.Dock = System.Windows.Forms.DockStyle.Fill; this._flex2.Location = new System.Drawing.Point(0, 0); this._flex2.Name = "_flex2"; this._flex2.Rows.DefaultSize = 17; this._flex2.Size = new System.Drawing.Size(322, 351); this._flex2.StyleInfo = resources.GetString("_flex2.StyleInfo"); this._flex2.TabIndex = 4; // // splitContainer1 // this.splitContainer1.Dock = System.Windows.Forms.DockStyle.Fill; this.splitContainer1.FixedPanel = System.Windows.Forms.FixedPanel.Panel1; this.splitContainer1.Location = new System.Drawing.Point(0, 40); this.splitContainer1.Name = "splitContainer1"; // // splitContainer1.Panel1 // this.splitContainer1.Panel1.Controls.Add(this._flex); // // splitContainer1.Panel2 // this.splitContainer1.Panel2.Controls.Add(this._flex2); this.splitContainer1.Size = new System.Drawing.Size(563, 351); this.splitContainer1.SplitterDistance = 237; this.splitContainer1.TabIndex = 5; // // Form1 // this.AutoScaleBaseSize = new System.Drawing.Size(5, 13); this.ClientSize = new System.Drawing.Size(563, 391); this.Controls.Add(this.splitContainer1); this.Controls.Add(this._rpp); this.Controls.Add(this.label1); this.Controls.Add(this._btnPrint); this.Controls.Add(this.label2); this.Controls.Add(this._cpp); this.Name = "Form1"; this.Padding = new System.Windows.Forms.Padding(0, 40, 0, 0); this.StartPosition = System.Windows.Forms.FormStartPosition.CenterScreen; this.Text = "C1FlexGrid: Print Multiple Grids in a Single Document"; this.Load += new System.EventHandler(this.Form1_Load); ((System.ComponentModel.ISupportInitialize)(this._flex)).EndInit(); ((System.ComponentModel.ISupportInitialize)(this._flex2)).EndInit(); this.splitContainer1.Panel1.ResumeLayout(false); this.splitContainer1.Panel2.ResumeLayout(false); this.splitContainer1.ResumeLayout(false); this.ResumeLayout(false); this.PerformLayout(); }
public FlexPdfCreator(C1FlexGridPrintable2 flex) { flex.PrintCell += new C1FlexGridPrintable2.PrintCellEventHandler(flex_PrintCell); _printer = new C1FlexGridPrinter(flex); }