Skip to end of metadata
Go to start of metadata

You are viewing an old version of this page. View the current version.

Compare with Current View Page History

« Previous Version 6 Current »

A Dynamic Link Library (DLL) named CrowsNest.Reporting.dll is provided which has some functions used to extend the reporting functionality in MS Report Builder.

The library is included in the installation directory where Crows Nest is installed (typically C:\Program Files (x86)\Crows Nest).

To preview reports that use the library from within Report Builder, you’ll need to copy the DLL file into the installation directory for Report Builder (typically C:\Program Files (x86)\Microsoft Report Builder)

To utilize the functions, open a report in Report Builder and follow the steps below:

Add a Reference to the library

  1. Open Report Properties

  2. Select References

  3. Under ‘Add or remove assemblies’ click Add

  4. On the newly added reference record click the button to browse to the CrowsNest.Reporting.dll file and click Open

  5. Click OK to close Report Properties

Add Code to the report

  1. Open Report Properties

  2. Select Code

  3. Add a Function using VB .NET syntax to call the function from the library
    Example:
    Function PadLeft(imgBytes, cellWidth, cellHeight, centered)
    Return CrowsNest.Reporting.Images.PadLeft(imgBytes, cellWidth, cellHeight, "in", centered)
    End Function

  4. Click OK to close Report Properties

Add Expression to call the Code

  1. Edit any Expression and Reference the Code
    Example:
    =Code.PadLeft(Fields!Logo.Value, 2.5, 1, True)

Available Functions

Combine the header below with the function name to reference the function in Code
Example: CrowsNest.Reporting.Strings.HTML_BulletedList

Strings

  • HTML_BulletedList - Process text into a bulleted list using HTML syntax. To have the HTML rendered in the report, open Placeholder Properties for the Placeholder using this code and change Markup type to ‘HTML’. If the Header parameter is supplied it will look for a header in the text provided in the Value parameter for a header surrounded by double square brackets and will return only the text between that header and the next header found or the end of the text if a subsequent header is not found.
    HTML_BulletedList(Value as String, Delimiter as String, Optional Header as String) as String
    Example:

    • Text in Value Parameter

      [[Exclusions]]
      Applicable sales taxes
      All Electrical, Plumbing, HVAC
      [[Notes]]
      This Proposal becomes part of a contract document
      This proposal is valid for 30 days.
    • Function reference in Code

      CrowsNest.Reporting.String.HTML_BulletedList(Fields!LongDescription.Value, Environment.NewLine, “Exclusions”)
    • Result

      <ul>
      <li>Applicable sales taxes</li>
      <li>All Electrical, Plumbing, HVAC</li>
      </ul>

Images

  • PadLeft - Calculate a Left Padding value to horizontally align a database image to center or right. To align right change CenterImage parameter to False.

    PadLeft(imgBytes As Byte(), cellWidth As Double, cellHeight As Double, Optional UnitOfMeasure As String = "in", Optional CenterImage As Boolean = True) As String
  • PadTop - Calculate a Top Padding value to vertically align a database image to center or bottom. To align bottom change CenterImage parameter to False.

    PadTop(imgBytes As Byte(), cellWidth As Double, cellHeight As Double, Optional UnitOfMeasure As String = "in", Optional CenterImage As Boolean = True) As String
  • QRCode - Generate a QRCode image as a byte array to display in an Image object.

    QRCode(content As String, size As Integer, Optional logofilepath As String = "", Optional IsURL As Boolean = False, Optional darkcolor As String = "", Optional lightcolor As String = "") As Byte()

    The following overload accepts a logo image in a byte array instead of a logo filepath

    QRCode(content As String, size As Integer, logobytes As Byte(), Optional IsURL As Boolean = False, Optional darkcolor As String = "", Optional lightcolor As String = "") As Byte()

    See the following explanation for each of the arguments

    • content = Text content of the QRCode

    • size = Pixels per module. Large values here can cause out-of-memory errors from the report viewer.

    • logofilepath = Filepath to a logo to embed in the center of the QR Code (example: C:\\myimage.png)

    • logobytes = Byte array of logo to embed in the center of the QR Code. This can be an image field from a dataset (example: Fields!Logo.Value)

    • IsURL = True if the content is a web URL to format the QR Code as a URL Payload

    • darkcolor = Dark color in the QR Code (examples: “black”, “255,255,255”)

    • lightcolor = Light color in the QR Code (examples: “white”, “0,0,0”)

    • Example

      • Expression (Value property on an Image with Source set to Database)

        =Code.QRCode("www.crowsnestsoftware.com", 20, "", True, "Red", "White")
      • Code

        Function QRCode(content as String, size as Integer, logobytes as Byte(), Optional IsUrl as Boolean = False, Optional darkcolor as String = "", Optional lightcolor as String = "")
          Return CrowsNest.Reporting.Images.QRCode(content, size, logobytes, IsURL, darkcolor, lightcolor)
        End Function

Timeline

  • TimelineHeaderImage - Returns an image for the header cell including year/month/day to mimic the header of the timeline view in Tasks.

    TimelineHeaderImage(ByVal width As Integer, ByVal height As Integer, ByVal objMinDate As Object, ByVal objMaxDate As Object, ByVal RowColor As String, ByVal DaySeparatorColor As String, ByVal MonthSeparatorColor As String, ByVal FontName As String, ByVal FontSize As String, ByVal FontColor As String, ByVal WeekendFontColor As String) As Byte()
    • Example

      • Expression

        =Code.TimelineHeaderImage(Variables!CellWidthPixels.Value, Variables!HeaderHeightPixels.Value, First(Fields!PeriodStart.Value, "Tasks"), First(Fields!PeriodEnd.Value, "Tasks"))
      • Code

        Function TimelineHeaderImage(width, height, minDate, maxDate) As Byte()      
        
            Dim rowColor as string = ""
            Dim daySeparatorColor as string = ""
            Dim monthSeparatorColor as string = "SkyBlue"
            Dim fontSize as string ="10"
            Dim fontName as string = "Arial"
            DIm fontColor as string = ""
            Dim fontColorWeekend as string = "SkyBlue"
        
            Dim t as new CrowsNest.Reporting.Timeline
            Return t.TimelineHeaderImage(width, height, minDate, maxDate, rowColor, daySeparatorColor, monthSeparatorColor, fontName, fontSize, fontColor, fontColorWeekend)
        
        End Function
        
  • TimelineRowImage - Returns an image for the data row cell to mimic the the data rows of the timeline view in Tasks. Available values for the MarkerType parameter are Diamond, Triangle, Circle and Square (not case sensitive).

    TimelineRowImage(ByVal width As Integer, ByVal height As Integer, ByVal objMinDate As Object, ByVal objMaxDate As Object, ByVal startDate As Object, ByVal endDate As Object, ByVal RowColor As String, ByVal DaySeparatorColor As String, ByVal MonthSeparatorColor As String, ByVal FillColor As String, ByVal BorderColor As String, ByVal HatchColor As String, HatchPattern As Object, strLabel As String, ByVal FontName As String, ByVal FontSize As String, ByVal FontColor As String, Optional MarkerType As String = "", Optional MarkerSize As Integer = 0) As Byte()

    • Example

      • Expression

        =Code.TimelineRowImage(Variables!CellWidthPixels.Value, Variables!CellHeightPixels.Value, First(Fields!PeriodStart.Value, "Tasks"), First(Fields!PeriodEnd.Value, "Tasks"), Fields!StartDate.Value, Fields!DueDate.Value, Fields!FillColor.Value, Fields!BorderColor.Value, Fields!PatternColor.Value, Fields!FillPattern.Value, Fields!Label.Value)
      • Code

        Function TimelineRowImage(width, height, minDate, maxDate, startDate, endDate, FillColor, BorderColor, HatchColor, HatchPattern, strLabel) As Byte()      
        
            Dim rowColor as string = ""
            Dim daySeparatorColor as string = "Transparent"
            Dim monthSeparatorColor as string = "SkyBlue"
            Dim fontSize as string ="10"
            Dim fontName as string = "Arial"
            DIm fontColor as string = ""
            Dim fontColorWeekend as string = ""
            Dim markerType as String = "" 'Diamond, Square, Circle, Triangle
            Dim markerSize as Integer = 16
        
            Dim t as new CrowsNest.Reporting.Timeline
            Return t.TimelineRowImage(width, height, minDate, maxDate, startDate, endDate, rowColor, daySeparatorColor, monthSeparatorColor, FillColor, BorderColor, HatchColor, HatchPattern, strLabel, fontName, fontSize, fontColor, markerType, markerSize)
        
        End Function

  • No labels