<output id="qn6qe"></output>

    1. <output id="qn6qe"><tt id="qn6qe"></tt></output>
    2. <strike id="qn6qe"></strike>

      亚洲 日本 欧洲 欧美 视频,日韩中文字幕有码av,一本一道av中文字幕无码,国产线播放免费人成视频播放,人妻少妇偷人无码视频,日夜啪啪一区二区三区,国产尤物精品自在拍视频首页,久热这里只有精品12

      代碼實現報表打印

         代碼實現報表打印

         

           //初始化報表信息
      private void SetReportInfo(string reportPath,string sourceName,DataTable dataSource,bool isFengPi)
      {
      if (!File.Exists(reportPath))
      {
      MessageBox.Show(
      "報表文件:" + reportPath + " 不存在!","提示", MessageBoxButtons.OK, MessageBoxIcon.Information);
      return;
      }

      if (dataSource == null || dataSource.Rows.Count == 0)
      {
      MessageBox.Show(
      "沒有找到案卷號為:"+txtArchiveNum.Text.Trim()+"的相關目錄信息", "提示", MessageBoxButtons.OK, MessageBoxIcon.Information);
      return;
      }
      pos
      = 1;
      LocalReport report1
      = new LocalReport();
      //設置需要打印的報表的文件名稱。
      report1.ReportPath = reportPath;
      if (isFengPi)
      {
      //設置參數
      string archveTypeName = GetArchiveTypeName();
      ReportParameter archiveType
      = new ReportParameter("ArchiveType", archveTypeName);
      report1.SetParameters(archiveType);
      }
      //創建要打印的數據源
      ReportDataSource source = new ReportDataSource(sourceName, dataSource);
      report1.DataSources.Add(source);
      //刷新報表中的需要呈現的數據
      report1.Refresh();
      pos
      = 2;
      m_streams
      = new List<Stream>();
      string deviceInfo ="<DeviceInfo>" +
      " <OutputFormat>EMF</OutputFormat>" +
      " <PageWidth>21cm</PageWidth>" +
      " <PageHeight>29.7cm</PageHeight>" +
      " <MarginTop>2.0066cm</MarginTop>" +
      " <MarginLeft>2.0066cm</MarginLeft>" +
      " <MarginRight>2.0066cm</MarginRight>" +
      " <MarginBottom>2.0066cm</MarginBottom>" +
      "</DeviceInfo>";
      Warning[] warnings;
      //將報表的內容按照deviceInfo指定的格式輸出到CreateStream函數提供的Stream中。
      report1.Render("Image", deviceInfo, CreateStream, out warnings);
      }

      //聲明一個Stream對象的列表用來保存報表的輸出數據
      //LocalReport對象的Render方法會將報表按頁輸出為多個Stream對象。
      private List<Stream> m_streams;
      //用來提供Stream對象的函數,用于LocalReport對象的Render方法的第三個參數。
      private Stream CreateStream(string name, string fileNameExtension, Encoding encoding, string mimeType, bool willSeek)

      {
      pos
      = 3;
      //如果需要將報表輸出的數據保存為文件,請使用FileStream對象。
      Stream stream = new MemoryStream();
      m_streams.Add(stream);
      return stream;
      }

      //用來記錄當前打印到第幾頁了
      private int m_currentPageIndex;

      #region 打印報表
      private void Print()
      {
      pos
      = 4;
      m_currentPageIndex
      = 0;
      if (m_streams == null || m_streams.Count == 0)
      return;
      //聲明PrintDocument對象用于數據的打印
      PrintDocument printDoc = new PrintDocument();
      //指定需要使用的打印機的名稱,使用空字符串""來指定默認打印機
      // printDoc.PrinterSettings.PrinterName = "";
      //判斷指定的打印機是否可用
      if (!printDoc.PrinterSettings.IsValid)
      {
      MessageBox.Show(
      "沒有找到打印機!","提示",MessageBoxButtons.OK,MessageBoxIcon.Information);
      return;
      }
      pos
      = 5;
      printDoc.PrintPage
      += new PrintPageEventHandler(PrintPage);
      //執行打印操作,Print方法將觸發PrintPage事件。
      printDoc.Print();

      //釋放資源
      foreach (Stream stream in m_streams)
      {
      stream.Dispose();
      stream.Close();
      }
      m_streams
      = null;
      }

      private void PrintPage(object sender, PrintPageEventArgs ev)
      {
      pos
      =6;
      //Metafile對象用來保存EMF或WMF格式的圖形,
      //我們在前面將報表的內容輸出為EMF圖形格式的數據流。
      m_streams[m_currentPageIndex].Position = 0;
      Metafile pageImage
      = new Metafile(m_streams[m_currentPageIndex]);
      //指定是否橫向打印
      ev.PageSettings.Landscape = false;
      //這里的Graphics對象實際指向了打印機
      ev.Graphics.DrawImage(pageImage, ev.PageBounds);
      m_streams[m_currentPageIndex].Close();
      m_currentPageIndex
      ++;
      //設置是否需要繼續打印
      ev.HasMorePages = (m_currentPageIndex < m_streams.Count);
      }
      #endregion

      //打印封皮
      private void btPrint_Click(object sender, EventArgs e)
      {
      string reportPath = Application.StartupPath + "\\Files\\ReportEnvelop.rdlc";
      SetReportInfo(reportPath,
      "DataSet1", GetDataSource(true), true);
      Print();

      }
      posted @ 2010-11-18 15:42  古文觀芷  閱讀(1496)  評論(0)    收藏  舉報
      主站蜘蛛池模板: 日韩国产成人精品视频| 日本电影一区二区三区| 精品国产成人a在线观看| 女人与牲口性恔配视频免费| 国产成人亚洲综合图区| 久久久久国色av免费观看性色 | 麻豆国产尤物av尤物在线观看| 久久人与动人物a级毛片| 亚洲精品一区二区三区蜜| 亚洲激情av一区二区三区| 十四以下岁毛片带血a级| 久久精品一区二区三区中文字幕| 日韩av在线不卡一区二区三区 | 草裙社区精品视频播放| 五月天丁香婷婷亚洲欧洲国产| 欧美白妞大战非洲大炮| 人妻久久久一区二区三区| 国产成人av电影在线观看第一页| 国产精品一区二区久久岳| 国产明星精品无码AV换脸| 老司机午夜福利视频| 东方四虎在线观看av| 国产精品午夜福利片国产| 福利一区二区1000| 香港特级三A毛片免费观看| 性欧美VIDEOFREE高清大喷水| 成人午夜免费无码视频在线观看 | 亚洲婷婷综合色香五月| 成人午夜大片免费看爽爽爽 | 风韵丰满熟妇啪啪区老熟熟女| 久久青青草原精品国产app| 亚洲一二三区精品美妇| 免费无码毛片一区二三区| 国产成人无码A区在线观看视频 | 丝袜老师办公室里做好紧好爽| 久久精品国产99国产精品严洲| 亚洲av成人一区二区三区| 亚洲人成人无码网WWW电影首页 | 激情综合色综合啪啪开心| 国产视频不卡一区二区三区| 麻豆国产va免费精品高清在线|