Save a copy of a printout: Difference between revisions
No edit summary |
No edit summary |
||
Line 72: | Line 72: | ||
[[Category:RadiMationQuestions]] | [[Category:RadiMationQuestions]] | ||
[[Category:RadiMation]] | [[Category:RadiMation]] | ||
[[Category:Report generator]] |
Revision as of 11:03, 8 March 2007
Question
Is it possible to have a Word file that is equal to the printout that is generated by RadiMation?
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
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:
- Use a report generator template to generate a temporary report
- Print the temporary report
- 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. 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 sDate = Format$(Now, "YYYY-MM-DD HHMMSS") 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 ' Deze functie controleert of de opgegeven directory bestaat Dim lLengte As Long 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 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.
This method can be used to very easily create word files for a lot of tests.