function readOnly(count){ }
Starting November 20, the site will be set to read-only. On December 4, 2023,
forum discussions will move to the Trailblazer Community.
+ Start a Discussion
Corey Edwards 90Corey Edwards 90 

Add Report to Visualforce page

Hi All,

I have tried using the below code to bring through a report table onto a visualforce page but its only showing the head etc and no report on the page.. I know you can easily display a report chart, but this isnt what i am after. I could really do with this or another solution. Hopefully someone can help. 

Code below..
<apex:page standardController="User" sidebar="false" showHeader="false">
    <script src="https://ajax.googleapis.com/ajax/libs/jquery/3.1.1/jquery.min.js"></script>
  <apex:pageBlock>
    <apex:pageBlockSection title="Dealer Logins" id="DealerLogins" columns="1" />
    
    <script language="JavaScript">
    $('[id$="00O1o000004sZc3 "] > .pbSubsection > .detailList').load('/00O1o000004sZc3 table.reportTable.matrixReportTable');
</script>

<style type="text/css">
    [id$="EmbeddedReport"] > .pbSubsection { margin-top:10px; }
    [id$="EmbeddedReport"] > .pbSubsection tr:first-of-type th, 
    [id$="EmbeddedReport"] > .pbSubsection tr:first-of-type td {
      border-top:1px solid #d4dadc!important; }
    [id$="EmbeddedReport"] > .pbSubsection th, 
    [id$="EmbeddedReport"] > .pbSubsection td {
        font-size: 12px; padding:3px 6px 3px 5px; background-color:#fff; border-color:#d4dadc!important; border-bottom:1px solid #d4dadc!important; } 
   [id$="EmbeddedReport"] > .pbSubsection th { background-color:#eee; }
   [id$="EmbeddedReport"] > .pbSubsection .grandTotal { background-color:#d4dadc; }
   [id$="EmbeddedReport"] > .pbSubsection .drilldown { display:none; }
</style>
</apex:pageBlock>

</apex:page>

 
PrasathPrasath
Hi

You can add Reports to the VF Page simply by using <analytics:reportChart>

Example:
<apex:page>
    <analytics:reportChart reportId="00O28000008xyXs" >
    </analytics:reportChart>
</apex:page>

 
Corey Edwards 90Corey Edwards 90
That is adding a report chart, not the actual report... 
PrasathPrasath
try this code
 
<apex:page >
  <apex:iframe src="/00O28000008xyXs"/> 
</apex:page>

 
Corey Edwards 90Corey Edwards 90
im sure clickjack restricts this. I could be wrong... 
Parmanand PathakParmanand Pathak
Hi Corey,

Please follow the below steps in order to achieve this -

1.Go to the report tab
2. Click on your report
3.Click F12 to inspect element
4. Copy the src of your report as below - 

User-added image
<apex:page >
    <apex:iframe src="....Paste the src here....."/>
</apex:page>
You can also change the height and width of the iframe using 'height' and 'width' attribute.


 
Corey Edwards 90Corey Edwards 90
that didnt work... i do not want to show anything on a dashboard, nor do i want to show a chart/graph. I want to display a matrix report, in the same format in a visualforce page.. is this possible?