- william yau
- PowerBuilder
- Thursday, 7 November 2024 09:09 AM UTC
Dear Guru,
I have a question. I have an application built with PowerBuilder 7.0 that contains a script similar to the one below. There is a function that opens, edits, and saves a document as a PDF. This function was working fine before, but last week, on some desktops, when running this function, the text can be converted to PDF, but the pictures in Word documents are not being correctly converted to PDF.
ls_wscript = 'Dim objDoc, objWord' // Declare variables
ls_wscript = ls_wscript + '~r~n' + 'Set objWord = CreateObject( "Word.Application" )' // Create a Word object
ls_wscript = ls_wscript + '~r~n' + 'With objWord'
ls_wscript = ls_wscript + '~r~n' + '.Visible = True' // True: make Word visible; False: invisible
ls_wscript = ls_wscript + '~r~n' + '.WindowState = 2' // True: make Word visible; False: invisible
ls_wscript = ls_wscript + '~r~n' + '.Documents.Open "' + ls_doc_path + '"' // Open the Word document
ls_wscript = ls_wscript + '~r~n' + 'Set objDoc = .ActiveDocument' // Make the opened file the active document
ls_wscript = ls_wscript + '~r~n' + 'objDoc.SaveAs "' + ls_photo_path + '", 17' // ' Save as pdf, file format of pdf = 17
ls_wscript = ls_wscript + '~r~n' + 'objDoc.Close' // Close the active document
ls_wscript = ls_wscript + '~r~n' + '.Quit' // Close Word
ls_wscript = ls_wscript + '~r~n' + 'End With'
li_FileNum = FileOpen(ls_wscript_path, StreamMode!, Write!, LockReadWrite!, Replace!)
filewrite(li_FileNum, ls_wscript)
fileclose(li_FileNum)
// run Wscript
li_rc = wsh.Run('wscript.exe "' + ls_wscript_path + '"' , MINIMIZED, WAIT)
Please help me and give advice
William
Find Questions by Tag
Helpful?
If a reply or comment is helpful for you, please don’t hesitate to click the Helpful button. This action is further confirmation of their invaluable contribution to the Appeon Community.