StreamReader好象可以,但是无法指定某个字的大小?

解决方案 »

  1.   

    主要问题是 我所要打印的内容是怎么传过去.想象一下,你不用word 打印功能,你怎么把你的 word里面的内容(包括字体大小)发到打印机,打印出来.
      

  2.   

    <script language='javascript'>
    print();
    </script>
      

  3.   

    我只是举例有一个word文档.实际上根本没有word文档.
    刚才研究了以下printdocument可以实现.不过也是复杂.
      

  4.   

    只有用printdocument可以实现。以下是设置字体、XY位置和打印的变量。
    e.Graphics.DrawString(strchar1[1],new Font("仿宋体",11),Brushes.Black,0.2f,8.2f);
    用pageSetupDialog实现页面的设置。
     
     一点都不复杂!
      

  5.   

    用printdocument可以实现
    e.Graphics.DrawString(strchar1[1],new Font("仿宋体",11),Brushes.Black,0.2f,8.2f);
      

  6.   

    给你个报表工具看看 可不可以。。WWW.eastReport.net
      

  7.   

    参考:ms-help://MS.VSCC.2003/MS.MSDNQTR.2003FEB.2052/cpref/html/frlrfSystemDrawingPrintingPrintDocumentClassTopic.htm
    private void printButton_Click(object sender, EventArgs e) 
       {
          try 
          {
              streamToPrint = new StreamReader
                 ("C:\\My Documents\\MyFile.txt");
              try 
              {
                 printFont = new Font("Arial", 10);
                 PrintDocument pd = new PrintDocument();
                 pd.PrintPage += new PrintPageEventHandler
                    (this.pd_PrintPage);
                 pd.Print();
              }  
              finally 
              {
                 streamToPrint.Close();
              }
          }  
          catch(Exception ex) 
          {
              MessageBox.Show(ex.Message);
          }
       }   // The PrintPage event is raised for each page to be printed.
       private void pd_PrintPage(object sender, PrintPageEventArgs ev) 
       {
          float linesPerPage = 0;
          float yPos = 0;
          int count = 0;
          float leftMargin = ev.MarginBounds.Left;
          float topMargin = ev.MarginBounds.Top;
          string line = null;      // Calculate the number of lines per page.
          linesPerPage = ev.MarginBounds.Height / 
             printFont.GetHeight(ev.Graphics);      // Print each line of the file.
          while(count < linesPerPage && 
             ((line=streamToPrint.ReadLine()) != null)) 
          {
             yPos = topMargin + (count * 
                printFont.GetHeight(ev.Graphics));
             ev.Graphics.DrawString(line, printFont, Brushes.Black, 
                leftMargin, yPos, new StringFormat());
             count++;
          }      // If more lines exist, print another page.
          if(line != null)
             ev.HasMorePages = true;
          else
             ev.HasMorePages = false;
       }