نمایش نتایج 1 تا 29 از 29

نام تاپیک: پرینت مستقیم از datagridview

  1. #1

    پرینت مستقیم از datagridview

    دوستان عزیز کسی نیست منو در جهت نوشتن پرینت مستقیم از دیتاگرید راهنمایی کنه ؟
    ممنون میشم.
    من از کلاس printdgv که چندین مورد هم در سایت هست استفاده کردم اما هیچکدوم رو نتونستم استفاده کنم
    در استفاده از این کلاس در اخر به یه مشکل برمیخورم و اونم اینه که صفحه پرینتم همه چیز رو نشون میده به جز دیتاگرید. و تست کردم دیدم وارد تمام توابع میشه اما نه هدرهارو مینویسه و نه دیتا گرید رو
    لطفاکمک کنید.

  2. #2
    کاربر تازه وارد آواتار hamed shahba
    تاریخ عضویت
    آبان 1389
    محل زندگی
    زیر آسمان خدا
    سن
    35
    پست
    68

    نقل قول: پرینت مستقیم از دیتاگریدویو

    سلام
    میتونی کد پرینتت رو بزاری؟


    من استفاده کردم مشکلی نداشته

  3. #3

    نقل قول: پرینت مستقیم از دیتاگریدویو

    using System;
    using System.Collections.Generic;
    using System.Windows.Forms;
    using System.Drawing;
    using System.Collections;
    using System.Data;
    using System.Text;

    namespace PrintDataGrid
    {
    class PrintDGV
    {
    private static StringFormat StrFormat; // Holds content of a TextBox Cell to write by DrawString
    private static StringFormat StrFormatComboBox; // Holds content of a Boolean Cell to write by DrawImage
    private static Button CellButton; // Holds the Contents of Button Cell
    private static CheckBox CellCheckBox; // Holds the Contents of CheckBox Cell
    private static ComboBox CellComboBox; // Holds the Contents of ComboBox Cell

    private static int TotalWidth; // Summation of Columns widths
    private static int RowPos; // Position of currently printing row
    private static bool NewPage; // Indicates if a new page reached
    private static int PageNo; // Number of pages to print
    private static ArrayList ColumnLefts = new ArrayList(); // Left Coordinate of Columns
    private static ArrayList ColumnWidths = new ArrayList(); // Width of Columns
    private static ArrayList ColumnTypes = new ArrayList(); // DataType of Columns
    private static int CellHeight; // Height of DataGrid Cell
    private static int RowsPerPage; // Number of Rows per Page
    private static System.Drawing.Printing.PrintDocument printDoc =
    new System.Drawing.Printing.PrintDocument(); // PrintDocumnet Object used for printing

    private static string PrintTitle = ""; // Header of pages
    private static DataGridView dgv; // Holds DataGridView Object to print its contents
    private static List<string> SelectedColumns = new List<string>(); // The Columns Selected by user to print.
    private static List<string> AvailableColumns = new List<string>(); // All Columns avaiable in DataGrid
    private static bool PrintAllRows = true; // True = print all rows, False = print selected rows
    private static bool FitToPageWidth = true; // True = Fits selected columns to page width , False = Print columns as showed
    private static int HeaderHeight = 0;

    public static void Print_DataGridView(DataGridView dgv1)
    {
    PrintPreviewDialog ppvw;
    try
    {
    // Getting DataGridView object to print
    dgv = dgv1;

    // Getting all Coulmns Names in the DataGridView
    AvailableColumns.Clear();
    foreach (DataGridViewColumn c in dgv.Columns)
    {
    if (!c.Visible) continue;
    AvailableColumns.Add(c.HeaderText);
    }

    // Showing the PrintOption Form
    // PrintOptions dlg = new PrintOptions(AvailableColumns);
    // if (dlg.ShowDialog() != DialogResult.OK) return;

    // PrintTitle = dlg.PrintTitle;
    // PrintAllRows = dlg.PrintAllRows;
    // FitToPageWidth = dlg.FitToPageWidth;
    // SelectedColumns = dlg.GetSelectedColumns();

    RowsPerPage = 0;

    ppvw = new PrintPreviewDialog();
    ppvw.Document = printDoc;

    // Showing the Print Preview Page
    printDoc.BeginPrint += new System.Drawing.Printing.PrintEventHandler(PrintDoc _BeginPrint);
    printDoc.PrintPage += new System.Drawing.Printing.PrintPageEventHandler(Prin tDoc_PrintPage);
    if (ppvw.ShowDialog() != DialogResult.OK)
    {
    printDoc.BeginPrint -= new System.Drawing.Printing.PrintEventHandler(PrintDoc _BeginPrint);
    printDoc.PrintPage -= new System.Drawing.Printing.PrintPageEventHandler(Prin tDoc_PrintPage);
    return;
    }

    // Printing the Documnet
    printDoc.Print();
    printDoc.BeginPrint -= new System.Drawing.Printing.PrintEventHandler(PrintDoc _BeginPrint);
    printDoc.PrintPage -= new System.Drawing.Printing.PrintPageEventHandler(Prin tDoc_PrintPage);
    }
    catch (Exception ex)
    {
    MessageBox.Show(ex.Message, "Error", MessageBoxButtons.OK, MessageBoxIcon.Error);
    }
    finally
    {

    }
    }

    private static void PrintDoc_BeginPrint(object sender,
    System.Drawing.Printing.PrintEventArgs e)
    {
    try
    {
    // Formatting the Content of Text Cell to print
    StrFormat = new StringFormat();
    StrFormat.Alignment = StringAlignment.Near;
    StrFormat.LineAlignment = StringAlignment.Center;
    StrFormat.Trimming = StringTrimming.EllipsisCharacter;

    // Formatting the Content of Combo Cells to print
    StrFormatComboBox = new StringFormat();
    StrFormatComboBox.LineAlignment = StringAlignment.Center;
    StrFormatComboBox.FormatFlags = StringFormatFlags.NoWrap;
    StrFormatComboBox.Trimming = StringTrimming.EllipsisCharacter;

    ColumnLefts.Clear();
    ColumnWidths.Clear();
    ColumnTypes.Clear();
    CellHeight = 0;
    RowsPerPage = 0;

    // For various column types
    CellButton = new Button();
    CellCheckBox = new CheckBox();
    CellComboBox = new ComboBox();

    // Calculating Total Widths
    TotalWidth = 0;
    foreach (DataGridViewColumn GridCol in dgv.Columns)
    {
    if (!GridCol.Visible) continue;
    if (!PrintDGV.SelectedColumns.Contains(GridCol.Header Text)) continue;
    TotalWidth += GridCol.Width;
    }
    PageNo = 1;
    NewPage = true;
    RowPos = 0;
    }
    catch (Exception ex)
    {
    MessageBox.Show(ex.Message, "Error", MessageBoxButtons.OK, MessageBoxIcon.Error);
    }
    }

    private static void PrintDoc_PrintPage(object sender,
    System.Drawing.Printing.PrintPageEventArgs e)
    {
    int tmpWidth, i;
    int tmpTop = e.MarginBounds.Top;
    int tmpLeft = e.MarginBounds.Left;

    try
    {
    // Before starting first page, it saves Width & Height of Headers and CoulmnType
    if (PageNo == 1)
    {
    foreach (DataGridViewColumn GridCol in dgv.Columns)
    {
    if (!GridCol.Visible) continue;
    // Skip if the current column not selected
    if (!PrintDGV.SelectedColumns.Contains(GridCol.Header Text)) continue;

    // Detemining whether the columns are fitted to page or not.
    if (FitToPageWidth)
    tmpWidth = (int)(Math.Floor((double)((double)GridCol.Width /
    (double)TotalWidth * (double)TotalWidth *
    ((double)e.MarginBounds.Width / (double)TotalWidth))));
    else
    tmpWidth = GridCol.Width;

    HeaderHeight = (int)(e.Graphics.MeasureString(GridCol.HeaderText,
    GridCol.InheritedStyle.Font, tmpWidth).Height) + 11;

    // Save width & height of headres and ColumnType
    ColumnLefts.Add(tmpLeft);
    ColumnWidths.Add(tmpWidth);
    ColumnTypes.Add(GridCol.GetType());
    tmpLeft += tmpWidth;
    }
    }

    // Printing Current Page, Row by Row
    while (RowPos <= dgv.Rows.Count - 1)
    {
    DataGridViewRow GridRow = dgv.Rows[RowPos];
    if (GridRow.IsNewRow || (!PrintAllRows && !GridRow.Selected))
    {
    RowPos++;
    continue;
    }

    CellHeight = GridRow.Height;

    if (tmpTop + CellHeight >= e.MarginBounds.Height + e.MarginBounds.Top)
    {
    DrawFooter(e, RowsPerPage);
    NewPage = true;
    PageNo++;
    e.HasMorePages = true;
    return;
    }
    else
    {
    if (NewPage)
    {
    // Draw Header
    e.Graphics.DrawString(PrintTitle, new Font(dgv.Font, FontStyle.Bold),
    Brushes.Black, e.MarginBounds.Left, e.MarginBounds.Top -
    e.Graphics.MeasureString(PrintTitle, new Font(dgv.Font,
    FontStyle.Bold), e.MarginBounds.Width).Height - 13);

    String s = DateTime.Now.ToLongDateString() + " " + DateTime.Now.ToShortTimeString();

    e.Graphics.DrawString(s, new Font(dgv.Font, FontStyle.Bold),
    Brushes.Black, e.MarginBounds.Left + (e.MarginBounds.Width -
    e.Graphics.MeasureString(s, new Font(dgv.Font,
    FontStyle.Bold), e.MarginBounds.Width).Width), e.MarginBounds.Top -
    e.Graphics.MeasureString(PrintTitle, new Font(new Font(dgv.Font,
    FontStyle.Bold), FontStyle.Bold), e.MarginBounds.Width).Height - 13);

    // Draw Columns
    tmpTop = e.MarginBounds.Top;
    i = 0;
    foreach (DataGridViewColumn GridCol in dgv.Columns)
    {
    if (!GridCol.Visible) continue;
    if (!PrintDGV.SelectedColumns.Contains(GridCol.Header Text))
    continue;

    e.Graphics.FillRectangle(new SolidBrush(Color.LightGray),
    new Rectangle((int)ColumnLefts[i], tmpTop,
    (int)ColumnWidths[i], HeaderHeight));

    e.Graphics.DrawRectangle(Pens.Black,
    new Rectangle((int)ColumnLefts[i], tmpTop,
    (int)ColumnWidths[i], HeaderHeight));

    e.Graphics.DrawString(GridCol.HeaderText, GridCol.InheritedStyle.Font,
    new SolidBrush(GridCol.InheritedStyle.ForeColor),
    new RectangleF((int)ColumnLefts[i], tmpTop,
    (int)ColumnWidths[i], HeaderHeight), StrFormat);
    i++;
    }
    NewPage = false;
    tmpTop += HeaderHeight;
    }

    // Draw Columns Contents
    i = 0;
    foreach (DataGridViewCell Cel in GridRow.Cells)
    {
    if (!Cel.OwningColumn.Visible) continue;
    if (!SelectedColumns.Contains(Cel.OwningColumn.Header Text))
    continue;

    // For the TextBox Column
    if (((Type)ColumnTypes[i]).Name == "DataGridViewTextBoxColumn" ||
    ((Type)ColumnTypes[i]).Name == "DataGridViewLinkColumn")
    {
    e.Graphics.DrawString(Cel.Value.ToString(), Cel.InheritedStyle.Font,
    new SolidBrush(Cel.InheritedStyle.ForeColor),
    new RectangleF((int)ColumnLefts[i], (float)tmpTop,
    (int)ColumnWidths[i], (float)CellHeight), StrFormat);
    }
    // For the Button Column
    else if (((Type)ColumnTypes[i]).Name == "DataGridViewButtonColumn")
    {
    CellButton.Text = Cel.Value.ToString();
    CellButton.Size = new Size((int)ColumnWidths[i], CellHeight);
    Bitmap bmp = new Bitmap(CellButton.Width, CellButton.Height);
    CellButton.DrawToBitmap(bmp, new Rectangle(0, 0,
    bmp.Width, bmp.Height));
    e.Graphics.DrawImage(bmp, new Point((int)ColumnLefts[i], tmpTop));
    }
    // For the CheckBox Column
    else if (((Type)ColumnTypes[i]).Name == "DataGridViewCheckBoxColumn")
    {
    CellCheckBox.Size = new Size(14, 14);
    CellCheckBox.Checked = (bool)Cel.Value;
    Bitmap bmp = new Bitmap((int)ColumnWidths[i], CellHeight);
    Graphics tmpGraphics = Graphics.FromImage(bmp);
    tmpGraphics.FillRectangle(Brushes.White, new Rectangle(0, 0,
    bmp.Width, bmp.Height));
    CellCheckBox.DrawToBitmap(bmp,
    new Rectangle((int)((bmp.Width - CellCheckBox.Width) / 2),
    (int)((bmp.Height - CellCheckBox.Height) / 2),
    CellCheckBox.Width, CellCheckBox.Height));
    e.Graphics.DrawImage(bmp, new Point((int)ColumnLefts[i], tmpTop));
    }
    // For the ComboBox Column
    else if (((Type)ColumnTypes[i]).Name == "DataGridViewComboBoxColumn")
    {
    CellComboBox.Size = new Size((int)ColumnWidths[i], CellHeight);
    Bitmap bmp = new Bitmap(CellComboBox.Width, CellComboBox.Height);
    CellComboBox.DrawToBitmap(bmp, new Rectangle(0, 0,
    bmp.Width, bmp.Height));
    e.Graphics.DrawImage(bmp, new Point((int)ColumnLefts[i], tmpTop));
    e.Graphics.DrawString(Cel.Value.ToString(), Cel.InheritedStyle.Font,
    new SolidBrush(Cel.InheritedStyle.ForeColor),
    new RectangleF((int)ColumnLefts[i] + 1, tmpTop, (int)ColumnWidths[i]
    - 16, CellHeight), StrFormatComboBox);
    }
    // For the Image Column
    else if (((Type)ColumnTypes[i]).Name == "DataGridViewImageColumn")
    {
    Rectangle CelSize = new Rectangle((int)ColumnLefts[i],
    tmpTop, (int)ColumnWidths[i], CellHeight);
    Size ImgSize = ((Image)(Cel.FormattedValue)).Size;
    e.Graphics.DrawImage((Image)Cel.FormattedValue,
    new Rectangle((int)ColumnLefts[i] + (int)((CelSize.Width - ImgSize.Width) / 2),
    tmpTop + (int)((CelSize.Height - ImgSize.Height) / 2),
    ((Image)(Cel.FormattedValue)).Width, ((Image)(Cel.FormattedValue)).Height));

    }

    // Drawing Cells Borders
    e.Graphics.DrawRectangle(Pens.Black, new Rectangle((int)ColumnLefts[i],
    tmpTop, (int)ColumnWidths[i], CellHeight));

    i++;

    }
    tmpTop += CellHeight;
    }

    RowPos++;
    // For the first page it calculates Rows per Page
    if (PageNo == 1) RowsPerPage++;
    }

    if (RowsPerPage == 0) return;

    // Write Footer (Page Number)
    DrawFooter(e, RowsPerPage);

    e.HasMorePages = false;
    }
    catch (Exception ex)
    {
    MessageBox.Show(ex.Message, "Error", MessageBoxButtons.OK, MessageBoxIcon.Error);
    }
    }

    private static void DrawFooter(System.Drawing.Printing.PrintPageEventA rgs e,
    int RowsPerPage)
    {
    double cnt = 0;

    // Detemining rows number to print
    if (PrintAllRows)
    {
    if (dgv.Rows[dgv.Rows.Count - 1].IsNewRow)
    cnt = dgv.Rows.Count - 2; // When the DataGridView doesn't allow adding rows
    else
    cnt = dgv.Rows.Count - 1; // When the DataGridView allows adding rows
    }
    else
    cnt = dgv.SelectedRows.Count;

    // Writing the Page Number on the Bottom of Page
    string PageNum = PageNo.ToString() + " of " +
    Math.Ceiling((double)(cnt / RowsPerPage)).ToString();

    e.Graphics.DrawString(PageNum, dgv.Font, Brushes.Black,
    e.MarginBounds.Left + (e.MarginBounds.Width -
    e.Graphics.MeasureString(PageNum, dgv.Font,
    e.MarginBounds.Width).Width) / 2, e.MarginBounds.Top +
    e.MarginBounds.Height + 31);
    }
    }
    }


    این کد کلاس PRINTDVG چون نتونستم از کلاس PrintOptionS استفاده کنم کامنتش کردم.

  4. #4

    نقل قول: پرینت مستقیم از دیتاگریدویو

    1.JPG

    من یه dll پرینت استفاده کردم و زمان اجرا با این ارور مواجه میشم.

  5. #5
    کاربر تازه وارد آواتار hamed shahba
    تاریخ عضویت
    آبان 1389
    محل زندگی
    زیر آسمان خدا
    سن
    35
    پست
    68

    نقل قول: پرینت مستقیم از دیتاگریدویو

    نقل قول نوشته شده توسط sara_t مشاهده تاپیک
    1.JPG

    من یه dll پرینت استفاده کردم و زمان اجرا با این ارور مواجه میشم.

    اینجا یه سر بزنید

  6. #6

    نقل قول: پرینت مستقیم از دیتاگریدویو

    دوست عزیز در 2010 جواب میده ولی در 2008 نه باید چکار کرد؟

  7. #7

    نقل قول: پرینت مستقیم از دیتاگریدویو

    سلام دوست عزیز
    اگر نمونه پروژه را میزاشتی بهتر میشد کنترل و بررسی کرد

  8. #8
    مدیر بخش آواتار ژیار رحیمی
    تاریخ عضویت
    مهر 1386
    محل زندگی
    تهران
    پست
    1,095

    نقل قول: پرینت مستقیم از دیتاگریدویو

    سلام .به نظر من بهتره از کنترل های پیشرفته شرکت های همچون telerik یا devexpress که دارای فریم ورک داخلی هستن استفاده کن به راحتی با یه خط کد نویسی میتونی grid رو چاپ کنی

  9. #9

    نقل قول: پرینت مستقیم از دیتاگریدویو

    دوستان نظرتون نسبت به این روش چیه که گرید رو به صفحه html ارسال کنیم ، تا زحمت چاپ بیفته گردن مرورگرها ؟ ایا این روش یک روش غیر حرفه ای و بد هست ؟
    آخرین ویرایش به وسیله بیتا حکمت : چهارشنبه 21 مرداد 1394 در 08:16 صبح دلیل: به جای غیر حرفه ای نوشته بودم خیلی حرفه ای : دی

  10. #10

    نقل قول: پرینت مستقیم از دیتاگریدویو

    نقل قول نوشته شده توسط بیتا حکمت مشاهده تاپیک
    دوستان نظرتون نسبت به این روش چیه که گرید رو به صفحه html ارسال کنیم ، تا زحمت چاپ بیفته گردن مرورگرها ؟ ایا این روش یک روش خیلی حرفه ای و بد هست ؟
    من خودم از روش HTMl استفاده کردم و یه روش خیلی ساده ای هست و فقط تنها مشکلی که باهاش داشتم چاپ بگراند بود چون HTML بکگراند رو چاپ نمیکنه و حتما باید تویه فرم پرینت تیک مورد نظرش رو انتخاب کنید
    اگه متدش رو خواستی بگو واست بزارم این کلاس PrintDVG خیلی مشکل دارده مخصوصا وقتی که مقدار یک سلول بزرگ باشه مثل ستون توضیحات یا ادرس

  11. #11

    نقل قول: پرینت مستقیم از دیتاگریدویو

    نقل قول نوشته شده توسط aliasghar2 مشاهده تاپیک
    من خودم از روش HTMl استفاده کردم و یه روش خیلی ساده ای هست و فقط تنها مشکلی که باهاش داشتم چاپ بگراند بود چون HTML بکگراند رو چاپ نمیکنه و حتما باید تویه فرم پرینت تیک مورد نظرش رو انتخاب کنید
    اگه متدش رو خواستی بگو واست بزارم این کلاس PrintDVG خیلی مشکل دارده مخصوصا وقتی که مقدار یک سلول بزرگ باشه مثل ستون توضیحات یا ادرس
    سلام ، اگر ممکنه متدش رو به اشتراک بزارین . ممنونم .

  12. #12

    نقل قول: پرینت مستقیم از datagridview

    سلام ، اگر ممکنه متدش رو به اشتراک بزارین . ممنونم .
    اینم متدش
      private void frmPrint_Click(object sender, EventArgs e)
    {
    WebBrowser wb = new WebBrowser();

    wb.DocumentCompleted += new WebBrowserDocumentCompletedEventHandler(PrintDocum ent);
    string s = "<html><head><meta http-equiv=\"X-UA-Compatible\" content=\"IE=edge\"></head><body><table width=\"100%\" border=\"1\" align=\"center\" dir=\"rtl\" style=\"font-family:'B Nazanin'\" > ";
    s += "<tr>";
    for (int j = 0; j < grdLawList.Columns.Count; j++)
    {
    if (grdLawList.Columns[j].Visible)
    {

    if (j == 1)
    s += "<th width=\"100px\" style=\"background-color:#CCC; \">" + grdLawList.Columns[j].HeaderText + "</th>";
    else
    s += "<th style=\"background-color:#CCC;\">" + grdLawList.Columns[j].HeaderText + "</th>";
    }

    }

    s += "</tr>";
    for (int i = 0; i < grdLawList.Rows.Count; i++)
    {
    s += "<tr>";
    for (int j = 0; j < grdLawList.Columns.Count; j++)
    {
    if (grdLawList.Columns[j].Visible)
    {

    s += "<td>" + grdLawList.Rows[i].Cells[j].Value + "</td>";
    }

    }
    s += "</tr>";
    }
    s += "</table> </body></html>";
    wb.DocumentText = s;

    }

    private void PrintDocument(object sender, WebBrowserDocumentCompletedEventArgs e)
    {
    // ((WebBrowser)sender).ShowPrintDialog();
    // Print the document now that it is fully loaded.
    ((WebBrowser)sender).ShowPageSetupDialog();
    ((WebBrowser)sender).ShowPrintDialog();
    // Dispose the WebBrowser now that the task is complete.
    ((WebBrowser)sender).Dispose();
    }

  13. #13

    نقل قول: پرینت مستقیم از datagridview

    تشکرازعلی اصغر
    جناب علی اصغر اگه ممکنه یه نمونه کار و برنامه ساده از این متد را قرار بدید که اگه مشکلی پیدا کردیم ازش استفاده کنیم
    متشکریم از لطف شما
    این متد را من در کجا قرار بدم که بتونم ازش استفاده کنم؟
    wb.DocumentCompleted += new WebBrowserDocumentCompletedEventHandler(PrintDocum ent);
    این متد کلاس هستش؟لطفا زودتر جواب بدید تا ککدم را اصلاحش کنم
    متشکرم
    آخرین ویرایش به وسیله h.gheidrlou : چهارشنبه 21 مرداد 1394 در 18:01 عصر

  14. #14

    نقل قول: پرینت مستقیم از datagridview

    این متد را من در کجا قرار بدم که بتونم ازش استفاده کنم؟
    ببین این کدی که فرستادم اگه دقت کنی دو بخشه بخش اول برای دکمه پرینت و می تونی یه دکمه واسه پرینت بزاری و هرچی تویه این قسمت اول هست رو توش کپی کنی البته اگه دقت کنید اسم گرید من grdLawList بوده وباید با نام گرید خودت جایگزین کنی یا بهتر اینکه یه متد درست کنی که یه گرید بگیره و این کد رو توش بزاری

    قسمت دوم هم برای زمانیه که قراره ارسال بشه واسه پرینت که ثابته و نیازی به تغییر نداره

    موفق باشی

  15. #15

    نقل قول: پرینت مستقیم از datagridview

    من انجام دادم و همه چیو قرار دادم ولی گزینه ای که نوشتم خطا میده اشکالش چیه؟خطای چاپ.pngملاحظه بفرمائید

  16. #16

    نقل قول: پرینت مستقیم از datagridview

    من انجام دادم و همه چیو قرار دادم ولی گزینه ای که نوشتم خطا میده اشکالش چیه؟
    اول اینکه اون بخش دوم رو گذاشتی یا نه ؟
    دوم اینکه بنظر میرسه یه اسپیس وسط کلمه PrintDocument افتاده اونو درست کن

  17. #17

    نقل قول: پرینت مستقیم از datagridview

    تشکر از لطف شما
    درست شد
    ولی ایکاش میشد یه پیش نمایش قبلش گذاشت
    چطوری میتونم قبلش printperiw قرار بدم؟

  18. #18

    نقل قول: پرینت مستقیم از datagridview

    درضمن چرا اطلاعات عددی گریدویو منو بصورت سه رقم سه رقم چا پ نمیکنه و اعداد را به طریق اصلی ارسال میکنه و در ضمن سرتیتر و عنوان و غیره هم نداره

  19. #19

    نقل قول: پرینت مستقیم از datagridview

    چطوری میتونم قبلش printperiw قرار بدم؟
    واسه اینکار کافیه کلمه ShowPrintDialog زو به ShowPrintPriviewDialog تغییر بدی

    درضمن چرا اطلاعات عددی گریدویو منو بصورت سه رقم سه رقم چا پ نمیکنه و اعداد را به طریق اصلی ارسال میکنه و در ضمن سرتیتر و عنوان و غیره هم نداره
    اضافه کردن اینها کاری نداره و فقط کافیه با HTML که تولید میشه بازی کنی البته منظورت رو از سرتیتر نفهمیدم ایا منظورت هدر هر ستونه اگه اون باشه که اونو داره

  20. #20

    نقل قول: پرینت مستقیم از datagridview

    سرستون یعنی header منظورم نیست منظورم عنوان برگه و توضیحات بالای جدول هستش مثل
    SubTitle
    .Title
    Footerچون من کدهای HTMLکار نکردم نمیدونم چطوری میشه اعداد را سه رقم سه رقم کرد
    البته این گزارش خیلی زیبا و جذابی هستش
    انشاله به کمک شما دوست عزیز بتونم گزارش مورد نظرم را درست کنم
    ممنو میشم راهنماییی کنید کدوم کدها را به چه روشی تغییر بدم؟
    باتشکر

  21. #21

    نقل قول: پرینت مستقیم از datagridview

    اگه بتونی html که تولید میشه رو بهم بدی روش کار می کنم و اینا رو هم اضافه می کنم و نتیحشو به صورت یه کلاس دست میکنم که بشه همهجا استفاده کرد

    باید تویه خط wb.DocumentText = s یه بریک پوینت بزاری و مقداری که تو s هست رو بفرستی

  22. #22

    نقل قول: پرینت مستقیم از datagridview

    نمیدونم چطوری فایل ایجاد شده را بفرستم
    لطفا ایمیل بدید بفرستم

  23. #23
    کاربر دائمی آواتار golbafan
    تاریخ عضویت
    اردیبهشت 1388
    محل زندگی
    در قلب دوستان
    پست
    2,018

    نقل قول: پرینت مستقیم از datagridview


  24. #24

    نقل قول: پرینت مستقیم از datagridview

    لینک های زیر میتونن مفید باشن:
    سه روش متفاوت برای پرینت گرفتن از گرید ویو:
    همه این روش هایی که معرفی کردی رو من قبلا تست کرده بودم همشون با گرید فارسی مشکل دارن

    نمیدونم چطوری فایل ایجاد شده را بفرستم
    لطفا ایمیل بدید بفرستم
    نیازی نیست فایل بفرستی کدهای خودمو پیدا کردم دارم یه کلاس میسازم که اینکارو بکنه انشاالله جمعه تویه یه تاپیک جداگانه میزارم

  25. #25

    نقل قول: پرینت مستقیم از datagridview

    ممنون میشم اگر پس از ساخت کلاس ، تایپیک مورد نظر را اعلام کنید
    بسیار تشکر

  26. #26

    نقل قول: پرینت مستقیم از datagridview

    نقل قول نوشته شده توسط h.gheidrlou مشاهده تاپیک
    ممنون میشم اگر پس از ساخت کلاس ، تایپیک مورد نظر را اعلام کنید
    بسیار تشکر
    https://barnamenevis.org/showthread.p...DB%8C%D8%AF%29

  27. #27

    نقل قول: پرینت مستقیم از datagridview

    جناب علی اصغر عزیز
    باتوجه به اعلام خودتون و نیت خیرخواهانه شما مواردی را برای اصلاح این کد خیلی خوب و کاربردی شما پیشنهاد میدم و امیدوارم جسارت به به علم شما نباشه
    اول اینکه بهتره قبل از ارسال اطلاعات به پرینتر ، فایل مربوطه به پیش نمایش ارسال بشه یعنی ابتدا پیش نمایش وسپس در صورت نیاز چاپ گرفته شود چون اینجوری تست کردن کد حتما نیازه به پرینتر می باشد که زیاد جالب نیست ----
    printshowDialog ----- print privew
    مطلب دوم در ستون های عددی قابلیت تنظیم حالات پولی و سه رقم سه رقم کردن بدون اعداد اعشاری و یا با اعداد اعشاری در ستونهای عددی وجود داشته باشه و یا از پیش تنظیمات عددی منظور گردد
    سوم :اگر تعداد ستونها به نحوی بود که اطلاعات بیشتر از عرض کاغذ بود بصورت خودکار کاغذ ما بصورت عریض تکمیل گردد و در ضمن اطلاعات در محدوده داخل صفحه تکمیل و فیت بشه و بعضی ستونها در صفحه بعدی نمایش داده نشه
    چهارم : سرستونها چاپ نمیشودHeadertext.text = ?????

  28. #28

    نقل قول: پرینت مستقیم از datagridview

    اول اینکه بهتره قبل از ارسال اطلاعات به پرینتر ، فایل مربوطه به پیش نمایش ارسال بشه یعنی ابتدا پیش نمایش وسپس در صورت نیاز چاپ گرفته شود چون اینجوری تست کردن کد حتما نیازه به پرینتر می باشد که زیاد جالب نیست
    تویه نسخه بعدی اضافه میشه

    مطلب دوم در ستون های عددی قابلیت تنظیم حالات پولی و سه رقم سه رقم کردن بدون اعداد اعشاری و یا با اعداد اعشاری در ستونهای عددی وجود داشته باشه و یا از پیش تنظیمات عددی منظور گردد
    تو نسخه بعدی امکان تنظیم ستون ها وجود داره که یه بخشی هم مربوط میشه به اعدادد. نمیشه تمامی ستون ها ی عددی رو بیام سه رقم سه رقم جدا کنم بهتره با تنظیم کاربر باشه

    :اگر تعداد ستونها به نحوی بود که اطلاعات بیشتر از عرض کاغذ بود بصورت خودکار کاغذ ما بصورت عریض تکمیل گردد و در ضمن اطلاعات در محدوده داخل صفحه تکمیل و فیت بشه و بعضی ستونها در صفحه بعدی نمایش داده نشه
    روش کار میکنم ببینم چی میشه ولی این قضیه در زمان پرینت قابل تنظیمه
    چهارم : سرستونها چاپ نمیشودHeadertext.text = ?????
    یه موردی هست اونم اینه که تویه این روش و حتی روش های مرسوم چاپ گریدکه وجود داره امکان تشخیص صفحه نیست به همین خاطر فقط تویه صفحه اول هدر ستون ها وجود داره و تنها راهی که فعلا به ذهنم میرسه اینه که تعداد سطر در هر صفحه رو از کاربر بگیرم . در کل اگه به این قدرت بخواهیم پرینت یسازیم باید با ابزار های گزارش گیری کار کنیم

  29. #29

    نقل قول: پرینت مستقیم از datagridview

    از زحمات شما ممنونم
    ولی حداقل از کلاس DGprintکاملتر باشه بهتره چون اون کلاس خوبیه ولی خب انشا اله با نظر و همت شما کلاسی بهتر ساخته بشه تا رودست اون کلاس را بیارید
    چون اون کلاس دارای گزینه های کامل سرستون - تیتر- عنوان - footer-header- title-headertext.text - ......می باشد

تاپیک های مشابه

  1. پرینت مستقیم بدون استفاده از crystalreportviewer
    نوشته شده توسط alirzn در بخش گزارش سازی با Crystal Report
    پاسخ: 7
    آخرین پست: چهارشنبه 13 اردیبهشت 1391, 14:45 عصر
  2. پرینت مستقیم بدون استفاده از crystalreportviewer
    نوشته شده توسط alirzn در بخش C#‎‎
    پاسخ: 3
    آخرین پست: سه شنبه 12 اردیبهشت 1391, 15:44 عصر
  3. سوال: مهمه . پرینت مستقیم از دیتا گرید.
    نوشته شده توسط siminhoseini در بخش C#‎‎
    پاسخ: 2
    آخرین پست: شنبه 12 تیر 1389, 11:45 صبح
  4. پرینت مستقیم در کریستال 9
    نوشته شده توسط maisam57 در بخش گزارش سازی با Crystal Report
    پاسخ: 1
    آخرین پست: پنج شنبه 09 خرداد 1387, 11:49 صبح
  5. پرینت مستقیم Image
    نوشته شده توسط Valadi در بخش مباحث عمومی دلفی و پاسکال
    پاسخ: 5
    آخرین پست: شنبه 24 شهریور 1386, 02:54 صبح

قوانین ایجاد تاپیک در تالار

  • شما نمی توانید تاپیک جدید ایجاد کنید
  • شما نمی توانید به تاپیک ها پاسخ دهید
  • شما نمی توانید ضمیمه ارسال کنید
  • شما نمی توانید پاسخ هایتان را ویرایش کنید
  •