打印空白页
本帖最后由 Crystal.Li 于 2021-8-30 16:59 编辑VB.net 代码如下:
Dim file_name As String = "..\..\PageReport2.rdlx"
Dim pageReport As New PageReport(New System.IO.FileInfo(file_name))
Dim pageDocument As New Document.PageDocument(pageReport)
pageDocument.Printer.Print()
PageReport2.rdlx中只画了一条线。
执行后打印了一张白纸,纸上没有画的线。
请问是什么原因?
谢谢,已经解决了。重新安装ActiveReprot。项目追加Section Report(code-base)。就可以了。虽然我用的是Report Page,没有用Section Report(code-base)。有些怪怪的。 您的报表模板能发一下吗?
James.Lv 发表于 2021-8-25 15:22
您的报表模板能发一下吗?
<?xml version="1.0" encoding="utf-8"?>
<Report xmlns="http://schemas.microsoft.com/sqlserver/reporting/2005/01/reportdefinition">
<dd:Name xmlns:dd="http://schemas.datadynamics.com/reporting/2005/02/reportdefinition">C:\Users\dayb\source\repos\WindowsApp1\WindowsApp1\PageReport2.rdlx</dd:Name>
<Body>
<Height>29.7cm</Height>
<ReportItems>
<FixedPage Name="FixedPage1">
<Pages>
<Page>
<ReportItems>
<Line Name="Line1">
<Height>0in</Height>
<Left>1.4cm</Left>
<Style>
<BorderColor>
<Default>Red</Default>
</BorderColor>
<BorderWidth>
<Default>10pt</Default>
</BorderWidth>
</Style>
<Top>4cm</Top>
<Width>13.6cm</Width>
<ZIndex>3</ZIndex>
</Line>
<Line Name="Line2">
<Height>1.2cm</Height>
<Left>3cm</Left>
<Top>0.8cm</Top>
<Width>9.599999cm</Width>
<ZIndex>4</ZIndex>
</Line>
</ReportItems>
</Page>
</Pages>
</FixedPage>
</ReportItems>
</Body>
<BottomMargin>2.5cm</BottomMargin>
<Code>aaaa</Code>
<PageHeight>29.7cm</PageHeight>
<PageWidth>21cm</PageWidth>
<RightMargin>2.5cm</RightMargin>
<Width>21cm</Width>
<dd:ReportStyleSheet xmlns:dd="http://schemas.datadynamics.com/reporting/2005/02/reportdefinition">
<StyleSheetSource>Embedded</StyleSheetSource>
</dd:ReportStyleSheet>
<DocumentMap xmlns="http://schemas.datadynamics.com/reporting/2005/02/reportdefinition">
<NumberingStyle>Decimal</NumberingStyle>
</DocumentMap>
</Report>
你好,我看了你的打印代码是么有问题的,这块你先在你的项目中预览,看看报表的一个预览的结果,调用工具栏默认的打印的看打印是否能够正常打印代码:
string file_name = @"..\..\PageReport1.rdlx";
GrapeCity.ActiveReports.PageReport pageReport = new GrapeCity.ActiveReports.PageReport(new System.IO.FileInfo(file_name));
GrapeCity.ActiveReports.Document.PageDocument pageDocument = new GrapeCity.ActiveReports.Document.PageDocument(pageReport);
pageDocument.Print(true, true, false);
KearneyKang 发表于 2021-8-25 17:05
你好,我看了你的打印代码是么有问题的,这块你先在你的项目中预览,看看报表的一个预览的结果,调用工具栏 ...
用VS中的Preview看模板是没有问题。VS中工具栏打印也没有问题。我是用试用版在评价,不知道是否有限制。另外,错误窗口提示警告信息。依存的GrapeCity.ActiveReports.Document, Version=14.0.19137.0, Culture=neutral, PublicKeyToken=cc4967777c49a3ff找不到。可能是环境有问题。但是,编译和运行全通过了,只是打印不出内容。郁闷了。:dizzy: DYB 发表于 2021-8-25 17:33
用VS中的Preview看模板是没有问题。VS中工具栏打印也没有问题。我是用试用版在评价,不知道是否有限制。 ...
您再重新创建一个报表,拖动个文本框写点文字啥的,再打印看能打印出来吗? James.Lv 发表于 2021-8-25 18:23
您再重新创建一个报表,拖动个文本框写点文字啥的,再打印看能打印出来吗?
还是不行。:'( DYB 发表于 2021-8-26 09:53
还是不行。
再检查一下报表设计里面层上面的可见性是不是选择的ALL。
如果这块的配置没问题的话,那就是您的程序有问题,需要您自己排查一下了
James.Lv 发表于 2021-8-26 11:30
再检查一下报表设计里面层上面的可见性是不是选择的ALL。
如果这块的配置没问题的话,那就是您的程序 ...
还是不行,有简单的可运行的DEMO吗?我在我的环境运行运行看看。我怀疑是环境问题。谢谢!