-
FlexPro
- Zoom sur FlexPro
- Fonctionnalités & Options
- Domaines d’application
- Tous les avantages
- Nouveau dans FlexPro 2021
- Testez FlexPro gratuitement
- FlexPro View OEM Freeware
- Conseils d’achat
- Login
- Langue
- +49 6894 929600
- infoweisang.com
- Google Maps
- Produits
- News
- Support
- Société
- Emplois
- Contact
- Login
- Langue
- +49 6894 929600
- infoweisang.com
- Google Maps
PrintOut als xps oder pdf
Accueil > Community > Automation and VBA > PrintOut als xps oder pdf
- This topic has 5 replies, 4 voices, and was last updated 13 years, 10 months ago by Ulf Lichte.
-
AuthorPosts
-
January 19, 2011 at 7:38 pm #12354Ulf LichteMember
Für eine automatisierte Auswertung von Messdaten senden wir über ein externes in VB.NET geschriebenes Tool Messdaten an FlexPro und lassen darin verschiedene Auswertungen ablaufen. Die Ergebnisse sind schlussendlich in mehreren Dokumenten (*.DOC) zusammengefasst. Nun wollen wir diese Dokumente auch automatisch als pdf oder besser xps ausgeben. Über die Printout-Methode funktioniert dies nur eingeschränkt, da diese stets das Dialogfenster ‘Speichern unter’ dazwischenfunkt. Einen SaveAs-Parameter gibt es bei der PrintOut-Methode nicht. Bestimmt gibt es einen Weg, die Dokumente ohne Benutzereingabe im Hintergrund als pdf- oder xps-Dateien auszugeben.
Wer hat einen Lösungsansatz oder gar eine Lösung?
January 19, 2011 at 7:38 pm #8054Ulf LichteMemberFür eine automatisierte Auswertung von Messdaten senden wir über ein externes in VB.NET geschriebenes Tool Messdaten an FlexPro und lassen darin verschiedene Auswertungen ablaufen. Die Ergebnisse sind schlussendlich in mehreren Dokumenten (*.DOC) zusammengefasst. Nun wollen wir diese Dokumente auch automatisch als pdf oder besser xps ausgeben. Über die Printout-Methode funktioniert dies nur eingeschränkt, da diese stets das Dialogfenster ‘Speichern unter’ dazwischenfunkt. Einen SaveAs-Parameter gibt es bei der PrintOut-Methode nicht. Bestimmt gibt es einen Weg, die Dokumente ohne Benutzereingabe im Hintergrund als pdf- oder xps-Dateien auszugeben.
Wer hat einen Lösungsansatz oder gar eine Lösung?
January 19, 2011 at 10:29 pm #8574Bernhard KantzParticipantFlexPro does not support the direct export of XPS or PDF files. If you print a document the file name dialog box will be shown by your PDF or XPS printer driver not by the printing sub-system of Windows itself. That’s why it can’t be prohibited or automated by FlexPro.
You need to find a PDF printer driver which supports to be pre-configured with a file name and/or file name building rules and a target path.Support
support@weisang.comFebruary 28, 2012 at 8:54 am #9220John GerhardyParticipantHello,
this is also a topic for me and maybe for others as well.
The active folder function is great :D, but it means that I have to manually activate each folder and then print the document which kind of degrades this wonderful feature. 🙁I mean imagine you would have to print every page of a word document separately for a 140 page document, not so much fun.
Or have I missed something?Would you maybe put a request for some type of batch printing on the Christmas wish list?
Regards,
John GerhardyMarch 19, 2012 at 5:52 pm #9227Stefan PalaveevMemberI use PDF-Creator. It is possible to add files to a wating list in the print queue and after all tasks are finished to combine them to a single file. You can find some exemples on the internet how to use the driver with MS-Excel. My exemple is very long because of the common file dialog, but I hope you can use it.
Private Declare Function GetOpenFileName Lib “comdlg32.dll” _
Alias “GetOpenFileNameA” (pOpenfilename As OPENFILENAME) _
As LongDeclare Function SHGetPathFromIDList Lib “shell32.dll” _
Alias “SHGetPathFromIDListA” (ByVal pidl As Long, _
ByVal pszPath As String) As LongDeclare Function SHBrowseForFolder Lib “shell32.dll” _
Alias “SHBrowseForFolderA” (lpBrowseInfo As BROWSEINFO) As LongPrivate Type OPENFILENAME
lStructSize As Long
hwndOwner As Long
hInstance As Long
lpstrFilter As String
lpstrCustomFilter As String
nMaxCustFilter As Long
nFilterIndex As Long
lpstrFile As String
nMaxFile As Long
lpstrFileTitle As String
nMaxFileTitle As Long
lpstrInitialDir As String
lpstrTitle As String
Flags As Long
nFileOffset As Integer
nFileExtension As Integer
lpstrDefExt As String
lCustData As Long
lpfnHook As Long
lpTemplateName As String
End TypePublic Type BROWSEINFO
hOwner As Long
pidlRoot As Long
pszDisplayName As String
lpszTitle As String
ulFlags As Long
lpfn As Long
lParam As Long
iImage As Long
End TypePublic Const OFN_ALLOWMULTISELECT As Long = &H200&
Public Const OFN_CREATEPROMPT As Long = &H2000&
Public Const OFN_ENABLEHOOK As Long = &H20&
Public Const OFN_ENABLETEMPLATE As Long = &H40&
Public Const OFN_ENABLETEMPLATEHANDLE As Long = &H80&
Public Const OFN_EXPLORER As Long = &H80000
Public Const OFN_EXTENSIONDIFFERENT As Long = &H400&
Public Const OFN_FILEMUSTEXIST As Long = &H1000&
Public Const OFN_HIDEREADONLY As Long = &H4&
Public Const OFN_LONGNAMES As Long = &H200000
Public Const OFN_NOCHANGEDIR As Long = &H8&
Public Const OFN_NODEREFERENCELINKS As Long = &H100000
Public Const OFN_NOLONGNAMES As Long = &H40000
Public Const OFN_NONETWORKBUTTON As Long = &H20000
Public Const OFN_NOREADONLYRETURN As Long = &H8000&
Public Const OFN_NOTESTFILECREATE As Long = &H10000
Public Const OFN_NOVALIDATE As Long = &H100&
Public Const OFN_OVERWRITEPROMPT As Long = &H2&
Public Const OFN_PATHMUSTEXIST As Long = &H800&
Public Const OFN_READONLY As Long = &H1&
Public Const OFN_SHAREAWARE As Long = &H4000&
Public Const OFN_SHAREFALLTHROUGH As Long = 2&
Public Const OFN_SHARENOWARN As Long = 1&
Public Const OFN_SHAREWARN As Long = 0&
Public Const OFN_SHOWHELP As Long = &H10&Public Function ShowOpen(Filter As String, Flags As Long, hWnd As Long) As String
Dim Buffer As String
Dim Result As Long
Dim ComDlgOpenFileName As OPENFILENAMEBuffer = String$(128, 0)
With ComDlgOpenFileName
.lStructSize = Len(ComDlgOpenFileName)
.hwndOwner = hWnd
.Flags = Flags
.nFilterIndex = 1&
.nMaxFile = Len(Buffer)
.lpstrFile = Buffer
.lpstrFilter = Filter
End WithResult = GetOpenFileName(ComDlgOpenFileName)
If Result 0 Then
ShowOpen = Left$(ComDlgOpenFileName.lpstrFile, _
InStr(ComDlgOpenFileName.lpstrFile, _
Chr$(0)) – 1)
End If
End FunctionFunction GetDirectory(Msg) As String
Dim bInfo As BROWSEINFO
Dim path As String
Dim r As Long, x As Long, pos As Integer
With bInfo
.pidlRoot = 0&
.lpszTitle = Msg
.ulFlags = &H1
End With
x = SHBrowseForFolder(bInfo)
path = Space$(512)
r = SHGetPathFromIDList(ByVal x, ByVal path)
If r Then
pos = InStr(path, Chr$(0))
GetDirectory = Left(path, pos – 1)
Else
GetDirectory = “”
End If
End FunctionSub AuswertungEHT()
Dim Main_Data As String, Copied_Data As String, Pfad As String, Verzeichnis As String, k As Integer
Dim Filter As String, Flags As Long
Flags = OFN_FILEMUSTEXIST Or OFN_HIDEREADONLY Or _
OFN_PATHMUSTEXISTFilter = “FlexPro (*.fpd)”
Main_Data = ShowOpen(Filter, Flags, 0)
‘Main_Data is a file with a FPScript Template for Data Analysis
‘Verzeichnis = “c:\Data”
Verzeichnis = GetDirectory(“Bitte, das Verzeichnis mit den zu bearbeitenden Dateien wählen!”)Application.FileOpenDirectory = Verzeichnis ‘Sets default working directory
Liste = Dir(Verzeichnis & “\*.fpd”)
k = 1For i = 1 To 9999
Liste = Dir
If Liste “” Then
k = k + 1
Else
i = 99999
End If
Next i”’——————–PDF-INI————————–
Dim pdfjob As PDFCreator.clsPDFCreator
Dim sPDFName As String
Dim sPDFPath As String
Dim lSheet As LongSet pdfjob = New PDFCreator.clsPDFCreator
If pdfjob.cStart(“/NoProcessingAtStartup”) = False Then
MsgBox “Can’t initialize PDFCreator.”, vbCritical + _
vbOKOnly, “PrtPDFCreator”
Exit Sub
End If
”’——————————————————-For i = 1 To k
If i = 1 Then
Copied_Data = Dir(Verzeichnis & “\*.fpd”)
Else: Copied_Data = Dir
End IfDim oDB As Database
Set oDB = Databases.Open(Copied_Data, fpOpenModeDirect)If i = 1 Then
Dim oMasterDB As Database
Set oMasterDB = Databases.Open(Main_Data, fpOpenModeDirect)
With Databases(Main_Data).RootFolder.Add(“Zahlen”, fpObjectTypeDataSet)
.DataStructure = fpDataStructureDataMatrix
.DataType(fpDataComponentAll) = fpDataTypeFloat64
.NumberOfColumns = 9
.NumberOfRows = k
.FillColumns “(NumberOfRows(i), FloatingPoint64 0, FloatingPoint64 0)”, _
fpDataComponentAll
.Update
End WithWith Databases(Main_Data).RootFolder.Add(“Namen”, fpObjectTypeDataSet)
.DataStructure = fpDataStructureDataMatrix
.DataType(fpDataComponentAll) = fpDataTypeString
.NumberOfColumns = 2
.NumberOfRows = k
.FillColumns “(NumberOfRows(i), String “”, String “”)”, _
fpDataComponentAll
.Update
End WithEnd If
Databases(Main_Data).Objects(Array(“\Auswertung.FLD”)).CopyTo oDB.RootFolder
Dim oFolder As Folder
Set oFolder = oDB.RootFolder.Object(“Auswertung.fld”, fpObjectTypeFolder)
Dim oDoc As Document
Set oDoc = oFolder.Object(“Dokument.Doc”, fpObjectTypeDocument)With pdfjob
‘PDF-Dateinamen festlegen
sPDFName = Copied_Data & “.pdf”
sPDFPath = Verzeichnis
‘Standardwerte setzen
.cOption(“UseAutosave”) = 1
.cOption(“UseAutosaveDirectory”) = 1
.cOption(“AutosaveDirectory”) = sPDFPath
.cOption(“AutosaveFilename”) = sPDFName
.cOption(“AutosaveFormat”) = 0 ‘ 0 = PDFEnd With
With oDoc
.Open = True
.Update
.PrintOut 1, 1, 2
End WithDim Cam_Zeit As Formula, Cam_Weg As Formula, Datum As Formula, MessNr As Formula
Set Cam_Zeit = oDB.Object(“\Auswertung\Zeit\Start_Camera_Gate”, fpObjectTypeFormula)
Set Cam_Weg = oDB.Object(“\Auswertung\Weg\Start_Camera_Gate”, fpObjectTypeFormula)
Set Datum = oDB.Object(“\Auswertung\Datum”, fpObjectTypeFormula)
Set MessNr = oDB.Object(“\Auswertung\MessungNr”, fpObjectTypeFormula)
Set osp_Druck = oDB.Object(“Auswertung\Zeit\Spitzendruck”, fpObjectTypeFormula)
Set oDelay = oDB.Object(“Auswertung\Zeit\Delay”, fpObjectTypeFormula)Databases(Main_Data).RootFolder.Object(“Zahlen”).Value(fpDataComponentY, 1, i) = Cam_Zeit.Call
Databases(Main_Data).RootFolder.Object(“Zahlen”).Value(fpDataComponentY, 2, i) = Cam_Weg.Call
Databases(Main_Data).RootFolder.Object(“Namen”).Value(fpDataComponentY, 1, i) = Datum.Call
Databases(Main_Data).RootFolder.Object(“Namen”).Value(fpDataComponentY, 2, i) = MessNr.Call
On Error Resume Next
Databases(Main_Data).RootFolder.Object(“Zahlen”).Value(fpDataComponentY, 3, i) = osp_Druck.Call
On Error Resume Next
Databases(Main_Data).RootFolder.Object(“Zahlen”).Value(fpDataComponentY, 4, i) = oDelay.Call
On Error Resume NextoDB.Close pSaveChanges
Next i‘Wait until all print jobs have entered the print queue
‘Do Until pdfjob.cCountOfPrintjobs = k
‘ DoEvents
‘ Loop‘Combine all PDFs into a single file and stop the printer
‘ With pdfjob
‘ .cCombineAll ‘ Combines all files in the printer queue
‘ .cPrinterStop = True ‘ Holds the print job
‘ End With”’——————————————————————————————–
‘ cClose seems to make some problems in PDFCreator 0.9.7 and earlyer versions. Start the
‘ print job manually and close the application. After that you can save the Main_data file.
‘ In April 2009 new version of PDFCreator is expected which solves the Problem‘Wait until PDF creator is finished then release the objects
‘Do Until pdfjob.cCountOfPrintjobs = 0
‘ DoEvents
‘Loop
‘pdfjob.cClose
‘Set pdfjob = Nothing”’———————————————————————————————-
End Sub
March 21, 2012 at 8:47 am #9230Bernhard KantzParticipantI would create a multi page document in FlexPro and print out this document.
-
AuthorPosts
- You must be logged in to reply to this topic.