Save a copy of a printout: Difference between revisions

From RadiWiki
Jump to navigation Jump to search
No edit summary
No edit summary
Line 1: Line 1:
== Printout's ==
== Printout's ==
The printout's that are generated by {{RadiMation}}, are created by using a printout template and the [[report generator]]. The printout for each file can be found in the 'C:\program files\dare development\radimation\printout\' directory.
The printout's that are generated by [[RadiMation|{{RadiMation}}]], are created by using a printout template and the [[report generator]]. The printout for each file can be found in the 'C:\program files\dare development\radimation\printout\' directory.
These printout can also be used as a template for the report generator. So if a '[[Microsoft]] [[Word]] document' version of a printout is needed, the correct printout can be used as a template for the report generator.
These printout can also be used as a template for the report generator. So if a '[[Microsoft]] [[Word]] document' version of a printout is needed, the correct printout can be used as a template for the report generator.



Revision as of 21:17, 25 January 2009

Printout's

The printout's that are generated by RadiMation®, are created by using a printout template and the report generator. The printout for each file can be found in the 'C:\program files\dare development\radimation\printout\' directory. These printout can also be used as a template for the report generator. So if a 'Microsoft Word document' version of a printout is needed, the correct printout can be used as a template for the report generator.

During the generation of the report, RadiMation® will ask, which test has to be used for the template, and you then have to select the test for with the report has to be created.

Automatically saving a copy of the printout

With the help of some macro's in the printout templates, it is also possible to save a copy of the Word files that is used when a printout is created. Each printout in RadiMation® is created by doing the following actions:

  1. Use a report generator printout template to generate a temporary report
  2. Print the temporary report
  3. Remove the temporary report

The temporary report cannot be retrieved after the printout is generated, because it is deleted from disk. However, a copy of the temporary report can be created, at the end of the generation of the temporary report.

Include at the end of the printout template the following report generator code: '||RunMacro(SaveCopyOfFile)||'. This will give the report generator an indication to start the macro with the specified name. Then also include the following word-macro in the same printout file:

Sub SaveCopyOfFile()
    
    Dim sDate As String
    Dim sDir As String
    Dim sFile As String
    Dim sOrgFile As String
    
    ' Determine the original name
    sOrgFile = ActiveDocument.Name
    
    ' Determine the new name, using the date and time in the filename
    sDate = Format$(Now, "YYYY-MM-DD HHMMSS")
    ' Set the directory in which the files should be placed
    sDir = "C:\Printed files\"
    ' Check if the directory exists
    If CheckDirExists(sDir) Then
        sFile = sDir & sDate & ".doc"
        ' Save the document under the new name
        ActiveDocument.SaveAs sFile
        
        ' Now save the file as the original file again
        ActiveDocument.SaveAs sOrgFile
    End If

End Sub

Public Function CheckDirExists(ByVal vsdir As String) As Boolean
' This function checks if the specified directory exists

    Dim eAttr As VbFileAttribute
    
    eAttr = 0
    On Error Resume Next
    eAttr = GetAttr(vsdir)
    On Error GoTo 0
    If (eAttr And vbDirectory) = vbDirectory Then
        CheckDirExists = True
    Else
        CheckDirExists = False
    End If
End Function

As a last action, create the correct directory ('C:\Printed Files\').

When with the above configuration, a printout of a test is generated, then also a copy of the temporary report that is created will be stored in the directory. The files will be named according to the date and time of the print action.

This method can be used to very easily create Word files for a lot of tests.