private void button1_Click(object sender, EventArgs e) { PrintingSystem ps = new PrintingSystem(); PrintableComponentLink link = new PrintableComponentLink(ps); link.Component = pivotGridControl1; PageSettings pageSettings = pivotGridControl1.OptionsPrint.PageSettings.ToPageSettings(); link.PaperKind = pageSettings.PaperSize.Kind; if (pageSettings.PaperSize.Width != 0 && pageSettings.PaperSize.Height != 0) { link.CustomPaperSize = new Size(pageSettings.PaperSize.Width, pageSettings.PaperSize.Height); } link.PaperName = pageSettings.PaperSize.PaperName; link.Landscape = pageSettings.Landscape; link.Margins = pageSettings.Margins; link.ShowPreviewDialog(this); PivotGridPageSettings pivotSettings = pivotGridControl1.OptionsPrint.PageSettings; pivotSettings.PaperKind = link.PaperKind; if (pivotSettings.PaperKind == PaperKind.Custom) { pivotSettings.PaperWidth = link.CustomPaperSize.Width; pivotSettings.PaperHeight = link.CustomPaperSize.Height; } pivotSettings.Landscape = link.Landscape; pivotSettings.Margins = link.Margins; link.Dispose(); ps.Dispose(); }
private void Form_PrintButtonClicked(object pSender, EventArgs pEventArgs) { try { CoFAS_DevExpressManager.SetCursor(this, Cursors.WaitCursor); using (PrintingSystem printingSystem = new PrintingSystem()) { using (PrintableComponentLink link = new PrintableComponentLink(printingSystem)) { link.Component = wb; link.CreateDocument(); link.ShowPreviewDialog(); } } } catch (ExceptionManager pExceptionManager) { CoFAS_DevExpressManager.ShowErrorMessage(string.Format("{0}\n{1}", pExceptionManager.Exception.Message.ToString(), pExceptionManager.TargetSite.ToString())); } finally { CoFAS_DevExpressManager.SetCursor(this, Cursors.Default); } }
private void btnPrint_Click(object sender, EventArgs e) { PrintableComponentLink pcl = new PrintableComponentLink(new PrintingSystem()); pcl.Component = this.schedulerControl1; // Set page margins. pcl.Margins = new System.Drawing.Printing.Margins(30, 30, 30, 30); DailyPrintStyle pStyle = this.schedulerControl1.ActivePrintStyle as DailyPrintStyle; // Set fonts for appointments and column headings. pStyle.AppointmentFont = new Font("Arial", 8, FontStyle.Regular); pStyle.HeadingsFont = new Font("Arial", 10, FontStyle.Regular); // Specify whether the Calendar header should be printed. pStyle.CalendarHeaderVisible = false; // Specify the intervals to print. pStyle.PrintTime = new TimeOfDayInterval(timeEdit1.Time.TimeOfDay, timeEdit2.Time.TimeOfDay); pStyle.StartRangeDate = dateEdit1.DateTime.Date; pStyle.EndRangeDate = dateEdit2.DateTime.Date; // Specify resources to print. pStyle.ResourceOptions.CustomResourcesCollection.Add(schedulerStorage1.Resources[0]); pStyle.ResourceOptions.PrintCustomCollection = true; pStyle.PrintAllAppointments = false; pcl.CreateDocument(); pcl.ShowPreviewDialog(); }
private void btnPrint_Click(object sender, EventArgs e) { grdViewSTVForChecking.OptionsPrint.AutoWidth = true; var pcLink = new PrintableComponentLink(new PrintingSystem()) {Component = grdSTVs, Landscape = true}; pcLink.CreateDocument(); pcLink.ShowPreviewDialog(); }
private void ImprimirGrid() { /******************************/ // Creamos el Header PageHeaderArea Header = new PageHeaderArea(); ComponenteImpresion.Images.Add(Image.FromFile(Environment.CurrentDirectory + "\\logomini.png")); Header.Content.AddRange(new string[] { "[Image 0]", Properties.Settings.Default.Sucursal, "[Time Printed]" }); Header.LineAlignment = BrickAlignment.Far; /******************************/ /******************************/ //Creamos el Footer string izquierda = "Paginas: [Page # of Pages #]"; string centro = "Usuario: [User Name]"; string derecha = "Fecha: [Date Printed]"; PageFooterArea Footer = new PageFooterArea(); Footer.Content.AddRange(new string[] { izquierda, centro, derecha }); Footer.LineAlignment = BrickAlignment.Near; /*****************************/ /******************************/ //Agregar el Grid al documento ComponenteImpresion.Component = gridEtiquetas; //Agregar el header y el footer al documento ComponenteImpresion.PageHeaderFooter = new PageHeaderFooter(Header, Footer); //Crear el documento ComponenteImpresion.CreateDocument(SistemaImpresion); //Mostrar la vista previa para imprimir ComponenteImpresion.ShowPreviewDialog(); }
private void Imprimir() { PrintableComponentLink link = new PrintableComponentLink(new PrintingSystem()); PageHeaderArea headerArea; headerArea = new PageHeaderArea(); headerArea.Content.Add(Environment.NewLine); headerArea.Content.Add(Properties.Settings.Default.Sucursal); headerArea.Content.Add(DateTime.Today.ToShortDateString()); headerArea.LineAlignment = BrickAlignment.Center; PageFooterArea footerArea; PageHeaderFooter headerfooter; footerArea = new PageFooterArea(); footerArea.Content.Add("[Page #]"); footerArea.LineAlignment = BrickAlignment.Far; headerfooter = new PageHeaderFooter(headerArea, footerArea); link.PageHeaderFooter = headerfooter; link.Component = gridExistencia; link.CreateDocument(); this.gvExistencia.FocusedRowHandle = -1; link.ShowPreviewDialog(); }
static void Print(IWorkbook workbook) { Worksheet worksheet = workbook.Worksheets[0]; // Generate worksheet content - the simple multiplication table. CellRange columnHeadings = worksheet.Range.FromLTRB(1, 0, 40, 0); columnHeadings.Formula = "=COLUMN() - 1"; CellRange rowHeadings = worksheet.Range.FromLTRB(0, 1, 0, 40); rowHeadings.Formula = "=ROW() - 1"; CellRange tableRange = worksheet.Range.FromLTRB(1, 1, 40, 40); tableRange.Formula = "=(ROW()-1)*(COLUMN()-1)"; // Format headers of the multiplication table. Formatting rangeFormatting = columnHeadings.BeginUpdateFormatting(); rangeFormatting.Borders.BottomBorder.LineStyle = BorderLineStyle.Thin; rangeFormatting.Borders.BottomBorder.Color = Color.Black; columnHeadings.EndUpdateFormatting(rangeFormatting); rangeFormatting = rowHeadings.BeginUpdateFormatting(); rangeFormatting.Borders.RightBorder.LineStyle = BorderLineStyle.Thin; rangeFormatting.Borders.RightBorder.Color = Color.Black; rowHeadings.EndUpdateFormatting(rangeFormatting); rangeFormatting = tableRange.BeginUpdateFormatting(); rangeFormatting.Fill.BackgroundColor = Color.LightBlue; tableRange.EndUpdateFormatting(rangeFormatting); #region #WorksheetPrintOptions worksheet.ActiveView.Orientation = PageOrientation.Landscape; // Display row and column headings. worksheet.ActiveView.ShowHeadings = true; worksheet.ActiveView.PaperKind = System.Drawing.Printing.PaperKind.A4; // Access an object that contains print options. WorksheetPrintOptions printOptions = worksheet.PrintOptions; // Do not print gridlines. printOptions.PrintGridlines = false; // Scale the print area to fit to two pages wide. printOptions.FitToPage = true; printOptions.FitToWidth = 2; // Print a dash instead of a cell error message. printOptions.ErrorsPrintMode = ErrorsPrintMode.Dash; #endregion #WorksheetPrintOptions #region #PrintWorkbook // Invoke the Print Preview dialog for the workbook. using (PrintingSystem printingSystem = new PrintingSystem()) { using (PrintableComponentLink link = new PrintableComponentLink(printingSystem)) { link.Component = workbook; link.CreateDocument(); link.ShowPreviewDialog(); } } #endregion #PrintWorkbook }
private void button1_Click_1(object sender, EventArgs e) { PrintableComponentLink pcl = new PrintableComponentLink(new PrintingSystem()); pcl.Component = gridControl1; pcl.CreateReportHeaderArea += new CreateAreaEventHandler(pcl_CreateReportHeaderArea); pcl.CreateDocument(); pcl.ShowPreviewDialog(); }
private void printExportItem_ItemClick(object sender, DevExpress.XtraBars.ItemClickEventArgs e) { //grid.ShowPrintPreview(); var ps = new PrintingSystem(); var link = new PrintableComponentLink(ps); link.Component = grid; link.ShowPreviewDialog(); }
//YAZDIRMA private void btnYazdir_Click(object sender, EventArgs e) { PrintableComponentLink yazdir = new PrintableComponentLink(new PrintingSystem()); yazdir.Component = gridFaturaDetay; yazdir.CreateDocument(); PrintTool printTool = new PrintTool(yazdir.PrintingSystemBase); yazdir.ShowPreviewDialog(); }
private void btnPrint_Click(object sender, EventArgs e) { grdViewSTVForChecking.OptionsPrint.AutoWidth = true; var pcLink = new PrintableComponentLink(new PrintingSystem()) { Component = grdSTVs, Landscape = true }; pcLink.CreateDocument(); pcLink.ShowPreviewDialog(); }
public void print() { using (PrintingSystem printingSystem = new PrintingSystem()) { using (PrintableComponentLink link = new PrintableComponentLink(printingSystem)) { link.Component = wb; link.CreateDocument(); link.ShowPreviewDialog(); } } }
private void btnPrint_Click(object sender, EventArgs e) { this.gridView1.OptionsSelection.MultiSelectMode = DevExpress.XtraGrid.Views.Grid.GridMultiSelectMode.RowSelect; PrintableComponentLink pl = new PrintableComponentLink(new PrintingSystem()); pl.Component = gridControl1; pl.CreateMarginalHeaderArea += new CreateAreaEventHandler(Pl_CreateReportHeaderArea); pl.CreateDocument(); pl.ShowPreviewDialog(); this.gridView1.OptionsSelection.MultiSelectMode = DevExpress.XtraGrid.Views.Grid.GridMultiSelectMode.CheckBoxRowSelect; }
private void btnPrintPreview_Click(object sender, EventArgs e) { // Create a list view. PrintableListView printableListView = CreatePrintableListView(); // Create a link. PrintableComponentLink link = new PrintableComponentLink(new PrintingSystem()); // Assign a list view to a link. link.Component = printableListView; // Show the Print Preview for a link. link.ShowPreviewDialog(); }
private void BtnPrint_Click(object sender, EventArgs e) { //xList.ShowPrintPreview(); mlink = new PrintableComponentLink() { PrintingSystemBase = new PrintingSystemBase(), Component = xList, Landscape = true, PaperKind = PaperKind.A4, Margins = new Margins(20, 20, 50, 20), }; mlink.CreateMarginalHeaderArea += link_CreateMarginalHeaderArea; mlink.ShowPreviewDialog(); }
private void btn_Print_Click(object sender, EventArgs e) { #region #serverprint RichEditDocumentServer richServer = new RichEditDocumentServer(); // Specify default formatting richServer.Document.DefaultParagraphProperties.Alignment = ParagraphAlignment.Center; // Specify page settings richServer.Document.Sections[0].Page.Landscape = true; richServer.Document.Sections[0].Page.Height = DevExpress.Office.Utils.Units.InchesToDocumentsF(10.0f); richServer.Document.Sections[0].Page.Width = DevExpress.Office.Utils.Units.InchesToDocumentsF(4.5f); // Add document content richServer.Document.AppendText("This content is created programmatically\n"); richServer.Document.Paragraphs.Append(); //Create a table richServer.BeginUpdate(); Table _table = richServer.Document.Tables.Create(richServer.Document.Selection.Start, 8, 8, AutoFitBehaviorType.FixedColumnWidth); _table.BeginUpdate(); _table.Borders.InsideHorizontalBorder.LineThickness = 1; _table.Borders.InsideHorizontalBorder.LineStyle = TableBorderLineStyle.Double; _table.Borders.InsideVerticalBorder.LineThickness = 1; _table.Borders.InsideVerticalBorder.LineStyle = TableBorderLineStyle.Double; _table.TableAlignment = TableRowAlignment.Center; _table.ForEachCell((cell, rowIndex, columnIndex) => { richServer.Document.InsertText(cell.Range.Start, String.Format("{0}*{1} is {2}", rowIndex + 2, columnIndex + 2, (rowIndex + 2) * (columnIndex + 2))); }); _table.EndUpdate(); richServer.EndUpdate(); // Invoke the Print Preview dialog using (PrintingSystem printingSystem = new PrintingSystem()) { using (PrintableComponentLink link = new PrintableComponentLink(printingSystem)) { link.Component = richServer; link.CreateDocument(); link.ShowPreviewDialog(); } } #endregion #serverprint }
public void Print() { if (wb_Ngay == null) { return; } using (PrintingSystem printingSystem = new PrintingSystem()) { using (PrintableComponentLink link = new PrintableComponentLink(printingSystem)) { link.Component = wb_Ngay; link.CreateDocument(); link.ShowPreviewDialog(); } } }
private static void PreparePrint(IPrintable printControl, PageHeaderFooter headerFooter) { PrintingSystem printingSystem = new PrintingSystem(); PrintableComponentLink printableCompLink = new PrintableComponentLink(); printingSystem.Links.Add(printableCompLink); printableCompLink.Margins = new System.Drawing.Printing.Margins(50, 50, 50, 50); printableCompLink.PaperKind = System.Drawing.Printing.PaperKind.A4; printableCompLink.VerticalContentSplitting = VerticalContentSplitting.Smart; printableCompLink.Component = printControl; printableCompLink.PageHeaderFooter = headerFooter; printableCompLink.CreateDocument(); printableCompLink.ShowPreviewDialog(); }
public void Print() { if ((wb_HK == null && wb_Tuan == null) || (!xlsxViewer.Visible && !TKBTuanViewer.Visible)) { return; } using (PrintingSystem printingSystem = new PrintingSystem()) { using (PrintableComponentLink link = new PrintableComponentLink(printingSystem)) { link.Component = (formulaBar.SpreadsheetControl == xlsxViewer) ? wb_HK : wb_Tuan; link.CreateDocument(); link.ShowPreviewDialog(); } } }
public void print() { if (lops == null) { return; } if (lops.Count == 0) { return; } using (PrintingSystem printingSystem = new PrintingSystem()) { using (PrintableComponentLink link = new PrintableComponentLink(printingSystem)) { link.Component = wb; link.CreateDocument(); link.ShowPreviewDialog(); } } }
/// <summary> /// Zeigt die Druckvorschau für den Inhalt des PivotGridControls an /// </summary> /// <param name="title">der Titel des Druckdokuments</param> /// <param name="description">die Beschreibung der Abfrage</param> public void ShowPrintPreview(string title, string description) { PrintingSystem printingSystem = new PrintingSystem(); printingSystem.Document.Name = title; PrintableComponentLink printableComponentLink = new PrintableComponentLink(printingSystem); printableComponentLink.Component = this; PageHeaderFooter pageHeaderFooter = printableComponentLink.PageHeaderFooter as PageHeaderFooter; pageHeaderFooter.Header.Content.AddRange(new[] { " \r\n \r\n " + description, title, "" }); pageHeaderFooter.Footer.Content.AddRange(new[] { "[Druckdatum] [Druckzeitpunkt]", "", "Seite [Seite # von #]" }); this.OptionsPrint.PrintHeadersOnEveryPage = true; this.OptionsPrint.PrintFilterHeaders = DefaultBoolean.False; this.OptionsPrint.PageSettings.PaperKind = PaperKind.A4; printableComponentLink.CreateDocument(); printableComponentLink.ShowPreviewDialog(); }
public static void ShowPrintPreview(IDocumentData documentData, IObjectSpace objectSpace, CriteriaOperator inPlaceCriteria) { using (SnapDocumentServer server = new SnapDocumentServer()) { SnapDocumentHelper helper = new SnapDocumentHelper(documentData, objectSpace, null, inPlaceCriteria); helper.LoadDocument(server.Document); // Mail Merge if (server.Document.DataSources.Count == 1 && server.Options.SnapMailMergeVisualOptions.DataSource == server.Document.DataSources[0].DataSource) { using (MemoryStream stream = new MemoryStream()) { server.SnapMailMerge(stream, SnapDocumentFormat.Snap); stream.Flush(); stream.Seek(0, SeekOrigin.Begin); server.LoadDocument(stream, SnapDocumentFormat.Snap); } } using (PrintingSystem ps = new PrintingSystem()) { PrintableComponentLink link = new PrintableComponentLink(ps); link.Component = server; link.CreateDocument(); link.ShowPreviewDialog(); } } }
private void PrintGrid(GridControl gc) { //GridView gvwContact = (GridView) gc.DefaultView; string strHeader = strMenuOption; strHeader = strHeader.Remove(strHeader.Length - 3, 3); //strHeader += " Information"; PageHeaderFooter phf = new PageHeaderFooter(); phf.Header.Font = new Font("Arial", 15, FontStyle.Bold, GraphicsUnit.Point); phf.Header.Content.Add(strHeader); PrintableComponentLink _link = new PrintableComponentLink(new PrintingSystem()); _link.Component = gc; _link.Landscape = true; _link.PageHeaderFooter = phf; _link.PaperKind = PaperKind.A4; _link.Margins.Top = 60; _link.Margins.Bottom = 60; _link.Margins.Right = 10; _link.Margins.Left = 10; _link.ShowPreviewDialog(); /* PrinterSettings settings = printDocument1.PrinterSettings; //Set PageSize to 'A4' bool found=false; foreach (PaperSize size in settings.PaperSizes) { if (size.PaperName == "A4, 210x297 mm") found = true; if (found) { settings.DefaultPageSettings.PaperSize = size; break; } else continue; } printDocument1.DefaultPageSettings.Landscape = true; printDocument1.DefaultPageSettings.Margins = new Margins(50, 50, 15, 50); //printDocument1.DefaultPageSettings.PaperSize = new PaperSize("A4, 210x297 mm", 827, 1169); dataGridPrinter1 = new GridViewPrinter(gc, printDocument1, gvwContact); dataGridPrinter1.PageNumber = 1; dataGridPrinter1.RowCount = 0; if (printPreviewDialog1.ShowDialog() == DialogResult.OK) { }*/ }
private void exportSatis(string dil, bool eMail = false) { int tstID = (int)tstGridView.GetFocusedRowCellValue(colTSTIDt); rprTklfTableAdapter.Fill(teklifDataSet.RPR_TKLF, tstID, dil); TeklifDataSet.RPR_TKLFRow rprTklfRow = (TeklifDataSet.RPR_TKLFRow)teklifDataSet.RPR_TKLF.Rows[0]; string tklfTE = "Teklif"; if (dil == "T") { colORGf.Caption = "Çıkış"; colDSTf.Caption = "Varış"; colBRMf.Caption = "Birim"; colTRNTIMEf.Caption = "Transit Süre"; colSKDY.Caption = "KDV%"; colSDVZf.Caption = "Para Birim"; colSFYTf.Caption = "Fiyat"; colSFYT1f.Caption = "Min"; colSFYT2f.Caption = "-45"; colSFYT3f.Caption = "+45"; colSFYT4f.Caption = "+100"; colSFYT5f.Caption = "+250"; colSFYT6f.Caption = "+300"; colSFYT7f.Caption = "+500"; colSFYT8f.Caption = "+1000"; colSFYTE.Caption = "Fiyat"; colSFYT1E.Caption = "Min"; colSFYT2E.Caption = "-45"; colSFYT3E.Caption = "+45"; colSFYT4E.Caption = "+100"; colSFYT5E.Caption = "+250"; colSFYT6E.Caption = "+300"; colSFYT7E.Caption = "+500"; colSFYT8E.Caption = "+1000"; } else { tklfTE = "Tender"; colORGf.Caption = "Origin"; colDSTf.Caption = "Destination"; colBRMf.Caption = "Unit"; colTRNTIMEf.Caption = "Transit Time"; colSKDY.Caption = "%VAT"; colSDVZf.Caption = "Currency"; colSFYTf.Caption = "Rate"; colSFYT1f.Caption = "Min"; colSFYT2f.Caption = "-45"; colSFYT3f.Caption = "+45"; colSFYT4f.Caption = "+100"; colSFYT5f.Caption = "+250"; colSFYT6f.Caption = "+300"; colSFYT7f.Caption = "+500"; colSFYT8f.Caption = "+1000"; colSFYTE.Caption = "Rate"; colSFYT1E.Caption = "Min"; colSFYT2E.Caption = "-45"; colSFYT3E.Caption = "+45"; colSFYT4E.Caption = "+100"; colSFYT5E.Caption = "+250"; colSFYT6E.Caption = "+300"; colSFYT7E.Caption = "+500"; colSFYT8E.Caption = "+1000"; } if (colG9.GroupIndex == 0) { tsfGridView.CollapseAllGroups(); //tsfGridView.OptionsView.ShowFooter = true; tsfGridView.OptionsPrint.ExpandAllGroups = false; tsfGridView.OptionsPrint.PrintFooter = true; //tsfGridView.OptionsPrint.AutoWidth = false; tsfGridView.OptionsPrint.AutoWidth = true; } else { tsfGridView.ExpandAllGroups(); //tsfGridView.OptionsView.ShowFooter = false; tsfGridView.OptionsPrint.ExpandAllGroups = true; tsfGridView.OptionsPrint.PrintFooter = false; //tsfGridView.OptionsPrint.AutoWidth = false; tsfGridView.OptionsPrint.AutoWidth = true; //tsfGridView.BestFitColumns(); } RichEditDocumentServer richServer = new RichEditDocumentServer(); richServer.RtfText = rprTklfRow.ALTNOT; //richServer.Document.AppendText(" SENER"); if (!rprTklfRow.IsDTYNOTNull()) { if (string.IsNullOrEmpty(richServer.Text)) { richServer.RtfText = rprTklfRow.DTYNOT; } else { richServer.Document.AppendRtfText(rprTklfRow.DTYNOT); } } tsfGridView.OptionsPrint.RtfReportFooter = richServer.RtfText; tsfGridView.OptionsPrint.RtfPageFooter = rprTklfRow.FOOTER; PrintingSystem ps = new PrintingSystem(); PrintableComponentLink link = new PrintableComponentLink(ps); link.Component = tsfGridControl; link.PaperKind = System.Drawing.Printing.PaperKind.A4; link.Landscape = false; link.Margins.Left = 10; link.Margins.Right = 10; link.Margins.Top = 10; link.Margins.Bottom = 10; // tsfGridView.OptionsPrint.RtfPageHeader = tsfGridView.OptionsPrint.RtfReportHeader = rprTklfRow.USTNOT .Replace("@TSTID@", rprTklfRow.TSTID.ToString()) .Replace("@FIRMA@", rprTklfRow.FIRMA) .Replace("@TLPTRH@", rprTklfRow.TLPTRHS) .Replace("@TKLTRH@", rprTklfRow.TKLTRHS) .Replace("@GCRTRH@", rprTklfRow.GCRTRHS) .Replace("@ROT@", rprTklfRow.ROT) .Replace("@MOT@", rprTklfRow.MOT) .Replace("@PTM@", rprTklfRow.PTM) .Replace("@DTM@", rprTklfRow.DTM) .Replace("@HORGS@", rprTklfRow.HORGS) .Replace("@HDSTS@", rprTklfRow.HDSTS) .Replace("@MORGS@", rprTklfRow.MORGS) .Replace("@MDSTS@", rprTklfRow.MDSTS) .Replace("@MALCINSI@", rprTklfRow["MALCINSI"].ToString()) .Replace("@INFO@", rprTklfRow.INFO); link.CreateDocument(); if (eMail) { if (string.IsNullOrWhiteSpace(rprTklfRow.EMAILS)) { XtraMessageBox.Show("eMail adresi bulunamadı", "eMail Teklif", MessageBoxButtons.OK, MessageBoxIcon.Stop); return; } Cursor = Cursors.WaitCursor; try { MainDataSet.SMTPRow SMTP = Program.MF.SMTP(); MailMessage mail = new MailMessage(); // Create a new memory stream and export the report into it as PDF. MemoryStream ms = new MemoryStream(); link.ExportToPdf(ms); // Create a new attachment and put the PDF report into it. ms.Seek(0, System.IO.SeekOrigin.Begin); Attachment att = new Attachment(ms, string.Format("{0}-{1}.pdf", tklfTE, tstID), "application/pdf"); mail.Attachments.Add(att); mail.To.Add(rprTklfRow.EMAILS); mail.Subject = rprTklfRow.EMAILSUBJECT; mail.Body = rprTklfRow.EMAILBODY; mail.IsBodyHtml = true; mail.From = new MailAddress(SMTP.MAIL_FROM_ADDRESS, SMTP.MAIL_FROM_DISPLAY_NAME); SmtpClient smtp = new SmtpClient(SMTP.CLIENT_HOST); smtp.Credentials = new System.Net.NetworkCredential(SMTP.CREDENTIALS_USER_NAME, SMTP.CREDENTIALS_USER_PASSWORD); smtp.EnableSsl = SMTP.ENABLE_SSL == "T" ? true : false; smtp.Port = SMTP.PORT; smtp.Send(mail); int len = (int)ms.Length; byte[] img = new byte[len]; ms.Read(img, 0, len); //teklifQueriesTableAdapter.DOC_INS2("TST", tstID, "Teklif", ".pdf", "TKLF", Program.USR, len, img); teklifQueriesTableAdapter.DOC_INS2("TST", tstID, string.Format("Teklif {0}", tstGridView.GetFocusedRowCellValue(colRVSNOt)), ".pdf", "TKLF", Program.USR, len, img); // Close the memory stream. ms.Close(); ms.Flush(); rptInfo rpti = new rptInfo(); rpti.put("TKLF", "TST", tstID, Program.USR, "F", "eMail Teklif"); Program.MF.reportDone(rpti, false); } catch (Exception ex) { MessageBox.Show(this, "Error sending eMail.\n" + ex.ToString()); } finally { Cursor = Cursors.Default; } } else { link.ShowPreviewDialog(); if (XtraMessageBox.Show("İşlem tamamlandı mı?", "Print", MessageBoxButtons.YesNo, MessageBoxIcon.Question, MessageBoxDefaultButton.Button2) == DialogResult.Yes) { MemoryStream ms = new MemoryStream(); link.ExportToPdf(ms); ms.Seek(0, System.IO.SeekOrigin.Begin); int len = (int)ms.Length; byte[] img = new byte[len]; ms.Read(img, 0, len); ms.Close(); teklifQueriesTableAdapter.DOC_INS2("TST", tstID, string.Format("Teklif {0}", tstGridView.GetFocusedRowCellValue(colRVSNOt)), ".pdf", "TKLF", Program.USR, len, img); rptInfo rpti = new rptInfo(); rpti.put("TKLF", "TST", tstID, Program.USR, "F", "eMail Teklif"); Program.MF.reportDone(rpti, false); } } }
public void PrintGrid(DevExpress.XtraGrid.GridControl gc, bool printPreview) { //GridView gvwContact = (GridView) gc.DefaultView; // string strHeader = strMenuOption; //strHeader = strHeader.Remove(strHeader.Length - 3, 3); //strHeader += " Information"; PageHeaderFooter phf = new PageHeaderFooter(); phf.Header.Font = new Font("Arial", 15, FontStyle.Bold, GraphicsUnit.Point); string str = ""; phf.Header.LineAlignment = BrickAlignment.Near; str = "Pay Details By Instructor"; // str.AppendFormat(Environment.NewLine); //Page header = phf.Header; phf.Header.Content.Add(str); // str.AppendFormat("Date Generated: {0}", System.DateTime.Today.ToShortDateString()); //str.AppendFormat(Environment.NewLine); if (checkEdit1.Checked && checkEdit2.Checked) { str = dateEditStartDate.DateTime.ToShortDateString() + " - " + dateEditEndDate.DateTime.ToShortDateString(); } else if (checkEdit1.Checked && !checkEdit2.Checked) { str = dateEditStartDate.DateTime.ToLongDateString() + " - Unlimited"; } else if (!checkEdit1.Checked && checkEdit2.Checked) { str = "Unlimited - " + dateEditEndDate.DateTime.ToShortDateString(); } else { str = ""; //str.AppendFormat("From: Not Filtered To: Not Filtered"); } phf.Header.LineAlignment = BrickAlignment.Center; phf.Header.Content.Add(str); phf.Footer.LineAlignment = BrickAlignment.Near; phf.Footer.Content.Add(""); phf.Footer.LineAlignment = BrickAlignment.Center; phf.Footer.Content.Add(""); phf.Footer.LineAlignment = BrickAlignment.Far; String footer = "Date Generated: " + System.DateTime.Today.ToShortDateString(); phf.Footer.Content.Add(footer); phf.Footer.LineAlignment = BrickAlignment.Far; PrintableComponentLink _link = new PrintableComponentLink(new PrintingSystem()); _link.Component = gc; _link.Landscape = true; _link.PageHeaderFooter = phf; _link.PaperKind = System.Drawing.Printing.PaperKind.A4; _link.Margins.Top = 60; _link.Margins.Bottom = 60; _link.Margins.Left = 10; _link.Margins.Right = 10; if (printPreview) { _link.ShowPreviewDialog(); } else { _link.PrintDlg(); } /* * PrinterSettings settings = printDocument1.PrinterSettings; * //Set PageSize to 'A4' * bool found=false; * foreach (PaperSize size in settings.PaperSizes) * { * if (size.PaperName == "A4, 210x297 mm") * found = true; * if (found) * { * settings.DefaultPageSettings.PaperSize = size; * break; * } * else continue; * } * * printDocument1.DefaultPageSettings.Landscape = true; * printDocument1.DefaultPageSettings.Margins = new Margins(50, 50, 15, 50); * //printDocument1.DefaultPageSettings.PaperSize = new PaperSize("A4, 210x297 mm", 827, 1169); * * dataGridPrinter1 = new GridViewPrinter(gc, printDocument1, gvwContact); * dataGridPrinter1.PageNumber = 1; * dataGridPrinter1.RowCount = 0; * if (printPreviewDialog1.ShowDialog() == DialogResult.OK) * { * }*/ }
private void printGridBarButtonItem_ItemClick(object sender, DevExpress.XtraBars.ItemClickEventArgs e) { PrintableComponentLink pcl = new PrintableComponentLink(new PrintingSystem()); PrintableComponentLink pcl2 = null; pcl.CreateReportHeaderArea += PrintableComponentLink_CreateReportHeaderArea; //INSTANT C# NOTE: The following VB 'Select Case' included either a non-ordinal switch expression or non-ordinal, range-type, or non-constant 'Case' expressions and was converted to C# 'if-else' logic: // Select Case locationsXtraTabControl.SelectedTabPage.Name //ORIGINAL LINE: Case inventoryXtraTabPage.Name if (locationsXtraTabControl.SelectedTabPage.Name == inventoryXtraTabPage.Name) { pcl.Component = inventoryGridControl; m_GridReportTitle = "Inventory At " + m_CurrentLocation.LocationCode; } //ORIGINAL LINE: Case inventoryByLotXtraTabPage.Name else if (locationsXtraTabControl.SelectedTabPage.Name == inventoryByLotXtraTabPage.Name) { pcl.Component = inventoryByLotGridControl; m_GridReportTitle = "Inventory By LPN - Lot At " + m_CurrentLocation.LocationCode; } //ORIGINAL LINE: Case transfersXtraTabPage.Name else if (locationsXtraTabControl.SelectedTabPage.Name == transfersXtraTabPage.Name) { pcl.Component = transfersFromGridControl; m_GridReportTitle = "Transfers From/To " + m_CurrentLocation.LocationCode; pcl2 = new PrintableComponentLink(new PrintingSystem()); pcl2.CreateReportHeaderArea += PrintableComponentLink_CreateReportHeaderArea; pcl2.Component = transfersToGridControl; } //ORIGINAL LINE: Case receivingReturnsXtraTabPage.Name else if (locationsXtraTabControl.SelectedTabPage.Name == receivingReturnsXtraTabPage.Name) { pcl.Component = receivingReturnsGridControl; m_GridReportTitle = "Receiving Returns At " + m_CurrentLocation.LocationCode; } //ORIGINAL LINE: Case receivingXtraTabPage.Name else if (locationsXtraTabControl.SelectedTabPage.Name == receivingXtraTabPage.Name) { pcl.Component = receivingsGridControl; m_GridReportTitle = "Receivings At " + m_CurrentLocation.LocationCode; } //ORIGINAL LINE: Case productionXtraTabPage.Name else if (locationsXtraTabControl.SelectedTabPage.Name == productionXtraTabPage.Name) { pcl.Component = productionGridControl; m_GridReportTitle = "Production At " + m_CurrentLocation.LocationCode; } //ORIGINAL LINE: Case shippingsXtraTabPage.Name else if (locationsXtraTabControl.SelectedTabPage.Name == shippingsXtraTabPage.Name) { pcl.Component = shippingsGridControl; m_GridReportTitle = "Shippings At " + m_CurrentLocation.LocationCode; } //ORIGINAL LINE: Case shippingReturnsXtraTabPage.Name else if (locationsXtraTabControl.SelectedTabPage.Name == shippingReturnsXtraTabPage.Name) { pcl.Component = shippingReturnsGridControl; m_GridReportTitle = "Shipping Returns At " + m_CurrentLocation.LocationCode; } //ORIGINAL LINE: Case Else else { } pcl.CreateDocument(); pcl.ShowPreviewDialog(); if (pcl2 != null) { pcl2.CreateDocument(); pcl2.ShowPreviewDialog(); } }
public void PrintGrid(DevExpress.XtraGrid.GridControl gc, bool printPreview) { //GridView gvwContact = (GridView) gc.DefaultView; // string strHeader = strMenuOption; //strHeader = strHeader.Remove(strHeader.Length - 3, 3); //strHeader += " Information"; PageHeaderFooter phf = new PageHeaderFooter(); phf.Header.Font = new Font("Arial", 15, FontStyle.Bold, GraphicsUnit.Point); string str = ""; phf.Header.LineAlignment = BrickAlignment.Near; str = "Payroll By Instructor"; // str.AppendFormat(Environment.NewLine); //Page header = phf.Header; phf.Header.Content.Add(str); // str.AppendFormat("Date Generated: {0}", System.DateTime.Today.ToShortDateString()); //str.AppendFormat(Environment.NewLine); if (checkEdit1.Checked && checkEdit2.Checked) str = dateEditStartDate.DateTime.ToShortDateString() + " - " + dateEditEndDate.DateTime.ToShortDateString(); else if (checkEdit1.Checked && !checkEdit2.Checked) { str = dateEditStartDate.DateTime.ToLongDateString() + " - Unlimited"; } else if (!checkEdit1.Checked && checkEdit2.Checked) { str = "Unlimited - " + dateEditEndDate.DateTime.ToShortDateString(); } else { str = ""; //str.AppendFormat("From: Not Filtered To: Not Filtered"); } phf.Header.LineAlignment = BrickAlignment.Center; phf.Header.Content.Add(str); phf.Footer.LineAlignment = BrickAlignment.Near; phf.Footer.Content.Add(""); phf.Footer.LineAlignment = BrickAlignment.Center; phf.Footer.Content.Add(""); phf.Footer.LineAlignment = BrickAlignment.Far; String footer = "Date Generated: " + System.DateTime.Today.ToShortDateString(); phf.Footer.Content.Add(footer); phf.Footer.LineAlignment = BrickAlignment.Far; PrintableComponentLink _link = new PrintableComponentLink(new PrintingSystem()); _link.Component = gc; _link.Landscape = true; _link.PageHeaderFooter = phf; _link.PaperKind = System.Drawing.Printing.PaperKind.A4; _link.Margins.Top = 60; _link.Margins.Bottom = 60; _link.Margins.Right = 10; _link.Margins.Left = 10; if (printPreview) _link.ShowPreviewDialog(); else _link.PrintDlg(); /* PrinterSettings settings = printDocument1.PrinterSettings; //Set PageSize to 'A4' bool found=false; foreach (PaperSize size in settings.PaperSizes) { if (size.PaperName == "A4, 210x297 mm") found = true; if (found) { settings.DefaultPageSettings.PaperSize = size; break; } else continue; } printDocument1.DefaultPageSettings.Landscape = true; printDocument1.DefaultPageSettings.Margins = new Margins(50, 50, 15, 50); //printDocument1.DefaultPageSettings.PaperSize = new PaperSize("A4, 210x297 mm", 827, 1169); dataGridPrinter1 = new GridViewPrinter(gc, printDocument1, gvwContact); dataGridPrinter1.PageNumber = 1; dataGridPrinter1.RowCount = 0; if (printPreviewDialog1.ShowDialog() == DialogResult.OK) { }*/ }