自定义Report后添加任何Sections都会报索引错误
因为客户一直用VB6 调用Report2生成PDF和Excel,现在需要用MVC并且升级Report10. 现在开始抓头。。。。Report2里面的调用方式到.net都会出错。帮忙看一下 我只是想添加PageHeader 并向里面添加一个label,其实添加不添加Label都会报错 会报一个索引越界的错误在 _rpt.Run(); 方法时。
SectionReport _rpt = new SectionReport();
_rpt.PrintWidth = 14400;
_rpt.PageSettings.Margins.Bottom = 720;
_rpt.PageSettings.Margins.Top = 720;
_rpt.PageSettings.Margins.Right = 720;
_rpt.PageSettings.Margins.Left = 720;
_rpt.PageSettings.Orientation = GrapeCity.ActiveReports.Document.Section.PageOrientation.Landscape;
var ph = new GrapeCity.ActiveReports.SectionReportModel.PageHeader();
ph.CanGrow = true;
ph.CanShrink = true;
ph.Name = "PageHeader";
_rpt.Sections.Add(ph);
GrapeCity.ActiveReports.SectionReportModel.Label lable1 = new GrapeCity.ActiveReports.SectionReportModel.Label();
ph.Controls.AddRange(new GrapeCity.ActiveReports.SectionReportModel.ARControl[] { lable1 });
lable1.Name = "lblHeading";
lable1.Text = "Users and Groups Report";
lable1.Height = 300;
lable1.Left = 0;
lable1.Top = 0;
lable1.Width = 3000;
lable1.VerticalAlignment = GrapeCity.ActiveReports.Document.Section.VerticalTextAlignment.Middle;
lable1.Alignment = GrapeCity.ActiveReports.Document.Section.TextAlignment.Left;
lable1.Style = "font-family: arial; font-size:17pt; font-weight:bold; font-style:italic; color: black";
lable1.BackColor = System.Drawing.Color.White;
int nLabelTop = 355;
ph.Visible = true;
ph.Height = 100;
//_rpt.Document.Name = "Users and Groups Report";
_rpt.Run();
string fileName = "C:\reports\new" + Guid.NewGuid().ToString() + ".pdf";
GrapeCity.ActiveReports.Export.Pdf.Section.PdfExport PdfExport = new GrapeCity.ActiveReports.Export.Pdf.Section.PdfExport();
PdfExport.Export(_rpt.Document, fileName); 我发现把detail 和 pageFooter补上就不会报索引错误了,但是现在报另外一个错误
Additional information: Margins are too large 把Margins值改小了,但是现在生成的PDF只显示“This document was created using an EVALUATION version of ActiveReports 10. Only a licensed user may legally create reports for use in production. Please report infractions or address questions to ActiveReports.Sales@grapecity.com. Copyright ©
2015 GrapeCity, inc. All rights reserved.”
我用的是Report10试用版 是用试用版无法开发吗? 试用版30天内免费试用。这个提示应该是超时了。你什么时候安装的? 回复 3楼lovezixue的帖子
lovezixue 上午好,
我看到你使用代码动态创建报表模板,不知你这边的主要需求是什么,大概描述一下吧,我们可以共同讨论一个最适合你的视线方案。
页:
[1]