Page 1 of 1

Turn Stuff Off

Posted: Sun Oct 05, 2008 9:54 pm
by xfratboy
I've been playing with this demo version for a while now.. taking things slow. Any ways, I can't figure out how to turn off the the save, open, new page, and edit page buttons on the preview window, as well as, certain export features. I really just want a bare bones print preview and maybe export to pdf, jpg & tiff. I'm hopeful there's an easy way to do this using VB. Here's my current code. When I click on the print button in my Winforms app, a very simple report is generated.

Private Sub PrintToolStripButton_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles PrintToolStripButton.Click
Me.Cursor = Cursors.WaitCursor
Dim report As New Stimulsoft.Report.StiReport
Dim drv As DataRowView = DirectCast(Me.MyBindingSource.Current, DataRowView)
Dim clientName As String = drv("ClientName")
Dim drv2 As DataRowView = DirectCast(Me.BindingSource2.Current, DataRowView)
Dim _locationName As String = drv2("LocationName")
report.Load("MyReport.mrt")
report.Compile()
report("ClientName") = clientName
report("LocationName") = _locationName
report.Show()
Me.Cursor = Cursors.Default
End Sub

Turn Stuff Off

Posted: Mon Oct 06, 2008 7:16 am
by Edward
Hello.

Please use the following code:

Code: Select all

'Do this operation once when running the program
StiConfig.Load()

'Get service
Dim Config As StiViewerConfigService = TryCast(StiConfig.Services.GetService(GetType(StiViewerConfigService)), StiViewerConfigService)

'Turn off all unnecessary buttons

Config.PageNewEnabled = False
Config.PageDeleteEnabled = False
Config.PageDesignEnabled = False
Config.PageSizeEnabled = False


'Save configuration if necessary
StiConfig.Save()
And here is the code for disabling of the export services as well:

Code: Select all

StiConfig.Load()
Dim Services As StiServiceContainer = StiConfig.Services.GetServices(GetType(StiExportService))
For Each Service As StiService In Services
    If TypeOf Service Is StiBmpExportService Then Service.ServiceEnabled = False
    If TypeOf Service Is StiCsvExportService Then Service.ServiceEnabled = False
    If TypeOf Service Is StiEmfExportService Then Service.ServiceEnabled = False
    If TypeOf Service Is StiGifExportService Then Service.ServiceEnabled = False
    If TypeOf Service Is StiJpegExportService Then Service.ServiceEnabled = False
    If TypeOf Service Is StiPdfExportService Then Service.ServiceEnabled = False
    If TypeOf Service Is StiRtfExportService Then Service.ServiceEnabled = False
    If TypeOf Service Is StiTiffExportService Then Service.ServiceEnabled = False
    If TypeOf Service Is StiTxtExportService Then Service.ServiceEnabled = False
    If TypeOf Service Is StiXmlExportService Then Service.ServiceEnabled = False
Next Service
StiConfig.Save()
Thank you.

Turn Stuff Off

Posted: Mon Oct 06, 2008 10:19 pm
by xfratboy
I get this error on my form:

Type 'StiViewerConfigService' is not defined.

I'm thinking I'm missing an Imports statement or something?


Turn Stuff Off

Posted: Tue Oct 07, 2008 12:53 am
by Vital
Hello,

Please use StiPreviewConfigService instead StiViewerConfigService if you are use 2008.1 or previous. If you use 2008.2 add reference to Stimulsoft.Report.Win.dll assembly.

Thank you.