PdcApplication.OpenFile: Difference between revisions

From External Bemet Wiki
Jump to navigation Jump to search
No edit summary
No edit summary
Line 15: Line 15:
<source lang="vb">
<source lang="vb">
dim sFileLocalPath as string = "C:\ECI\filename.pdf"
dim sFileLocalPath as string = "C:\ECI\filename.pdf"
dim sFileCloudToLocalPath as string = PDC.App.TranslateToLocalPath(sFileLocalPath)
dim sFileCloudToLocalPath as string = ""
if PDC.App.Info.RunninginCloud then
  sFileCloudToLocalPath  = PDC.App.TranslateToLocalPath(sFileLocalPath)
else
  sFileCloudToLocalPath  = sFileLocalPath
end if
dim objReport as pdcReport
dim objReport as pdcReport
objReport = PDC.App.Reports.Open(1409)
objReport = PDC.App.Reports.Open(1409)

Revision as of 06:54, 5 June 2026

Declaration

OpenFile(strFilePath As String)

Description

Open a file based on a filepath. This function is mostly intended for use in the Cloud for when a file was saved to the users computer and now needs to be opened. But it also works on-prem.

Parameters

strFilePath: A path leading to a file or folder, for example: "C:\Users\Admin\Documents\". Keep in mind that this path needs to be from the perspective of the user.

Notes

This method is available both in the EciCloud and in the on-prem version of Bemet.


Code example

dim sFileLocalPath as string = "C:\ECI\filename.pdf"
dim sFileCloudToLocalPath as string = ""
if PDC.App.Info.RunninginCloud then
  sFileCloudToLocalPath  = PDC.App.TranslateToLocalPath(sFileLocalPath)
else
  sFileCloudToLocalPath  = sFileLocalPath
end if
dim objReport as pdcReport
objReport = PDC.App.Reports.Open(1409)

objReport.PrintToFile(sFileCloudToLocalPath)
if io.file.exists(sFileCloudToLocalPath) then
  PDC.App.OpenFile(sFileLocalPath)
end if

Availability

Bemet 2024R4 and higher.