Your Products have been synced, click here to refresh
RepWin.FullReportMode
EditWin.SetPrintOptionsEx PCD_FILE,DMIS_OFF,PCD_OVERWRITE,0,Fullname,PCD_PDF,False
RepWin.LoadReportTemplate "(path here...)\DefaultReportingTemplateBackup\TEXTONLY.RTP"
RepWin.RefreshReport
RepWin.PrintReport
Sub main()
Dim pcapp As Object
Dim pcpart As Object
Dim ew As Object
Dim rw As Object
Set pcapp = createobject("pcdlrn.application")
Set pcpart = pcapp.activepartprogram
Set rw = pcpart.reportwindow
rw.FullReportMode
rw.RefreshReport
Set ew = pcpart.editwindow
ew.SetPrintOptionsEx 2,0,3,0,"C:\Temp\Test123.pdf",1,0
rw.RefreshReport
rw.printreport
ew.SetPrintOptionsEx 0,0,3,0,"C:\Temp\Test123.pdf",1,0
End Sub
Yeah, seems to be a bit of a mess. :-/
I'll try it out when I get back from the holidays.
Thanks and merry Christmas!
This seems to be a very helpful forum. I'll see if I can recipocate somehow. :-)
Dim DmisApp As Object Dim DmisPart As Object Dim EditWindow As Object Dim ReportWindow As Object Sub Main Set DmisApp = CreateObject("PCDLRN.Application") Set DmisPart = DmisApp.ActivePartProgram Set EditWindow = DmisPart.EditWindow Set ReportWindow = DmisPart.ReportWindow EditWindow.SetPrintOptionsEx PCD_FILE, DMIS_OFF, PCD_OVERWRITE, 0, "e:\ProblemReports\AutomationOutput.PDF", PCD_PDF, False ReportWindow.PrintReport EditWindow.SetPrintOptionsEx 0, DMIS_OFF, PCD_OVERWRITE, 0, "e:\ProblemReports\AutomationOutput.PDF", PCD_PDF, False Set ReportWindow = Nothing Set EditWindow = Nothing Set DmisPart = Nothing Set DmisApp = Nothing End Sub
Sounds like a bug. At least the Auto & Append part. I imagine things get confusing inside pcdmis since I'm guessing you are executing when this is being done.
You define a global output definition - EditWin.SetPrintOptionsEx - defining you want some output.
You switch the report from Execute Mode to FullReportMode (basically learn mode).
And then switch or tell pcdmis to use/reuse the report using a template (RepWin.LoadReportTemplate). This alone should refresh the report.
Then tell the report to print.
At end of execution, since you defined you want output (see EditWin.SetPrintOptionsEx above), pcdmis will generate another report - perhaps this is where the extra report is coming from. You should turn the output off (as mentioned by Ninja above) after forcing the print.
Automation report printing seems to be incomplete. Pcdmis goes through report finishing when execute is done. I'm guessing this is not being performed when forcing a print via automation before pcdmis is really done with execution. This probably explains why you switch to FullReportMode.
You could probably get rid of the Auto index issue by defining an overwrite output in file output dialog. Just to define its not an auto index. Close the dialog, open the dialog and turn off output but keep the Overwrite.
Save the part program.
You will also need to turn off the end of execution printing after you print (see Ninja code above).
Dim DmisApp As Object Dim DmisPart As Object Dim EditWindow As Object Dim ReportWindow As Object Sub Main Set DmisApp = CreateObject("PCDLRN.Application") Set DmisPart = DmisApp.ActivePartProgram Set EditWindow = DmisPart.EditWindow Set ReportWindow = DmisPart.ReportWindow EditWindow.SetPrintOptionsEx PCD_FILE, DMIS_OFF, PCD_OVERWRITE, 0, "e:\ProblemReports\AutomationOutput.PDF", PCD_PDF, False ReportWindow.PrintReport EditWindow.SetPrintOptionsEx 0, DMIS_OFF, PCD_OVERWRITE, 0, "e:\ProblemReports\AutomationOutput.PDF", PCD_PDF, False Set ReportWindow = Nothing Set EditWindow = Nothing Set DmisPart = Nothing Set DmisApp = Nothing End Sub
© 2024 Hexagon AB and/or its subsidiaries. | Privacy Policy | Cloud Services Agreement |