hexagon logo

Printreport

Hi!
Working on a little script to print pdf-reports. Is working well enough most of the time. One exception being that when ran multiple times the reports get appended to the existing file.

I use SetPrinterOptionsEx to set path and settings, using PCD_OVERWRITE as filemode. I print using the PrintReport method. Still it always gets appended. I've tried all the modes but it always appends.

Also when switching from for instance AUTO to OVERWRITE using the script it is changed correspondingly in the settings in the menu, however its still printed with the add indexnumbers from AUTO. I have to manually change it in the menu to something other than OVERWRITE and then back for the indexnumbers to go away.

First question, does printreport always use APPEND?

Second, why isn´t the printer settings updated properly by a call to SetPrinterEx? Do I need to do something else?

Is the any other way of doing this?

I guess I should be able to check if the file exists and delete before Printing, and check if the filename is wrong afterwards (due to switch from auto) and rename the file if needed. I would however really prefer not to if possible as it opens the possibilities of IO-exceptions...

Grateful for any input.
/L
Parents
  • A cut from it:


    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


    Fullname being the complete name of the new file.

    Removed the grossly long local path of the template, going to fix it so that it´s relative the PC-DMIS homedir...
Reply
  • A cut from it:


    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


    Fullname being the complete name of the new file.

    Removed the grossly long local path of the template, going to fix it so that it´s relative the PC-DMIS homedir...
Children
No Data