How to apply black and white on export or print only and showing it throw report viewer with colors?
Because the report after will be cached after preview, i try to apply black and white ExportReportResponse,PrintReport but it dosen't work.
Code: Select all
Private Sub RV_ExportReportResponse(sender As Object, e As StiExportReportResponseEventArgs) Handles RV.ExportReportResponse
If AdvancedOptions.IsPrintOptionSelected Then
MakeBlackAndWhite(e.Report)
End If
End Sub
Private Sub RV_PrintReport(sender As Object, e As StiPrintReportEventArgs) Handles RV.PrintReport
If AdvancedOptions.IsPrintOptionSelected Then
MakeBlackAndWhite(e.Report)
End If
End Sub
Public Shared Sub MakeBlackAndWhite(ByVal report As StiReport)
For Each page As StiPage In report.Pages
Dim comps As StiComponentsCollection = page.GetComponents()
For Each comp As StiComponent In comps
Select Case comp.GetType.Name
Case "StiText"
Dim TextComp As StiText
TextComp = report.GetComponentByName(comp.Name)
TextComp.Brush = New StiSolidBrush(Color.Transparent)
TextComp.TextBrush = New StiSolidBrush(Color.Black)
TextComp.Border.Color = Color.Black
TextComp.ComponentStyle = ""
End Select
Next
Next
End Sub