New property Path in report that allow to define the output file

When used with preview, the returned value is the new path used.

[GB.REPORT2]
* NEW: New property Path in report that allow to define the output file
This commit is contained in:
gambix 2020-12-04 15:11:05 +01:00
parent f77f4b8188
commit 3937ea5fb8
4 changed files with 31 additions and 3 deletions

View file

@ -1,6 +1,6 @@
# Gambas Project File 3.0 # Gambas Project File 3.0
Title=ReportsEvolution Title=ReportsEvolution
Startup=Report13 Startup=Module2
Icon=.hidden/control/reportview.png Icon=.hidden/control/reportview.png
Version=3.15.90 Version=3.15.90
VersionFile=1 VersionFile=1

View file

@ -82,6 +82,8 @@ Property Orientation As Integer
Property Read _Width As Float Property Read _Width As Float
Property Read _Height As Float Property Read _Height As Float
Property Path As String Use $sPath
Event Open Event Open
Static Public Sub Main() Static Public Sub Main()
@ -322,9 +324,9 @@ End
' '
Public Function Preview() Public Function Preview()
If Me.Path Then FPreview.Path = Me.Path
FPreview.Run(Me) FPreview.Run(Me)
If FPreview.Path Then Me.Path = FPreview.Path
End End

View file

@ -0,0 +1,13 @@
' Gambas module file
Public Sub main()
Dim hreport As New Report13
hreport.Path = User.Home &/ "Test.pdf"
hreport.Preview
Print hreport.Path
End

View file

@ -7,6 +7,8 @@ Private $hPrinter As New Printer As "Printer"
Private $bVerif As Boolean Private $bVerif As Boolean
Private $bPrinting As Boolean Private $bPrinting As Boolean
Private $iFileRes As Integer = 150 Private $iFileRes As Integer = 150
Static Property Path As String Use $sPath
Static Public Function Run(hReport As Report) Static Public Function Run(hReport As Report)
@ -88,6 +90,7 @@ Private Sub GetValuesFromReport()
spHeight.Value = $hPrinter.PaperHeight spHeight.Value = $hPrinter.PaperHeight
Object.Unlock(spHeight) Object.Unlock(spHeight)
End End
Public Sub sldZoom_Change() Public Sub sldZoom_Change()
@ -404,6 +407,9 @@ Public Sub Form_Close()
Settings.Save() Settings.Save()
Endif Endif
FPreview.Path = IIf(tabPrint.Index = 1, txtFile.Text, "")
End End
Public Sub Form_Open() Public Sub Form_Open()
@ -447,6 +453,13 @@ Public Sub Form_Open()
btnOnePage.Value = True btnOnePage.Value = True
tabPrint_Click tabPrint_Click
If FPreview.Path And If Not IsDir(FPreview.Path) Then
tabPrint.Index = 1
txtFile.Text = FPreview.Path
Endif
End End
Public Sub btnZoomIn_Click() Public Sub btnZoomIn_Click()