示例#1
0
        public string GetActuallNamedFilePath(OutputFormat outputFormat, string reportName)
        {
            var    outPutDir = TestDeploymentHelper.GetTestOutputDir();
            string extension = outputFormat.ToFileExtension();

            var    actualReportFilePath = Path.Combine(outPutDir, string.Format("CurrentReport.{0}", extension));
            string actualNamedFilePath  = Path.Combine(outPutDir, string.Format("{0}.{1}", reportName, extension));

            File.Copy(actualReportFilePath, actualNamedFilePath, true);

            return(actualNamedFilePath);
        }
        public virtual void ReplaceHeaderFooter(XmlDocument doc, XmlNamespaceManager xmlNsmgr, PaperType paperType, MandantLogoModel mandantLogoModel, OutputFormat outputFormat)
        {
            XmlNode docPageNode   = doc.SelectSingleNode("//nm:Page", xmlNsmgr);
            XmlNode docReportNode = doc.SelectSingleNode("//nm:Report", xmlNsmgr);

            RemoveXmlNode(PageHeaderXPath, doc, docPageNode, xmlNsmgr);
            RemoveXmlNode(PageFooterXPath, doc, docPageNode, xmlNsmgr);
            RemoveXmlNode(EmbeddedImagesXPath, doc, docReportNode, xmlNsmgr);

            Stream templateRdlcXmlStream = reportResourceLocator.GetReportDefinitionStream(string.Format("{0}{1}_{2}.rdlc", HeaderFooterSubreportRdlcName, paperType, outputFormat.ToFileExtension()));

            var templateDoc = new XmlDocument();

            templateDoc.Load(templateRdlcXmlStream);

            var templateDocHeader = templateDoc.SelectSingleNode(PageHeaderXPath, xmlNsmgr);

            PositionMandantLogo(templateDocHeader, xmlNsmgr, mandantLogoModel);

            docPageNode.InnerXml   += templateDocHeader.OuterXml;
            docPageNode.InnerXml   += templateDoc.SelectSingleNode(PageFooterXPath, xmlNsmgr).OuterXml;
            docReportNode.InnerXml += templateDoc.SelectSingleNode(EmbeddedImagesXPath, xmlNsmgr).OuterXml;

            //PositionMandantLogo(docPageNode, xmlNsmgr, mandantLogoModel);

            var reportParametersNode = doc.SelectSingleNode("//nm:ReportParameters", xmlNsmgr);

            reportParametersNode.InnerXml += "<ReportParameter Name=\"ReportTitle\"><DataType>String</DataType><Prompt>ReportParameter1</Prompt></ReportParameter>";
            reportParametersNode.InnerXml += "<ReportParameter Name=\"FooterText\"><DataType>String</DataType><Nullable>true</Nullable><AllowBlank>true</AllowBlank><Prompt>ReportParameter1</Prompt></ReportParameter>";
            reportParametersNode.InnerXml += "<ReportParameter Name=\"IsExcelOutput\"><DataType>Boolean</DataType><Prompt>ReportParameter1</Prompt></ReportParameter>";
        }