erich.wanker Posted April 18 Share Posted April 18 Hi .. has someone a idea why this simple OLE doesnt work? (the paths and Files are correct) in my hyperserver-hosted unigui-dll ( is it a user right thing?? .. the apache webserver is running as "local System" ...) ThanX Erich uses ComObj, Variants var: WordApplication, WordFile : OleVariant; ... WordApplication := Null; WordFile := Null; try // create Word OLE try // Check if Word is already opened? WordApplication := GetActiveOleObject('Word.Application' ); except try WordApplication := CreateOleObject('Word.Application' ); WordApplication.Visible := true; except Exception.Create( 'Error' ); end; end; except WordApplication := Null; end; If VarIsNull( WordApplication ) = False then begin try WordApplication.Visible := true; WordApplication.DisplayAlerts := true; // Open Word File try WordFile := WordApplication.Documents.Open(merge_dateiname_mit_pfad ); except WordFile := Null; end; If VarIsNull( WordFile ) = False then begin WordFile.SaveAs2( merge_destfolder + '\aenderung' + UniMainModule.Z_AENDERUNG.FieldByName( 'Reportnummer' ).AsString + '\converted.pdf', 17 ); // wdFormatPDF = 17 end else begin showtoast('Word-Dok not saved'); end; finally WordFile.Close; WordApplication.DisplayAlerts := true; WordApplication.Quit; WordFile := Unassigned; WordApplication := Unassigned; end; end else begin showtoast('Word Application not started'); end; Quote Link to comment Share on other sites More sharing options...
Recommended Posts
Join the conversation
You can post now and register later. If you have an account, sign in now to post with your account.