on 04-16-2013 4:52 PM
I have the following code in my aspx page:
CrystalDecisions.CrystalReports.Engine.ReportDocument cryRpt = new CrystalDecisions.CrystalReports.Engine.ReportDocument();
cryRpt.Load(path1);
ReportClientDocumentWrapper docWrap = (ReportClientDocumentWrapper)cryRpt.ReportClientDocument;
AddReportDetailsSection(docWrap, detailsA.Width, detailsA.Height, "detailsC");
var detailsC = docWrap.ReportDefController.ReportDefinition.DetailArea.Sections[2];
if (detailsC != null)
{
detailsC.Format.EnableNewPageAfter = true;
detailsC.Format.PageOrientation = CrPaperOrientationEnum.crPaperOrientationLandscape;
docWrap.SubreportController.ImportSubreport("1sub", path2, detailsC);
}
var subReports = docWrap.ReportDefController.ReportObjectController.GetReportObjectsByKind(CrReportObjectKindEnum.crReportObjectKindSubreport);
foreach (var subReport in subReports) {
var iSubReport = subReport as ISCRSubreportObject;
iSubReport.Border.BottomLineStyle = iSubReport.Border.RightLineStyle
= iSubReport.Border.TopLineStyle = iSubReport.Border.LeftLineStyle = CrLineStyleEnum.crLineStyleNoLine;
}
cryRpt.SaveAs(path2);
But when I open saved report via SAP Crystal Reports Developer, i see that subreport was added with borders and details section C formatting wasn't changed. Can somebody tell me, what I'm missing?
The code looks good. However there were (possibly still are) issues with setting all kinds of print options. Lots of info on that in these forums. there have also been a number of fixes for print issues. Unfortunately, you don't mention version of CR or Service pack you might be using(?). Also, what version of VS?
- Ludek
Follow us on Twitter
Got Enhancement ideas? Try the SAP Idea Place
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.
HI,
thank you for reply. My CR version is 13.0.2000, VS 2010.
I've found some workaround.
To get report objects i've written such method:
protected static List<T> GetReportObjects<T>(CrystalDecisions.CrystalReports.Engine.ReportDocument report) where T
: class
{
List<T> resList = new List<T>();
IEnumerator re = report.ReportDefinition.ReportObjects.GetEnumerator();
re.Reset();
while (re.MoveNext())
{
if (re.Current != null)
{
var obj = re.Current as T;
if (obj != null)
{
resList.Add(obj);
}
}
}
return resList;
}
And then I use it like below:
var subRptObj = GetReportObjects<CrystalDecisions.CrystalReports.Engine.SubreportObject>(rptDoc).Where(s => s.Name.Equals("1sub")).SingleOrDefault();
if (subRptObj != null)
{
subRptObj.Border.BottomLineStyle = LineStyle.DotLine;
}
Maybe, this will help somebody.
User | Count |
---|---|
91 | |
10 | |
10 | |
9 | |
9 | |
7 | |
6 | |
5 | |
5 | |
4 |
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.