日期:2014-05-17  浏览次数:20969 次

不使用Report Viewer直接打印RDL,如何设置字体大小?
本帖最后由 xyzhilong 于 2013-08-13 09:54:18 编辑
如题,参照http://msdn.microsoft.com/zh-cn/library/microsoft.reporting.winforms.createstreamcallback(v=vs.110).aspx可实现打印功能,但是字体超大,无法打全内容,如何设置字体大小??

代码如下
 
using System;
using System.IO;
using System.Data;
using System.Text;
using System.Drawing.Imaging;
using System.Drawing.Printing;
using System.Collections.Generic;
using Microsoft.Reporting.WinForms;

public class Demo : IDisposable
{
    private int m_currentPageIndex;
    private IList<Stream> m_streams;

    private DataTable LoadSalesData()
    {
        DataSet dataSet = new DataSet();
        dataSet.ReadXml("data.xml");
        return dataSet.Tables[0];
    }

    private Stream CreateStream(string name, string fileNameExtension, Encoding encoding,
                              string mimeType, bool willSeek)
    {
        Stream stream = new FileStream(name + "." + fileNameExtension, FileMode.Create);
        m_streams.Add(stream);
        return stream;
    }

    private void Export(LocalReport report)
    {
        string deviceInfo =
          "<DeviceInfo>" +
          "  <OutputFormat>EMF</OutputFormat>" + 
          "  <PageWidth>8.5in</PageWidth>" +
          "  <PageHeight>11in</PageHeight>" +
          "  <MarginTop>0.25in</MarginTop>" +
          "  <MarginLeft>0.25in</MarginLeft>" +
          "  <MarginRight>0.25in</MarginRight>" +