locked
C# to change tablix location value on SSRS 2008 r2 report RRS feed

  • Question

  • User-1997257017 posted

    I am modifying an SSRS 2008 r2 report so users can export the data to excel and sort and filter the data. The only way to accomplsh this task is to remove the report headers. The users will click on a button that says hide 'headers' and click the view button. Then the users will export to excel.

    Problem:When the SSRS 2008 R2 report is exported to excel, row one in excel is blank. The column headers and data start on line #2 in excel. I want to remove line #1 from being blank in excel.

    To solve this problem, for the tablix that I want to keep, I want to set the location value to 0,0. I do not want to come up with a new report that looks like the original report but the data is shifted. I would prefer to write C# code to solve this problem since I can not find a way to set the SSRS tablix.location property in SSRS.

    Thus can you show and/or tell me the following:

    1. What C# code can be setup to accomplish my goal? 2. How would you attach the C# code to the SSRS  2008 r2 report for the code to work?

    Thursday, November 14, 2013 4:26 PM

Answers

  • User1070236303 posted

    1. What C# code can be setup to accomplish my goal? 2. How would you attach the C# code to the SSRS  2008 r2 report for the code to work?

    1. You can use the open xml sdk to generate native excel files, so you don't need to use report at all.

    2. You cannot interact too much with the report content using c# (you can set only datasources, parameters, start the rendering, listening some rendering event, that's all). You can write inside program in the report using vb syntax, but it is very limited.

    Some option: make a report variant without header,

    or pass a parameter to the report, and programatically hide the header with vb code,

    or don't use the rdl designer at all, instead generate rdl report's xml source directly (very hard, but you can get amazing result.).

    Anyway the exported excel file will be always a complete mess except for a very simple reports.

    • Marked as answer by Anonymous Thursday, October 7, 2021 12:00 AM
    Saturday, November 16, 2013 2:00 PM