Save a copy of a printout: Difference between revisions

From RadiWiki
Jump to navigation Jump to search
No edit summary
 
No edit summary
 
(5 intermediate revisions by 2 users not shown)
Line 1: Line 1:
= Question =
== Printout's ==
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:\Users\Public\Documents\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.


Is it possible to have a Word file that is equal to the printout that is generated by RadiMation?
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.
 
= Answer =
The printouts 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\prinout\' directory.
These printout can also be used as a template for the report generator. So if a '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 ==
== 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.
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:
Each printout in {{RadiMation}} is created by doing the following actions:
# Use a report generator template to generate a temporary report
# Use a report generator printout template to generate a temporary report
# Print the temporary report
# Print the temporary report
# Remove the temporary report
# Remove the temporary report


The temporary report cannot be retrieved after the printout is generated, because it is deleted from disk.
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.
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.
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:
Include the following word-macro in the same printout file:


  Sub SaveCopyOfFile()
  Sub SaveCopyOfFile()
Line 32: Line 26:
     sOrgFile = ActiveDocument.Name
     sOrgFile = ActiveDocument.Name
      
      
     ' Determine the new name
     ' Determine the new name, using the date and time in the filename
     sDate = Format$(Now, "YYYY-MM-DD HHMMSS")
     sDate = Format$(Now, "YYYY-MM-DD HHMMSS")
    ' Set the directory in which the files should be placed
     sDir = "C:\Printed files\"
     sDir = "C:\Printed files\"
     ' Check if the directory exists
     ' Check if the directory exists
Line 48: Line 43:
   
   
  Public Function CheckDirExists(ByVal vsdir As String) As Boolean
  Public Function CheckDirExists(ByVal vsdir As String) As Boolean
  ' Deze functie controleert of de opgegeven directory bestaat
  ' This function checks if the specified directory exists
   
   
    Dim lLengte As Long
     Dim eAttr As VbFileAttribute
     Dim eAttr As VbFileAttribute
      
      
Line 66: Line 60:
As a last action, create the correct directory ('C:\Printed Files\').  
As a last action, create the correct directory ('C:\Printed Files\').  


When with the above configuration, a printout of a test is generated, then a copy of the temporary report that is created will be stored in the directory. The files will be named accoording to the date and time of the print action.  
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.
This method can be used to very easily create Word files for a lot of tests.


[[Category:RadiMationQuestions]]
[[Category:RadiMation]]
[[Category:RadiMation]]
[[Category:Report generator]]

Latest revision as of 11:03, 9 September 2022

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:\Users\Public\Documents\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.