Guest User

Untitled

a guest
Aug 19th, 2019
82
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
  1. "c:/Program Files/LibreOffice/program/soffice" --nologo --norestore --nolockcheck "macro:///Standard.Module2.PysIndexer(C:wampwwwsitepublicfile.docx)"
  2.  
  3. sub PysIndexer(docPath as string)
  4.  
  5. dim document as object
  6. dim dispatcher as object
  7. dim pdfPath as string
  8.  
  9. dim args1(0) as new com.sun.star.beans.PropertyValue
  10. dim args2(0) as new com.sun.star.beans.PropertyValue
  11.  
  12. if fileExists(docPath) then
  13.  
  14. args1(0).Name = "Hidden"
  15. args1(0).Value = True
  16.  
  17. args2(0).Name = "FilterName"
  18. args2(0).Value = "writer_pdf_Export"
  19.  
  20. document = starDesktop.loadComponentFromUrl(convertToUrl(docPath), "_blank", 0, args1())
  21.  
  22. dispatcher = createUnoService("com.sun.star.frame.DispatchHelper")
  23. dispatcher.executeDispatch(document.CurrentController.Frame, ".uno:UpdateAllIndexes", "", 0, array())
  24.  
  25. GlobalScope.BasicLibraries.LoadLibrary("Tools")
  26. pdfPath = GetFileNameWithoutExtension(docPath) & ".pdf"
  27. document.storeToURL(convertToUrl(pdfPath), args2())
  28.  
  29. document.close(True)
  30. end if
  31.  
  32. end sub
RAW Paste Data