PdcApplication.OpenFile: Difference between revisions

From External Bemet Wiki
Jump to navigation Jump to search
Created page with "== 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 avail..."
 
No edit summary
 
(3 intermediate revisions by the same user not shown)
Line 14: Line 14:
== Code example ==
== Code example ==
<source lang="vb">
<source lang="vb">
Dim objReport As pdcReport
dim sFileLocalPath as string = "C:\ECI\filename.pdf"
objReport = PDC.App.Reports.Open(1409)
if PDC.App.Info.RunninginCloud then
objReport.PrintToFile("\\tsclient\C\ECI\filename.pdf")
  'TranslateToLocalPath can handle tsclient and GraphOn
PDC.App.OpenFile("C:\ECI\filename.pdf")
  dim sFileCloudToLocalPath as string = PDC.App.TranslateToLocalPath(sFileLocalPath)
 
  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
else
  dim objReport as pdcReport
  objReport = PDC.App.Reports.Open(1409)
 
  objReport.PrintToFile(sFileLocalPath)
  if io.file.exists(sFileLocalPath) then
    PDC.App.OpenFile(sFileLocalPath)
  end if
end if
</source>
</source>


== Availability ==
== Availability ==
Bemet 2024R4 and higher.
Bemet 2024R4 and higher.

Latest revision as of 07:11, 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"
if PDC.App.Info.RunninginCloud then
  'TranslateToLocalPath can handle tsclient and GraphOn
  dim sFileCloudToLocalPath as string = PDC.App.TranslateToLocalPath(sFileLocalPath)

  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
else
  dim objReport as pdcReport
  objReport = PDC.App.Reports.Open(1409)

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

Availability

Bemet 2024R4 and higher.