SSRS page numbers in page footer

后端 未结 2 1986
有刺的猬
有刺的猬 2021-01-26 12:41

I wish to not include the page number (in the page footer) for the first 10 pages of the report (i.e. page 1-10). Page 1 should read i, page 2 should read ii and page 3 should r

相关标签:
2条回答
  • 2021-01-26 13:07

    You'll have to manually change the value i.e. putting something similar to the following in the footer:

    IIf(Globals!PageNumber=1, "i", ...
    

    Alternativally you could use a user function try VBA for number to roman numeral

    0 讨论(0)
  • 2021-01-26 13:07

    We'll do ths with some custom code to keep flexibility. Microsoft have some code to do the Roman numeral conversion so we'll adapt this.

    Let's add the custom code we need: one function to convert an integer to a Roman numeral and one function to work out what sort of numeral to provide.

    Function PageNumber(page As Integer, startArabic As Integer) As String
      If page <= startArabic Then
        PageNumber = IntegerToRoman(page)
      Else
        PageNumber = (page - startArabic).ToString()
      End If
    End Function
    
    Function IntegerToRoman (ByVal N As Integer) As String
      Const Digits = "ivxlcdm" 
      Dim I As Integer
      Dim Digit As Integer
      Dim Temp As String 
    
      I = 1 
      Temp = "" 
    
      Do While N > 0 
        Digit = N Mod 10 
        N = N \ 10 
        Select Case Digit 
          Case 1 
            Temp = Mid(Digits, I, 1) & Temp 
          Case 2 
            Temp = Mid(Digits, I, 1) & Mid(Digits, I, 1) & Temp 
          Case 3 
            Temp = Mid(Digits, I, 1) & Mid(Digits, I, 1) & Mid(Digits, I, 1) & Temp 
          Case 4 
            Temp = Mid(Digits, I, 2) & Temp 
          Case 5 
            Temp = Mid(Digits, I + 1, 1) & Temp 
          Case 6 
            Temp = Mid(Digits, I + 1, 1) & Mid(Digits, I, 1) & Temp 
          Case 7 
            Temp = Mid(Digits, I + 1, 1) & Mid(Digits, I, 1) & Mid(Digits, I, 1) & Temp 
          Case 8 
            Temp = Mid(Digits, I + 1, 1) & Mid(Digits, I, 1) & Mid(Digits, I, 1) & Mid(Digits, I, 1) & Temp 
          Case 9 
            Temp = Mid(Digits, I, 1) & Mid(Digits, I + 2, 1) & Temp 
        End Select 
    
        I = I + 2 
      Loop 
    
      IntegerToRoman = Temp 
    
    End Function 
    

    To make the report more flexible, we'll add a parameter for when to revert to Arabic numerals (in case we need more than ten Roman numerals at some stage when the report gets longer). Let's call that @StartArabic and it will be an integer with the default value of 10. So now our page number expression is simply:

    ="Page " & Code.PageNumber(Globals!PageNumber, Parameters!StartArabic.Value)
    
    0 讨论(0)
提交回复
热议问题