alanbr00 Posted October 30, 2022 Share Posted October 30, 2022 Hi, this is the code that i'm using expandcollapse popup#include <GUIConstants.au3> #include<date.au3> AutoItSetOption("WinTitleMatchMode", 2) Dim $sReportName Dim $objCRApp Dim $objCRReport Dim $objCRViewer Dim $CrystalExportOptions Dim $ExportFileName Dim $ExportType Local $PrevMonth = @MON-1 if @MON=1 then $PrevMonth = 12 Local $sPrevLongMonthName = _DateToMonth($PrevMonth, 2) ;~ $sReportName = FileOpenDialog("C:\School\zNC\engine\Vinhos\VinhosTotal", "", "RPT (VinhosTotal.rpt)", 3);Filter "." means all $sReportName = "C:\School\zNC\engine\Vinhos\VinhosTotal.rpt" $objCRApp = ObjCreate("CrystalRuntime.Application.11") If $objCRApp = 0 Then MsgBox(0, "Error", "Could not create CrystalRuntime Application Object") Exit EndIf $objCRReport = $objCRApp.OpenReport($sReportName) If $objCRReport = 0 Then MsgBox(0, "Error", "Could not open report: " & $sReportName) Exit EndIf $objCRViewer = ObjCreate("CrystalReports11.ActiveXReportViewer.11") ;~ ; Create a simple GUI for our output $hndReportViewer = GUICreate ( "Embedded Crystal Reports Export test", 640, 580,(@DesktopWidth-640)/2, (@DesktopHeight-580)/2 , $WS_OVERLAPPEDWINDOW + $WS_VISIBLE + $WS_CLIPSIBLINGS) If $hndReportViewer = 0 Then MsgBox(0, "Error", "Could not create Window to display Crystal Reports control") Exit EndIf ;~ ;Creates an ActiveX control in the GUI. $GUIActiveX = GUICtrlCreateObj ( $objCRViewer, -1, -1, 640, 580) If $GUIActiveX = 0 Then MsgBox(0, "Error", "Could not create ActiveX Control in GUI") Exit EndIf GUICtrlSetResizing ( $GUIActiveX, $GUI_DOCKAUTO) ; Show GUI GUISetState () $objCRViewer.ReportSource = $objCRReport ; Display the Report to watch automation $objCRViewer.ViewReport ; The report displays a "0" in control 20005 while the report is loading While ControlGetText("Embedded Crystal Reports printing test", "", 20005) = "0" Sleep(50) WEnd $CrystalExportOptions = $objCRReport.ExportOptions $ExportFileName = "C:\School\zNC\megasync\Vinhos\" & $sPrevLongMonthName & ".PDF" $ExportType = 31 $CrystalExportOptions.DiskFileName = $ExportFileName $CrystalExportOptions.FormatType = $ExportType $CrystalExportOptions.DestinationType = 1 $objCRReport.Export ( False ) ;~ Sleep(500) ;~ WinWaitClose("Export", "", 30) ;~ GUIDelete() I can't execute as .exe because i receive this error I have the Crystal Reports XI and 2008 installed. It seems that i would need to update my crystal, but i would like to keep using those version for now. Link to comment Share on other sites More sharing options...
Nine Posted October 30, 2022 Share Posted October 30, 2022 it seems you need to register some dlls https://stackoverflow.com/questions/14779990/using-crystal-reports-xi-with-classic-asp “They did not know it was impossible, so they did it” ― Mark Twain Spoiler Block all input without UAC Save/Retrieve Images to/from Text Monitor Management (VCP commands) Tool to search in text (au3) files Date Range Picker Virtual Desktop Manager Sudoku Game 2020 Overlapped Named Pipe IPC HotString 2.0 - Hot keys with string x64 Bitwise Operations Multi-keyboards HotKeySet Recursive Array Display Fast and simple WCD IPC Multiple Folders Selector Printer Manager GIF Animation (cached) Screen Scraping Multi-Threading Made Easy Link to comment Share on other sites More sharing options...
Recommended Posts
Create an account or sign in to comment
You need to be a member in order to leave a comment
Create an account
Sign up for a new account in our community. It's easy!
Register a new accountSign in
Already have an account? Sign in here.
Sign In Now