Windows窗体Rdlc打印时本地报告打印区域减少 [英] Windows Form Rdlc Local report print area get reduced when printing

查看:73
本文介绍了Windows窗体Rdlc打印时本地报告打印区域减少的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

使用VS 2010 Professional SP1版本10.0.40219.1 SP1Rel,Microsoft .NET Framework版本4.5.50709 SP1Rel(针对4.0客户端配置文件的项目)


我的本地报告几乎具有物理页面的尺寸(A4,但问题也出现在使用不同的页面格式),占据了大部分
  彩色的身体区域,只有一个较小的白色矩形。我使用ReportViewer对象显示它,报告显示为:



导出报告时在PDF中,我得到一个正确的几乎填充的页面,但是当它被渲染用于打印(或者也只是进入打印布局模式)时,我得到的报告缩小了大约28.8%的页面,如下图所示:



我在rdlc xml中播放了一些测量值用Cm表示,其他测量值用英寸表示,所以,怀疑一些转换错误,我将所有内容统一在英寸中,但是结果没有改变。


这是rdlc XML:


< p style ="line-height:normal; margin-bottom:0pt"> < ;? xml
版本 = " 1.0 "
编码 = " utf-8 " ?>


< 报告
xmlns:rd = " http://schemas.microsoft.com/SQLServer/reporting/reportdesigner "
xmlns = " http://schemas.microsoft.com/sqlserver/reporting/2008/01/reportdefinition " >


 
<
Body >


   
<
ReportItems >


     
<
矩形
名称 = " Rectangle1 " >


       
<
KeepTogether > false < / KeepTogether >


       
<
顶部 > 0.1in < / 顶部 >


       
<
> 0.1in < / >


       
<
高度 > 11.0in < / 高度 >


       
<
宽度 > 8.0in < / 宽度 >


       
<
样式 >


         
<
边框 >


           
<
样式 > Solid < / 样式 >


           
<
宽度 > 2pt < / 宽度 >


         
< /
边框 >


         
<
BackgroundColor > 白色< / BackgroundColor >


       
< /
样式 >


     
< /
矩形 >


   
< /
ReportItems >


   
<
高度 > 11.68in < / 高度 >


   
<
样式 >


     
<
边框 >


       
<
样式 > Solid < / 样式 >


     
< /
边框 >


     
<
BackgroundColor > LavenderBlush < / BackgroundColor >


   
< /
样式 >


 
< /
Body >


 
<
宽度 > 8.26in < / 宽度 >


 
<
页面 >


   
<
PageHeight > 11.69in < / PageHeight >


   
<
PageWidth > 8.27in < / PageWidth >


   
<
ColumnSpacing > 0.05118in < / ColumnSpacing >


   
<
样式 />


 
< /
页面 >


 
<
rd:ReportID > cd764b76-de7d-47e4-966e-85c1b3325f82 < / rd:ReportID >


 
<
rd:ReportUnitType > 英寸< / rd:ReportUnitType >


< / 报告 >



试过一些方法直接打印报告(从以前的线程获得一些代码),但没有成功。


(参见代码和解决方案附在此处:  测试解决方案 )。


任何人都可以帮助我解决问题吗?


提前谢谢。


Flavio。


解决方案

知道了!


当你使显示器的字符大小变大(150%)时会出现问题(错误!):在此不仅ReportViewer控件显示  打印预览错误,但它也压缩了printou打印机
(即使您没有通过打印预览也会发生这种情况)。


所以不要使用更大的字符!


Using VS 2010 Professional SP1 Version 10.0.40219.1 SP1Rel, Microsoft .NET Framework Version 4.5.50709 SP1Rel (project targeted at 4.0 client profile)

I have a local report having almost the dimensions of the physical page (A4, but the problem arise also using different page formats), occupying most of its  colored body area with a just smaller white rectangle. I show it out using a ReportViewer object, and the report shows as:

When I export the report in PDF, I get a correctly almost filled page, but when it is rendered for printing (or also just going in Print Layout mode), I get the report shrunk of about 28,8% of the page, as in the following picture:

I sow in the rdlc xml that some measurements were expressed in Cm and others in Inches, so, suspecting some conversion errors, I unified everything in Inches, but the result didn’t change.

Here is the rdlc XML:

<?xml version="1.0" encoding="utf-8"?>

<Report xmlns:rd="http://schemas.microsoft.com/SQLServer/reporting/reportdesigner" xmlns="http://schemas.microsoft.com/sqlserver/reporting/2008/01/reportdefinition">

  <Body>

    <ReportItems>

      <Rectangle Name="Rectangle1">

        <KeepTogether>false</KeepTogether>

        <Top>0.1in</Top>

        <Left>0.1in</Left>

        <Height>11.0in</Height>

        <Width>8.0in</Width>

        <Style>

          <Border>

            <Style>Solid</Style>

            <Width>2pt</Width>

          </Border>

          <BackgroundColor>White</BackgroundColor>

        </Style>

      </Rectangle>

    </ReportItems>

    <Height>11.68in</Height>

    <Style>

      <Border>

        <Style>Solid</Style>

      </Border>

      <BackgroundColor>LavenderBlush</BackgroundColor>

    </Style>

  </Body>

  <Width>8.26in</Width>

  <Page>

    <PageHeight>11.69in</PageHeight>

    <PageWidth>8.27in</PageWidth>

    <ColumnSpacing>0.05118in</ColumnSpacing>

    <Style />

  </Page>

  <rd:ReportID>cd764b76-de7d-47e4-966e-85c1b3325f82</rd:ReportID>

  <rd:ReportUnitType>Inch</rd:ReportUnitType>

</Report>

Tried some ways to directly print out the report (got some code from previous threads) too, but unsuccessfully.

(See the code & solution attached here: Test solution).

Can anyone help me in getting what’s the matter?

Thank you in advance.

Flavio.

解决方案

Got it!

The problem (bug!) arises when you make the display’s character size larger (150%): in this case not only the ReportViewer control get wrong displaying the print preview, but it also compresses the printout on the printer (this happens even if you don’t pass through the print preview).

So don’t use larger characters!


这篇关于Windows窗体Rdlc打印时本地报告打印区域减少的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆