Skip to content

Commit

Permalink
Merge pull request #52 from Icare67/master
Browse files Browse the repository at this point in the history
thanks @Icare67 !
  • Loading branch information
christopherpickering authored Oct 21, 2022
2 parents 3a8998d + a5caa40 commit 8edea8a
Showing 1 changed file with 30 additions and 2 deletions.
32 changes: 30 additions & 2 deletions RptToXml/RptDefinitionWriter.cs
Original file line number Diff line number Diff line change
Expand Up @@ -127,6 +127,7 @@ private void ProcessReport(ReportDocument report, XmlWriter writer)
GetDatabase(report, writer);
GetDataDefinition(report, writer);
GetCustomFunctions(report, writer);
GetSubReportsLinks(report, writer);
GetReportDefinition(report, writer);

writer.WriteEndElement();
Expand Down Expand Up @@ -187,6 +188,27 @@ private void GetPrintOptions(ReportDocument report, XmlWriter writer)
writer.WriteEndElement();
}

private void GetSubReportsLinks(ReportDocument report, XmlWriter writer)
{
if (report.IsSubreport)
{
writer.WriteStartElement("SubReportLinks");
CRReportDefModel.SubreportLinks subReportLinks = _report.ReportClientDocument.SubreportController.GetSubreportLinks(report.Name);

if (subReportLinks != null)
foreach (CRReportDefModel.SubreportLink link in subReportLinks)
{
writer.WriteStartElement("SubReportLink");
writer.WriteAttributeString("LinkedParameterName", link.LinkedParameterName);
writer.WriteAttributeString("MainReportFieldName", link.MainReportFieldName);
writer.WriteAttributeString("SubreportFieldName", link.SubreportFieldName);
writer.WriteEndElement();
}

writer.WriteEndElement();
}
}

[HandleProcessCorruptedStateExceptionsAttribute]
private void GetSubreports(ReportDocument report, XmlWriter writer)
{
Expand Down Expand Up @@ -884,8 +906,14 @@ private void GetReportObjects(Section section, ReportDocument report, XmlWriter
writer.WriteAttributeString("Left", reportObject.Left.ToString(CultureInfo.InvariantCulture));
writer.WriteAttributeString("Width", reportObject.Width.ToString(CultureInfo.InvariantCulture));
writer.WriteAttributeString("Height", reportObject.Height.ToString(CultureInfo.InvariantCulture));

if (reportObject is BoxObject)
if (reportObject is SubreportObject)
{
var srobj = (SubreportObject)reportObject;
writer.WriteAttributeString("SubreportName", srobj.SubreportName);
writer.WriteAttributeString("EnableOnDemand", srobj.EnableOnDemand.ToString(CultureInfo.InvariantCulture));

}
else if (reportObject is BoxObject)
{
var bo = (BoxObject)reportObject;
writer.WriteAttributeString("Bottom", bo.Bottom.ToString(CultureInfo.InvariantCulture));
Expand Down

0 comments on commit 8edea8a

Please sign in to comment.