-
Jun 20th, 2017, 09:36 AM
#1
Save Grid contents (or a list) to JPG
Does anyone have any links to examples of saving/printing a long list (say 2 pages) to a JPG file (or PDF) ?
It will be a list of say 4 columns that would fit the width of a normal page.
However the length (number of rows) will exceed a single page.
I would like the file to be one long continuous JPG (or PDF).
I use the SGid2, but I would be desperate enough to use the flexgrid, or anything.
Thanks,
Rob
-
Jun 20th, 2017, 09:54 AM
#2
Re: Save Grid contents (or a list) to JPG
You should iterate by rows and cols using the Print method.
Using a MSFlexGrid control you can use the Picture property to print the whole grid.
-
Jun 20th, 2017, 09:55 AM
#3
Re: Save Grid contents (or a list) to JPG
The new vbFlexGrid by Krool supports placing the complete content of the grid in a bitmap.
I don't have any experience with the SGrid2
http://www.vbforums.com/showthread.p...xGrid-control)
-
Jun 20th, 2017, 10:26 AM
#4
Re: Save Grid contents (or a list) to JPG
I generally use my report tool for this. Active reports has a PDF export feature that can create a PDF document from a report with just one line of code.
-
Jun 20th, 2017, 12:22 PM
#5
Re: Save Grid contents (or a list) to JPG
Hello Bobbles
why not the Datareport ?
here a Sample, sorry it is in German but will give you an Idea
Code:
Private Sub cmdPrint_Click()
Dim adoRS As ADODB.Recordset
Dim strSQL As String
Dim strWhere As String
Dim strOrderBy As String
If MSFlexGrid1.Row = 0 Then
cmdPrint.Enabled = False
Exit Sub
End If
strSQL = "SELECT tbl_Jahr.Ja_JahrNr, "
strSQL = strSQL & "tbl_Betreiber.BE_Name , "
strSQL = strSQL & "tbl_Betreiber.BE_Strasse , "
strSQL = strSQL & "tbl_Betreiber.BE_PLZ ,"
strSQL = strSQL & "tbl_Betreiber.BE_Ort , "
strSQL = strSQL & "tbl_KontrolleTrinkwasser.TR_Firma , "
strSQL = strSQL & "tbl_WartungBeet.PF_Firma , "
strSQL = strSQL & "Kategorien.Kategoriename, "
strSQL = strSQL & "tbl_Jahr.Ja_JahrNr , "
strSQL = strSQL & "tbl_Eigenkontrolle.E_Datum, "
strSQL = strSQL & "tbl_Eigenkontrolle.E_KW , "
strSQL = strSQL & "tbl_Eigenkontrolle.E_KammerText, "
strSQL = strSQL & "tbl_Eigenkontrolle.E_BeschickungText , "
strSQL = strSQL & "tbl_Eigenkontrolle.E_WasserpfText ,"
strSQL = strSQL & "tbl_Eigenkontrolle.E_LueckenpfText , "
strSQL = strSQL & "tbl_Eigenkontrolle.E_UnkrautText , "
strSQL = strSQL & "tbl_Eigenkontrolle.E_WasserklarText , "
strSQL = strSQL & "tbl_Eigenkontrolle.E_Bemerkung "
strSQL = strSQL & "FROM tbl_WartungBeet INNER JOIN (tbl_KontrolleTrinkwasser INNER JOIN "
strSQL = strSQL & "((tbl_Betreiber INNER JOIN tbl_Jahr ON tbl_Betreiber.BE_ID = tbl_Jahr.Be_ID) "
strSQL = strSQL & "INNER JOIN (tbl_Eigenkontrolle INNER JOIN Kategorien ON "
strSQL = strSQL & "tbl_Eigenkontrolle.KategorieNr = Kategorien.KategorieNr) ON "
strSQL = strSQL & "tbl_Jahr.Ja_ID = tbl_Eigenkontrolle.Ja_ID) ON "
strSQL = strSQL & "tbl_KontrolleTrinkwasser.TR_ID = tbl_Jahr.TR_Kontrolle) ON "
strSQL = strSQL & "tbl_WartungBeet.PF_ID = tbl_Jahr.PF_Kontrolle "
strWhere = strWhere & "tbl_Jahr.Ja_JahrNr= '" & txtFirma & "'"
strOrderBy = strOrderBy & "tbl_Eigenkontrolle.E_Datum "
strSQL = strSQL & " WHERE " & strWhere & " Order BY " & strOrderBy
Set adoRS = cnBeet.Execute(strSQL)
With DataReport1
.DataMember = vbNullString 'vbNullString = dynamisch! / without DataEnvironment
.Orientation = rptOrientLandscape 'muss gesetzt sein Hoch oder Querformat!
Set .DataSource = adoRS
.Caption = "Protokoll Jahr (Betriebstagebuch)"
' .Title = adoRS.Fields(1).Value & " für das Jahr : " & adoRS.Fields(0)
'Header:
With .Sections("Bereich4").Controls
.Item("BezJahr").Caption = adoRS.Fields(0).Value
.Item("BezBetreiber").Caption = adoRS.Fields(1).Value
.Item("BezStrasse").Caption = adoRS.Fields(2).Value
.Item("BezPlz").Caption = adoRS.Fields(3).Value
.Item("BezOrt").Caption = adoRS.Fields(4).Value
.Item("BezTrinkwasser").Caption = adoRS.Fields(5).Value
.Item("BezBeet").Caption = adoRS.Fields(6).Value
End With
'Detail:
With .Sections("Bereich1").Controls
.Item("txtDatum").DataField = adoRS.Fields(9).Name
.Item("txtKW").DataField = adoRS.Fields(10).Name
.Item("txtKat").DataField = adoRS.Fields(7).Name
.Item("txtKammer").DataField = adoRS.Fields(11).Name
.Item("txtBeschickung").DataField = adoRS.Fields(12).Name
.Item("txtWasserpf").DataField = adoRS.Fields(13).Name
.Item("txtLuecken").DataField = adoRS.Fields(14).Name
.Item("txtUnkraut").DataField = adoRS.Fields(15).Name
.Item("txtWasserklar").DataField = adoRS.Fields(16).Name
.Item("txtBemerkung").DataField = adoRS.Fields(17).Name
End With
.Show ' show Report
'or:
'Pdf-Creator als Standdarddrucker einstellen, dann mit .PrintReport direkt ausdrucken!
'.PrintReport
End With
End Sub
regards
Chris
-
Jun 20th, 2017, 01:23 PM
#6
Re: Save Grid contents (or a list) to JPG
Since we've had a PDF printer driver for a while now a DataReport should do the job. Even if you are stuck on some downlevel version of Windows there are 3rd party PDF printer drivers out there you can use.
The results should be far superior to rendering captured images of a grid. Much more compact and easier to use.
-
Jun 21st, 2017, 01:34 AM
#7
Re: Save Grid contents (or a list) to JPG
Hi
forgot this for your Information..
this line in Code...
Code:
' .Title = adoRS.Fields(1).Value & " für das Jahr : " & adoRS.Fields(0)
can be used for working with Pdf Creator
I will be saved under that name. If you check the settings in Pdf Creator you can also
choose the Path where you want to save it. There are various settings.
just use the adoRS.Fields (1) & adoRS.Fields(whatever) to build the name of the Document.
regards
Chris
Last edited by ChrisE; Jun 21st, 2017 at 02:37 AM.
Posting Permissions
- You may not post new threads
- You may not post replies
- You may not post attachments
- You may not edit your posts
-
Forum Rules
|
Click Here to Expand Forum to Full Width
|