How to hide pdf in export option in ssrs ReportViewer

Hi,
This is the code which is used for ReportViewer 2008 and i need code for ReportViewer 2010.
so please help me out asap.
   private void CustomizeReportViewer(System.Web.UI.Control reportControl)
            foreach (System.Web.UI.Control childControl in reportControl.Controls)
                if (childControl.GetType() == typeof(System.Web.UI.WebControls.DropDownList))
                    System.Web.UI.WebControls.DropDownList ddList = (System.Web.UI.WebControls.DropDownList)childControl;
                    if (ddList.ToolTip.Contains("Export"))
                        ddList.PreRender += new EventHandler(ddList_PreRender);
                if (childControl.GetType() == typeof(System.Web.UI.WebControls.Button))
                    System.Web.UI.WebControls.Button ddList = (System.Web.UI.WebControls.Button)childControl;
                    if (ddList.UniqueID.Contains("ctl00_ContentPlaceHolder1_rptviewerByBrandBySentimentAttribute_ctl06_ctl04_ctl00_Button"))
                        ddList.PreRender += new EventHandler(ddList_PreRender);
                if (childControl.Controls.Count > 0)
                    CustomizeReportViewer(childControl);
        // This is the event handler added from CustomizeRV 
        // We just check the object type to get what we needed. 
        // Once the dropdownlist is found, we check if it is for the ExportGroup. 
        // Meaning, the "Excel" text should exists. 
        // Then, just traverse the list and disable the "Excel". 
        // When the report is shown, "Excel" will no longer be on the list. 
        // You can also do this to "PDF" or if you want to change the text. 
        void ddList_PreRender(object sender, EventArgs e)
            if (sender.GetType() == typeof(System.Web.UI.WebControls.DropDownList))
                System.Web.UI.WebControls.DropDownList ddList = (System.Web.UI.WebControls.DropDownList)sender;
                System.Web.UI.WebControls.ListItemCollection listItems = ddList.Items;
                if ((listItems != null) && (listItems.Count > 0) && (listItems.FindByText("Excel") != null))
                    foreach (System.Web.UI.WebControls.ListItem list in listItems)
                        if (list.Text.Equals("XML file with report data") || list.Text.Equals("CSV (comma delimited)") || list.Text.Equals("TIFF file") || list.Text.Equals("Word") || list.Text.Contains("PPS"))
                            list.Enabled = false;
susana w

Hi God’s Favorite,
Thanks for your post.
According to your description, you would like to disable the SSRS rendering format PDF in VS 2010 ReportViewer control, please
refer to the steps below I demonstrate for you:
1. Add the method below to your .aspx.cs file as back-end code.
/// <summary>
/// Hidden the special SSRS rendering format in ReportViewer control
/// </summary>
/// <param name="ReportViewerID">The ID of the relevant ReportViewer control</param>
/// <param name="strFormatName">Format Name</param>
public void DisableUnwantedExportFormat(ReportViewer ReportViewerID,
string strFormatName)
FieldInfo info;
foreach (RenderingExtension extension
in ReportViewerID.ServerReport.ListRenderingExtensions())
if (extension.Name == strFormatName)
info = extension.GetType().GetField("m_isVisible",
BindingFlags.Instance |
BindingFlags.NonPublic);
info.SetValue(extension, false);
2. Choose the relevant Reportviewer control and press F4.
3.  In the Properties window, click the Events icon, then double click the PreRender item to generate the
ReportViewer1_PreRender method, I assume your reportViewer control ID is ReportViewer1,
edit your method like below:
protected void ReportViewer1_PreRender(object sender,
EventArgs e)
DisableUnwantedExportFormat((ReportViewer)sender,"PDF");
After you complete the steps above, run your project and it works just as you expected.
Thanks,
Bill Lu
Please remember to mark the replies as answers if they help and unmark them if they provide no help.

Similar Messages

  • ReportViewer 2010:how to hide pdf in export option in reportviewer

    please help me out 
    how shoul i hide pdf in export option in reportviewer
    susana w

    Hi,
    This is the code which is used for ReportViewer 2008 and i need code for ReportViewer 2010. I don't want to change in the reportserver's RSReportSErver.Config
    file because same report server we are using for different projects where in some projects we require pdf and some we do not. Below is the code for reportviwer 2008 where the export button is rendered as a dropdown and in reportviwer 2010, Export button is
    redered as div element and all the export options like pdf,word,etc elements are rendered as div elements . So in code behind how can i access these export button options?
       private void CustomizeReportViewer(System.Web.UI.Control reportControl)
                foreach (System.Web.UI.Control childControl in reportControl.Controls)
                    if (childControl.GetType() == typeof(System.Web.UI.WebControls.DropDownList))
                        System.Web.UI.WebControls.DropDownList ddList = (System.Web.UI.WebControls.DropDownList)childControl;
                        if (ddList.ToolTip.Contains("Export"))
                            ddList.PreRender += new EventHandler(ddList_PreRender);
                    if (childControl.GetType() == typeof(System.Web.UI.WebControls.Button))
                        System.Web.UI.WebControls.Button ddList = (System.Web.UI.WebControls.Button)childControl;
                        if (ddList.UniqueID.Contains("ctl00_ContentPlaceHolder1_rptviewerByBrandBySentimentAttribute_ctl06_ctl04_ctl00_Button"))
                            ddList.PreRender += new EventHandler(ddList_PreRender);
                    if (childControl.Controls.Count > 0)
                        CustomizeReportViewer(childControl);
            // This is the event handler added from CustomizeRV 
            // We just check the object type to get what we needed. 
            // Once the dropdownlist is found, we check if it is for the ExportGroup. 
            // Meaning, the "Excel" text should exists. 
            // Then, just traverse the list and disable the "Excel". 
            // When the report is shown, "Excel" will no longer be on the list. 
            // You can also do this to "PDF" or if you want to change the text. 
            void ddList_PreRender(object sender, EventArgs e)
                if (sender.GetType() == typeof(System.Web.UI.WebControls.DropDownList))
                    System.Web.UI.WebControls.DropDownList ddList = (System.Web.UI.WebControls.DropDownList)sender;
                    System.Web.UI.WebControls.ListItemCollection listItems = ddList.Items;
                    if ((listItems != null) && (listItems.Count > 0) && (listItems.FindByText("Excel") != null))
                        foreach (System.Web.UI.WebControls.ListItem list in listItems)
                            if (list.Text.Equals("XML file with report data") || list.Text.Equals("CSV (comma delimited)") || list.Text.Equals("TIFF file") || list.Text.Equals("Word") || list.Text.Contains("PPS"))
                                list.Enabled = false;

  • ReportViewer 2010:how to hide pdf in export option in subreports in reportviewer

    Hi,
    I am using ReportViewer 2010 and using code (posted below) to hide certain options from export, its working fine for parent report,  but when i am clicking on parent report to view child report, then export option in child report is showing all the
    items in export option which all are hided in parent report. So please help me out.
    private void DisableUnwantedExportFormats()
                FieldInfo info;
                foreach (RenderingExtension extension in rptviewerByBrandBySentimentAttribute.ServerReport.ListRenderingExtensions())
                    if (extension.Name != "PDF" && extension.Name != "ASPPT" && extension.Name != "ASPPTX" && extension.Name != "EXCEL" && extension.Name != "MHTML") // only PDF and Excel
    - remove the other options
                        info = extension.GetType().GetField("m_isVisible", BindingFlags.Instance | BindingFlags.NonPublic);
                        info.SetValue(extension, false);
                    if (extension.Name == "ASPPT") // change "Excel" name on the list to "Excel 97-2003 Workbook"
                        info = extension.GetType().GetField("m_localizedName", BindingFlags.Instance | BindingFlags.NonPublic);
                        if (info != null) info.SetValue(extension, "PowerPoint 2003");
                    if (extension.Name == "ASPPTX") // change "Excel" name on the list to "Excel 97-2003 Workbook"
                        info = extension.GetType().GetField("m_localizedName", BindingFlags.Instance | BindingFlags.NonPublic);
                        if (info != null) info.SetValue(extension, "PowerPoint 2007");
    neha

    Hi,
    Thank you for this article.
    I am using the localreport ReportViewer 2010 and other code examples weren't working.
    Apparently, the m_isVisible field was not available in earlier version of ReportViewer
                        info = extension.GetType().GetField("m_isVisible", BindingFlags.Instance | BindingFlags.NonPublic);                    info.SetValue(extension, false);
    Code that wasn't working:
                FieldInfo info = extension.GetType().GetField("m_serverExtension",            BindingFlags.NonPublic | BindingFlags.Instance);            if (info != null)            {                object actualExtension = info.GetValue(extension);                if (actualExtension != null)                {                    PropertyInfo propInfo = actualExtension.GetType().GetProperty("Visible");                    if (propInfo != null && propInfo.CanWrite)                    {                        propInfo.SetValue(actualExtension, false, null);                    }                }            }
    Thanks again, chupaul :)

  • How to hide Print and Filter option from dynamic ALV

    Hi,
    I have created the dynamic ALV. now User don't wan't Filter , export,print Option on the ALV dispaly.
    Could you please tell me How to hide Print and Filter option from dynamic ALV.
    Thanks and regards
    Amita.

    Hi,
    Please go through the following link to get an better idea on ALV.
    [https://www.sdn.sap.com/irj/scn/index?rid=/library/uuid/1190424a-0801-0010-84b5-ef03fd2d33d9&overridelayout=true]
    This is the code  which you have to write in  WDDOINIT
    DATA LO_CMP_USAGE TYPE REF TO IF_WD_COMPONENT_USAGE.
    LO_CMP_USAGE =   WD_THIS->WD_CPUSE_ALV_TEST( ).
    IF LO_CMP_USAGE->HAS_ACTIVE_COMPONENT( ) IS INITIAL.
      LO_CMP_USAGE->CREATE_COMPONENT( ).
    ENDIF.
    DATA LO_INTERFACECONTROLLER TYPE REF TO IWCI_SALV_WD_TABLE .
          LO_INTERFACECONTROLLER =   WD_THIS->WD_CPIFC_ALV_TEST( ).
            DATA LO_VALUE TYPE REF TO CL_SALV_WD_CONFIG_TABLE.
            LO_VALUE = LO_INTERFACECONTROLLER->GET_MODEL(
    lo_value->IF_SALV_WD_STD_FUNCTIONS~SET_EXPORT_ALLOWED( abap_false ).
    lo_value->IF_SALV_WD_STD_FUNCTIONS~SET_PDF_ALLOWED( abap_false ).
    lo_value->IF_SALV_WD_STD_FUNCTIONS~SET_VIEW_LIST_ALLOWED( abap_false ).

  • How to restrict 'Broadcast and Export' option of BW report through web.

    Helllo,
    Please anyone let me know, how NOT to give/allow "Broadcast and Export' option in BW report, when accessed through Web.
    Is there is any Auhtorization object which restrictes this option.

    Hi,
    Please check this, it may help you.
    http://help.sap.com/saphelp_nw70/helpdata/en/80/1a68b4e07211d2acb80000e829fbfe/frameset.htm
    Regards,
    Madhu

  • How to hide PDF toolsbar

    I want the pdf always startup with defaulted hide the toolsbar(e.g hand tool, zoom tool, select tool...).
    Can any expert guide me?
    Below is my existing souce code.
    i using the "cl_gui_html_viewer" to call the pdf application
    cause i need to convert the OFT(smartform) to pdf and load the data using URL.
      DATA: l_url(2048) TYPE c.
      DATA: html_alignment TYPE I.
      DATA: BEGIN OF html_control,                              " PEOPLE CARD CONTAINER
             container    TYPE REF TO cl_gui_custom_container,
             control      TYPE REF TO cl_gui_html_viewer,
            END OF html_control.
      CONSTANTS : BEGIN OF c,
                   align_at_left           TYPE i VALUE 1,
                   align_at_right          TYPE i VALUE 2,
                   align_at_top            TYPE i VALUE 4,
                   align_at_bottom         TYPE i VALUE 8,
                 END OF c.
      IF html_control-container IS INITIAL.
        CREATE OBJECT html_control-container              " CREATE CONTAINER
            EXPORTING
                container_name = 'PDF_CONTAINER'
            EXCEPTIONS
                others = 0.
      ENDIF.
      IF html_control-control IS INITIAL.
        CREATE OBJECT html_control-control                 " ASSIGN CONTAINER TO CONTROLER
             EXPORTING
                  parent = html_control-container.
        IF sy-subrc = 0.
          html_alignment = c-align_at_left + c-align_at_right
                           + c-align_at_top + c-align_at_bottom.
          CALL METHOD html_control-control->set_alignment  " SET ALIGNMENT
            EXPORTING
              alignment = html_alignment.
        ENDIF.
      ENDIF.
      CALL METHOD html_control-control->load_data           " GET PDF URL
        EXPORTING
          type         = 'APPLICATOIN'
          subtype      = 'PDF'
        IMPORTING
          assigned_url = l_url
        CHANGING
          data_table   = t_lines_pdf
        EXCEPTIONS
          OTHERS       = 1.
      CALL METHOD html_control-control->show_data           " SHOW PDF
        EXPORTING
          url = l_url.
      IF SY-SUBRC = 0.
        MOVE 'X' TO w_flag-load_pdf.
      ENDIF.

    hi
    good
    go through these link,this ll give you brief idea about cl_gui_html_viewer,check them and do the changes in your program accordingly.
    http://www.sap-basis-abap.com/abap/example-of-sap-html-viewer-to-browse-the-internet.htm
    http://help.sap.com/saphelp_nw04/helpdata/en/c9/147a36c70d2354e10000009b38f839/frameset.htm
    thanks
    mrutyun^

  • How to create new SVG export option

    I need to create a new SVG option to work with exportFile(). The new option will allow me to place a tag on in my exported SVG file. I'm not finding hints in the delivered documentation on how to do this. Could someone with experience in such, please point me to a resource that will help me.
    Thanks in advance.
    Steve

    Hi..
    Its continuous to earlier query, creation of new search help in Personnel Administration, we created elementary search help from SE11, now need to integrate this back end customization to front end screen,
    How to do this.,
    Welcome to all sharing minds.
    Regards.
    Kanuku.

  • How to get pdfs to export or print from Safari?

    I'm having a very serious intermittent problem getting pdf's to print or export from Safari.  Occasionally when I try and open a pdf in the browser I get an error message that Adobe Reader needs to be opened (even if it already is open) and then I need to close out Safari and re-open the link to even see the pdf.  But after that, sometimes when I try to print or export the file, all I get are blank pages.  I've tried having them downloaded or printed as images but that doesn't work either.  It's very frustrating.
    I've tried trashing Adobe Reader and re-installing but to no avail. It's gotten to the point that I often just open Preview and do a screen grab of the pdf's and save them that way.  Not the best workaround.
    Any help would be very much appreciated.
    Macbook Pro
    OSX 10.9
    Safari Version 7.0 (9537.71)
    Adobe Reader  11.0.04

    Yes every time I open the app it makes me accept the EULA or else it won't work as a reader.  That's not the problem. The problem is not being able to print or download the pdf file from the browser after I accept the EULA. Any other suggestions?

  • How to Hide Page View Webpart Option E.g.: Refresh, Open in Visio, Close.

    Hello all- Is there any way to hide Refresh, Open in Visio, Close option from Page Viewer Webpart, using Java script or client side method.
    <script type="text/javascript" src="https://code.jquery.com/jquery-latest.min.js"></script>
    <script type="text/javascript">
    $(document).ready(function()
        $('#VwaToolbarButton').css('display','none');
        $('#VwaRefreshButton').css('display','none');
        $('#VwaButtonNormal').css('display','none');
       

    Hi Kamal,
    As I understand, you want to hide the Refresh, Open in Visio, Close option in the page viewer web part by JavaScript or client side method in SharePoint 2010.
    You could add the custom CSS code to hide the Refresh, Open in Visio, Close option in the page by content edit web part.
     You could use CSS 'visibility: hidden’ or 'display: none’ to hide the buttons.
    You could add the CSS code to content edit web part as below:
    <style type="text/css">
    //your custom css code.
    </style>
    The article below is about CSS syntax.
    http://www.w3schools.com/css/css_syntax.asp
    The article below is about three Ways to Insert CSS.
    http://www.w3schools.com/css/css_howto.asp
    Best regards,
    Sara Fan
    TechNet Community Support
    Please remember to mark the replies as answers if they help, and unmark the answers if they provide no help. If you have feedback for TechNet Support, contact
    [email protected]

  • How to Hide "Edit in Browser" option in View Mode of SharePoint2013 with WebApps2013

    Hhow to Hide >> "Edit in Browser" in Sharepoint2013 with WebApps2013 screen

    Try and use jQuery to find the respective element and hide it.
    Sairam Avacorp Technologies

  • How to hide columns in each page of SSRS report for grouped tablix

    Hello all,
    I have a requirement like when SSRS report (used row grouping)is exported to EXCEL
    1)  Each report page should be exported to a separate excel sheet
    2) Each sheet will have different columns (that is some columns will hide in sheet2, sheet3...)
    3) Eg: If a country report is there with details like country name, country code, currency code. Now each country details should export to separate excel sheet and sheet 1 should show Country Name and Country code; Sheet2 should show: Country Code, Currency
    Code; Sheet3 should show: Country Name, Country Code, Currency Code.
    I am done with point#1 above: Each report page should be exported to a separate excel sheet. Can some one help on point#2:Each sheet will have different columns (that is some columns will hide in sheet2, sheet3...)
    Thanks,
    Paandey : Dont forget to mark it as Answered if found useful

    Hi paandey,
    According to your description, there are three columns named country name, country code, currency code in the report. When export the report to excel, you want to show Country Name and Country code in sheet1, Country Code and Currency Code in sheet2, and
    show all of the three columns in sheet3.
    In Reporting Services, we couldn’t achieve your goal by setting visibility of columns in one tablix. As a workaround, we can use three tablix in the report, then add page break to the tablix. For detail information, please refer to the following steps:
     1. Since you have created a tablix with three column, copy and paste it to the report twice.
     2. Right-click column handle of Currency code in tablix1, click Column Visibility.
     3. Check Show or hide based on an expression, click (fx) button, then type the expression:
    =(Globals!RenderFormat.Name = “EXCELOPENXML”)
     4. Right-click column handle of Country name in tablix2, set its visibility like step3 above.
     5. Select and right-click tablix2, click Tablix Properties.
     6. In General pane, in Page Break Options section, check Add a page break before check box.
     7. Click Visibility in left pane, check Show or hide based on an expression, click (fx) button, then type the expression:
    =(Globals!RenderFormat.Name <> “EXCELOPENXML”)
     8. Select and right-click tablix3, add page break to it like step6 above.
     9. Set its visibility like step7 above.
    The following screenshot is for your reference:
    For more information, please refer to the following document:
    http://blogs.msdn.com/b/robertbruckner/archive/2010/05/16/report-design-naming-excel-worksheets.aspx
    If you have any more questions, please feel free to ask.
    Best Regards,
    Wendy Fu

  • How to hide particular data on rows in ssrs reports ?

    Hi,
    i have requirement, in my ssrs report i have columns like sites,Accounts,LOBs and etc.,
    i don't want to show some of the accounts in rows for some particular sites, please check the below image.here i don't want to show the ally finacial and fox tel accounts in the report, and even client  don't want to add accounts to the filters.
    please help me with this issue,how to not show those particular accounts for particular sites in the report.
    *here we are building reports on cube.
    Thanks in advance,
    Naveen 

    I think I would create an internal multivalue parameter with the default values set to the accounts you wish to exclude... call it ExcludeAccts. Then use this parameter to filter out these accounts in the dataset, not the report. I am not an MDX guy but
    in Transact-SQL the filter would be:
    WHERE Account NOT IN (@ExcludeAccts)
    This will return all accounts except for those explicitly excluded in your parameter. The reason I would use a parameter is maintenance. Once the appropriate equivalent statement is added to your MDX, you just need to update the parameter default values
    to change the exclusions rather than editing the MDX each time.
    "You will find a fortune, though it will not be the one you seek." -
    Blind Seer, O Brother Where Art Thou
    Please Mark posts as answers or helpful so that others may find the fortune they seek.

  • How to make multi value parameter optional in SSRS

    I HAVE REPORT IN SSRS 2005.
    I have @strjournal as multi value parameter. Allow blank is checked. Parameter values r assigned through query.
    select jornalno,jornalno as descr from tran_table 
    union select 'NULL','NULL' 
    So for @strjournal,  valuefield = jornalno  , label field = descr
    my main query i am giving,
    select .... from myTable where  (TRANKEY IN (@strjournal) AND @strjournal<> 'NULL' ) OR (TRANKEY LIKE '%' AND @strjournal = 'NULL')
    If i select 'NULL' its giving me correct result (returning all records as condition is like '%')
    if i select only 1 journalno (not 'NULL') also giving me correct result (i.e. only 1 record for which jornalno is selected)
    if i select more than 1 jornalnos then its giving me error "an expression of non boolean type specified in a context where condition is expected , near ',' "
    Any help ??
    h2007

    I have report in SSRS 2005 with multi value parameter.
    @strjournal is multi value parameter. Allow blank is checked. Values r assigned by below query
    select journalno,journalno as descr from tranTable
    union
    select 'NULL','BLANK'
    so for @strjournal, value field = journalno and label field = descr
    My main query is,
    select ---- from mainTable where
    (TRANKEY IN (@strjournal) AND @strjournal<> 'NULL' ) OR (TRANKEY LIKE '%' AND @strjournal = 'NULL')
    if i select 'NULL' gives me correct result (returns all rows as condition is like '%')
    if i select only 1 journalno (not 'NULL') also gives me correct result (returns only 1 record for which journalno is selected)
    if i select more than 1 journal nos gives me error, An expression of non-boolean type specified in a
    context where a condition is expected, near ',' 
    if i select more than 1 values (though i have selected it as multi-value) its giving me error.
    if i just give condition, 
    select ---- from mainTable where (TRANKEY IN (@strjournal)) 
    then i can select multiple
    h2007

  • View PDF after export - grayed out

    I JUST upgraded from CS3 to CS4 and now this box is grayed out in my PDF export options. So I now have to launch the PDF manually instead of it being automatically launched after being created. Am I doing something wrong, or is this option no longer available?

    Well, I guess it was Halloween and some ghosts got into my update because now I am able to choose the "View PDF after Export" option. It was not available when I tried to edit the PDF preset but it's available once I actually use the preset to generate a PDF. Go figure.

  • How to Hide " AUTO Reversal" button on Journal Template

    Hi All
    Can any one please let me know how to hide or not shown option to AUTO REVERSED button  on Jounral template?
    appreiated your help
    Thanks

    Hello,
    I have figured out that this has been requested as an enhancement to the productu2026
    Unfortunately, there is no forecast to know if it will be accept and, if accepted, when it would be implementedu2026
    I know that it has not been what you've been waiting to hear...
    Best regards,
    Vin

Maybe you are looking for

  • Remote Panel and DataSocket

    In LabVIEW6.1,there is "Remote Panel"feature.And in http://digital.ni.com/demo.nsf/websearch/3DF73584759FF60986256ABD005BB446?OpenDocument&node=1381_US, there is a demonstration named "Weather Station".In LAN,I can control the VI from another host.Bu

  • Cannot install OSX Mavericks on macbook air disk

    I am unable to intall Mavericks due to an unknown error. I have tried restarting, using disk utility to perform a repair, but no change. I cannot find any information on why this error is occuring or how to solve it. The macbook air is the latest ver

  • How to recover photos that were deleted while restoring back up on my IPhone

    Well, today I decider to see if I could recover stuff from my old iPhone 4, so I connected my phone to iTunes and clicked "Restore Backup". Little did I know that it would delete all my photos, which I didn't know it was going to do that:( So, i lost

  • .nib files showing up as folders

    I have all the developer tools installed but all my .nib files show up as folders in finder. It's a pain in the a$$ to keep having to drag these things to the dock to get them to open. How do I get them to show up as interface builder files? --Much T

  • SAP JCO 3 - Not recognizing ABAP_DEBUG and USE_SAPGUI

    We are in the process of converting a Java application to use JCO 3.0 in order for it to work on the Intel based Macs.  The code conversion has gone well so far and I have successfully been able to connect to a SAP system using the new connection met