Hello,
I'm writing because I'm having trouble with the implementation of the FormatSection event (vb2013).
I used to handle such events in my old VB6 projects, but I cannot reproduce this on vb.net.
My goal is to change some formatting settings at runtime, depending on some conditions.
I created the following code within a vb.net project:
----------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------
Imports CrystalDecisions.Shared
Imports CrystalDecisions.CrystalReports.Engine
Public Class Form2
Private WithEvents report As New ReportDocument
Private Sub report_BeforeFormatPage(e As FormatPageEventArgs) Handles report.BeforeFormatPage
Console.WriteLine("BeforeFormatPage!")
End Sub
Private Sub report_FormatSection(e As FormatSectionEventArgs) Handles report.FormatSection
Console.WriteLine("FormatSection")
End Sub
Private Sub InitReport(sender As Object, e As System.EventArgs) Handles report.InitReport
Console.WriteLine("InitReport")
End Sub
Private Sub Button1_Click(sender As Object, e As EventArgs) Handles Button1.Click
report.Load("d:\rpt1.rpt", OpenReportMethod.OpenReportByDefault)
Dim tbl As New DataTable("tbl1")
tbl.Columns.Add("c1")
For i As Integer = 1 To 10
tbl.Rows.Add(i)
Next
report.SetDataSource(tbl)
report.ExportToDisk(ExportFormatType.PortableDocFormat, "d:\out.pdf")
End Sub
End Class
----------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------
Unfortunately, only the "InitReport" is fired, even though the report is correctly exported.
I tried to search on Internet but no one seems to use the FormatSection Event.
Thank You,
Roberto Reale