// show report in a PrintPreviewDialog private void ShowReport() { using (C1.Win.C1Preview.C1PrintPreviewDialog dlg = new C1.Win.C1Preview.C1PrintPreviewDialog()) { dlg.Document = this.c1Report1; dlg.PreviewPane.ZoomFactor = 1; dlg.ShowDialog(); } }
private void button2_Click(object sender, EventArgs e) { // show report (contains references to the textBox1 control) using (C1.Win.C1Preview.C1PrintPreviewDialog dlg = new C1.Win.C1Preview.C1PrintPreviewDialog()) { dlg.Document = _c1r; dlg.ShowDialog(); } }
// show report private void _btnRender_Click(object sender, System.EventArgs e) { // render the report _c1r.DoEvents = false; _c1r.Render(); // and show it C1.Win.C1Preview.C1PrintPreviewDialog pd = new C1.Win.C1Preview.C1PrintPreviewDialog(); pd.Document = _c1r; pd.ShowDialog(); }
// show report with current parameters private void _btnPreview_Click(object sender, System.EventArgs e) { // render report Cursor = Cursors.WaitCursor; _c1r.DataSource.RecordSource = _txtQuery.Text; _c1r.Render(); Cursor = Cursors.Default; // and show it in preview dialog C1.Win.C1Preview.C1PrintPreviewDialog ppv = new C1.Win.C1Preview.C1PrintPreviewDialog(); ppv.Document = _c1r; ppv.ShowDialog(); }
void _btnPrint_Click(object sender, System.EventArgs e) { // get rows/cols per page int rpp = 10; int cpp = 3; try { rpp = int.Parse(_rpp.Text); cpp = int.Parse(_cpp.Text); } catch {} // mark grid with row/column breaks C1FlexGrid[] flexArray = { _flex, _flex2 }; foreach (C1FlexGrid flex in flexArray) { for (int r = flex.Rows.Fixed; r < flex.Rows.Count; r++) { flex.Rows[r].UserData = (r % rpp == 0) ? "*" : null; } for (int c = flex.Cols.Fixed; c < flex.Cols.Count; c++) { flex.Cols[c].UserData = (c % cpp == 0) ? "*" : null; } } // print the grid using the specified page/column breaks #if not_needed_for_C1FlexGridPrinter PrintPreviewDialog dlg = new PrintPreviewDialog(); dlg.Document = new FlexPrintDocument("Two Grids", flexArray); dlg.Document.DefaultPageSettings.Landscape = true; dlg.ShowDialog(); #else // make C1PrintDocument containing both grids C1.C1Preview.C1PrintDocument doc = new C1.C1Preview.C1PrintDocument(); C1FlexGridPrinter prn1 = new C1FlexGridPrinter(_flex); C1FlexGridPrinter prn2 = new C1FlexGridPrinter(_flex2); // use landscape: doc.PageLayout.PageSettings.Landscape = true; // add grids to the document: doc.Body.Children.Add(prn1.MakeGridTable(doc)); // add a page break between the grids: doc.Body.Children.Add(new C1.C1Preview.RenderEmpty(C1.C1Preview.BreakEnum.Page)); doc.Body.Children.Add(prn2.MakeGridTable(doc)); C1.Win.C1Preview.C1PrintPreviewDialog pview = new C1.Win.C1Preview.C1PrintPreviewDialog(); pview.Document = doc; pview.ShowDialog(); #endif }
private void button1_Click(object sender, System.EventArgs e) { // first pass: count number of pages in each group _pass = 1; _groupCounts = new Hashtable(); _c1r.Render(); // second pass: set footers _pass = 2; _c1r.Render(); statusBar1.Text = string.Empty; C1.Win.C1Preview.C1PrintPreviewDialog pd = new C1.Win.C1Preview.C1PrintPreviewDialog(); // show it pd.Document = _c1r; pd.ShowDialog(); }
private void btnPreviewSample_Click(object sender, EventArgs e) { C1.C1Preview.C1PrintDocument doc = null; if (_selectedWrapper != null) { doc = _selectedWrapper.MakeDoc(_printInfo, printer_LongOperation); if (doc == null) { C1FlexGrid flex = _selectedWrapper.Flex; if (flex != null) { C1.Win.C1FlexGrid.C1FlexGridPrinter printer = new C1.Win.C1FlexGrid.C1FlexGridPrinter(flex); printer.LongOperation += new C1.C1Preview.LongOperationEventHandler(printer_LongOperation); doc = new C1.C1Preview.C1PrintDocument(); printer.PrintInfo = _printInfo; C1.C1Preview.RenderObject gridRO = printer.MakeGridTable(doc); // if flex grid borders are not printed, provide our own: if (!_printInfo.PrintBorders && chkOverrideBorders.Checked) { gridRO.Style.GridLines.All = new C1.C1Preview.LineDef("0.5pt", Color.LightGray); } doc.Body.Children.Add(gridRO); doc.PageLayout.PageHeader = printer.MakePageHeader(doc); doc.PageLayout.PageFooter = printer.MakePageFooter(doc); } } } if (doc != null) { doc.PageLayout.PageSettings.Landscape = chkLandscape.Checked; C1.Win.C1Preview.C1PrintPreviewDialog pview = new C1.Win.C1Preview.C1PrintPreviewDialog(); // Assign document after showing the dialog - this delays generation // and improves user experience for long documents: // pview.Document = doc; pview.Shown += (o, ev) => { pview.Document = doc; }; pview.ShowDialog(); progressBar1.Value = 0; label2.Text = string.Format((string)label2.Tag, 0); } else { MessageBox.Show("Could not load the selected sample."); } }
private void button2_Click(object sender, System.EventArgs e) { // format with events _script = false; _c1r.PrintSection += new ReportEventHandler(_c1r_PrintSection); // create report CreateReport("Formatted with Events"); // render it Cursor = Cursors.WaitCursor; _c1r.Render(); Cursor = Cursors.Default; // and show it to the user C1.Win.C1Preview.C1PrintPreviewDialog ppv = new C1.Win.C1Preview.C1PrintPreviewDialog(); ppv.Document = _c1r; ppv.ShowDialog(); }
void _btnPrint_Click(object sender, System.EventArgs e) { // get rows/cols per page int rpp = 10; int cpp = 3; try { rpp = int.Parse(_rpp.Text); cpp = int.Parse(_cpp.Text); } catch {} // mark grid with row/column breaks for (int r = _flex.Rows.Fixed; r < _flex.Rows.Count; r++) { _flex.Rows[r].UserData = (r % rpp == 0) ? "*" : null; } for (int c = _flex.Cols.Fixed; c < _flex.Cols.Count; c++) { _flex.Cols[c].UserData = (c % cpp == 0) ? "*" : null; } // print the grid using the specified page/column breaks #if not_needed_for_C1FlexGridPrinter PrintPreviewDialog dlg = new PrintPreviewDialog(); dlg.Document = new FlexPrintDocument(_flex); dlg.ShowDialog(); #else C1.Win.C1Preview.C1PrintPreviewDialog pview = new C1.Win.C1Preview.C1PrintPreviewDialog(); pview.Document = new C1FlexGridPrinter(_flex).MakeDocument(); pview.ShowDialog(); #endif }
private void _btnRender_Click(object sender, System.EventArgs e) { // load NWind Orders table string sql = "select * from orders"; string conn = @"Provider=Microsoft.Jet.OLEDB.4.0;Data Source=" + Environment.GetFolderPath(Environment.SpecialFolder.Personal) + @"\ComponentOne Samples\Common\c1nwind.mdb"; System.Data.OleDb.OleDbDataAdapter da = new System.Data.OleDb.OleDbDataAdapter(sql, conn); DataTable dt = new DataTable(); da.Fill(dt); // use parameterized query mechanism to set up a filter string rs = _c1r.DataSource.RecordSource; _c1r.DataSource.RecordSource = "PARAMETERS [Shipper Code] int 1;" + "ShipVia = [Shipper Code]"; string filter = _c1r.DataSource.GetRecordSource(true); _c1r.DataSource.RecordSource = rs; // show resulting filter _label.Text = filter; // apply custom data source and filter to report _c1r.DataSource.Recordset = dt; _c1r.DataSource.Filter = filter; // show the report C1.Win.C1Preview.C1PrintPreviewDialog p = new C1.Win.C1Preview.C1PrintPreviewDialog(); p.Document = _c1r; p.ShowDialog(); }
// show the report when the user clicks the button private void button1_Click(object sender, System.EventArgs e) { C1.Win.C1Preview.C1PrintPreviewDialog dlg = new C1.Win.C1Preview.C1PrintPreviewDialog(); dlg.Document = this.c1Report1; dlg.ShowDialog(); }
private void button1_Click(object sender, System.EventArgs e) { C1.Win.C1Preview.C1PrintPreviewDialog p = new C1.Win.C1Preview.C1PrintPreviewDialog(); p.Document = _c1r; p.ShowDialog(); }
private void button1_Click(object sender, System.EventArgs e) { // clear report _c1r.Clear(); _c1r.ReportName = "Images"; _c1r.Font = new Font("Tahoma", 9); _c1r.Layout.MarginLeft = 600; // configure detail section Section section = _c1r.Sections[SectionTypeEnum.Detail]; Rectangle rc = new Rectangle(0, 0, 1600, 1200); section.Height = rc.Height; section.Visible = true; section.CanGrow = true; // add fields FieldCollection fc = section.Fields; // create ID field Field f = fc.Add("fldID", "ID", rc); f.Align = FieldAlignEnum.LeftTop; f.Calculated = true; f.BorderStyle = BorderStyleEnum.Solid; // create file name field rc.Offset(rc.Width + 100, 0); f = fc.Add("fldFileName", "FileName", rc); f.Align = FieldAlignEnum.LeftTop; f.WordWrap = true; f.Calculated = true; f.BorderStyle = BorderStyleEnum.Solid; // create 1st image field (directly from db) rc.Offset(rc.Width + 100, 0); rc.Width = 4000; rc.Height = 4000; f = fc.Add("fldImage", "Image", rc); f.Picture = "Image"; f.PictureAlign = PictureAlignEnum.Zoom; f.BorderStyle = BorderStyleEnum.Solid; // create 2nd image field (laoded from file at render time) rc.Offset(rc.Width + 100, 0); f = fc.Add("fldFileImage", "", rc); f.PictureAlign = PictureAlignEnum.Zoom; f.BorderStyle = BorderStyleEnum.Solid; // use script to set Picture property at render time: // this takes the iamge filename from the 'fldFileName' calculated field. section.OnPrint = "fldFileImage.Picture = fldFileName"; // set data source _c1r.DataSource.Recordset = _dt; // show it C1.Win.C1Preview.C1PrintPreviewDialog dlg = new C1.Win.C1Preview.C1PrintPreviewDialog(); dlg.Document = _c1r; dlg.ShowDialog(); }