Reporting Services export to Excel with Multiple Worksheets

后端 未结 8 1849
无人共我
无人共我 2020-11-27 02:56

I\'m currently building a MS Reporting Services Report that gets rendered to excel. I\'m trying to figure out how to set up the report so that it creates multiple Worksheets

相关标签:
8条回答
  • 2020-11-27 03:22

    Put the tab name on the page header or group TableRow1 in your report so that it will appear in the "A1" position on each Excel sheet. Then run this macro in your Excel workbook.

    Sub SelectSheet()
            For i = 1 To ThisWorkbook.Sheets.Count
            mysheet = "Sheet" & i
            On Error GoTo 10
            Sheets(mysheet).Select
            Set Target = Range("A1")
            If Target = "" Then Exit Sub
            On Error GoTo Badname
            ActiveSheet.Name = Left(Target, 31)
            GoTo 10
    Badname:
            MsgBox "Please revise the entry in A1." & Chr(13) _
            & "It appears to contain one or more " & Chr(13) _
            & "illegal characters." & Chr(13)
            Range("A1").Activate
    10
            Next i
    End Sub
    
    0 讨论(0)
  • 2020-11-27 03:24

    To late for the original asker of the question, but with SQL Server 2008 R2 this is now possible:

    Set the property "Pagebreak" on the tablix or table or other element to force a new tab, and then set the property "Pagename" on both the element before the pagebreak and the element after the pagebreak. These names will appear on the tabs when the report is exported to Excel.

    Read about it here: http://technet.microsoft.com/en-us/library/dd255278.aspx

    0 讨论(0)
提交回复
热议问题