Different background Images @MasterPage

Shasha
edited February 11, 2022 in Analytics #1
<p>Hi All,</p>
<p> </p>
<p>I have a 6 pages in a report design all of them have a single master page.</p>
<p>Now, I want to show 6 different background images for each of the page using the same master page as my master page has header and footer also and If I add image on pages itself in some report Item I can see blank spaces at top and bottom.</p>
<p> </p>
<p>Any idea How I can change report master page image at runtime?</p>
<p> </p>
<p>I have the following code but it is changing the image for all the pages.</p>
<p> </p>
<div>//Getting the Portfolio Grid and adding that to report layout</div>
<div>SectionDescriptionPortfolio = libhandle.findElement("SectionDescPortfolio");</div>
<div>reportContext.getDesignHandle().findMasterPage("SectionDescMasterPage").setProperty('backgroundImage','Images/PortfolioOverview.JPG');</div>
<div>SectionDescriptionPortfolio.setProperty('masterPage','SectionDescMasterPage');</div>
<div>SectionDescriptionPortfolioLayout = elementFactory.newElementFrom(SectionDescriptionPortfolio, "SectionDescriptionPortfolio");</div>
<div>reportContext.getDesignHandle().getBody().add(SectionDescriptionPortfolioLayout);</div>
<p> </p>
<p> </p>
<div>//Getting the RiskReturn Grid and adding that to report layout</div>
<div>
<div>SectionDescriptionRiskReturn = libhandle.findElement("SectionDescRiskReturn");</div>
<div>reportContext.getDesignHandle().findMasterPage("SectionDescMasterPage").setProperty('backgroundImage','Images/RiskReturn.JPG');</div>
<div>SectionDescriptionRiskReturn.setProperty('masterPage','SectionDescMasterPage');</div>
<div>SectionDescriptionRiskReturnLayout = elementFactory.newElementFrom(SectionDescriptionRiskReturn, "SectionDescriptionRiskReturn");</div>
<div>reportContext.getDesignHandle().getBody().add(SectionDescriptionRiskReturnLayout);</div>
</div>
<div> </div>
<div> </div>
<div>Ideally it should add 2 different images but I can see only the last image. ie. RiskReturn Image.</div>
<div> </div>
<div>help will be much appreciated.</div>
<div><br>
regards</div>
<div>Shasha</div>

Comments

  • <p>Is it 6 different report items (grids, tables,...)? Then you can have 6 master pages and change the master page for each table? I do not think it is possible to change the image of the master page per page as it's events are only called once.</p>
  • <p>Hi,</p>
    <p> </p>
    <p>Yes I have 6 different Tables. Using 6 different master page is working. Only thing is I wanted to check if it can be done only with a single master page as design for all master pages are same and its just background image that is changing.</p>
    <p> </p>
    <p>Thanks for the clarification. I will go ahead and use 6 different master pages. Please let me know if there is any other way for handling this.</p>
    <p> </p>
    <p>Regards</p>
    <p>Shasha</p>
  • <p>I was just wondering if I can copy this masterpage and then change the image dynamically at runtime? is that possible?</p>
    <p> </p>
    <p>I am able to do it for varios elements but not for master page.</p>
    <p> </p>
    <p>Eg.-</p>
    <p><span style="color:rgb(40,40,40);font-family:'Source Sans Pro', sans-serif;">SectionDescriptionRiskReturnLayout = elementFactory.newElementFrom(SectionDescriptionRiskReturn, "SectionDescriptionRiskReturn");</span></p>
    <p> </p>
    <p><span style="color:rgb(40,40,40);font-family:'Source Sans Pro', sans-serif;">Is that possible?</span></p>
  • <p>I do not think so as the master page events only get called once, not for each page.</p>