Question

The company I work for uses the Active Reports from DataDynamics to generate their reports and they asked me if I could do a web viewer of the reports where you could move the fields around.

So the way I figured I could do this was to load the empty reports (with only the fields like they appear in the designer in VS2012) in divs and use Jquery for the moves than create the report dynamically.

The thing is, I cannot find a way to access the controls of the report. I've been googling hwo to do this for a whole day but I cannot seem to find a solution.

We are using Active Reports 6, VS2012 and vb.net.

Was it helpful?

Solution

Each Section in the report has a Controls collection that reveals the collection of controls in that section. The topic on the Sections collection has a good example of how to programatically add controls to the collection. An excerpt with some comments to help explain is below:

    ' Insert Group Header and Footer Sections:'
  Me.Sections.InsertGroupHF()
  ' Set some proprties to configure those sections:
  CType(Me.Sections("GroupHeader1"), GroupHeader).DataField = "CategoryID"
  Me.Sections("GroupHeader1").BackColor = System.Drawing.Color.SlateBlue
  Me.Sections("GroupHeader1").CanGrow = True
  Me.Sections("GroupHeader1").CanShrink = True
  CType(Me.Sections("GroupHeader1"), GroupHeader).RepeatStyle = RepeatStyle.OnPageIncludeNoDetail
  Me.Sections("GroupHeader1").Height = 0

  ' Create a TexBox control & Set some properties to configure that control
  Dim txt As New TextBox()
  txt.DataField = "CatagoryID"
  txt.Location = New System.Drawing.PointF(0.0F, 0)
  txt.Width = 2.0F
  txt.Height = 0.3F
  txt.Style = "font-weight: bold; font-size: 16pt"

  ' Add the TextBox to the GroupHeader section:
  Me.Sections("GroupHeader1").Controls.Add(txt)

The ActiveReports 6 documentation has a walkthrough named Run Time Layouts that builds an entire application that builds a report layout in code. That's a good way to learn exactly how to manipulate a report via code.

OTHER TIPS

@activescott & @Michael, the documentation links changed, but they are still available. For the ActiveReports 6 Documentation go here, and the walkthrough for Run Time Layouts is here.

Licensed under: CC-BY-SA with attribution
Not affiliated with StackOverflow
scroll top