Skip to Content
0
Former Member
Apr 16, 2013 at 03:52 PM

Can't change section format properties in codebehind

55 Views

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?