DIAdem

cancel
Showing results for 
Search instead for 
Did you mean: 

Hide report sheet in a template without deleting

Hi,

 

Is there a way to hide a work sheet in a report template without deleting the sheet?

 

Template consist of 22 pages, based on condition, few pages need to be hidden before exporting to pdf file.

 

Ex: if type = "Engine" then need to export to PDF file with all pages except page no 5, 7, 14.

if type = "Non-Engine" then need to export to PDF file with all pages except 14, 18, 20

 

regards,

Durai

 

0 Kudos
Message 1 of 3
(1,208 Views)

Why not delete the pages, save as pdf, then clear the template and reload it?  Only the right pages will be exported and the template will stay the same

0 Kudos
Message 2 of 3
(1,179 Views)

Hello Durai26,

 

You can use the ExportToPDF function of the sheet object, which has a second parameter that specifies whether the page should be attached to an existing PDF file or create a new PDF file. Set False for the first page to be exported and True for all other pages. This will give you a PDF that only contains the desired pages.

 

Here an example:

dim no_export : set no_export = CreateObject("Scripting.Dictionary")
call no_export.Add(5, 5)
call no_export.Add(7, 7)
call no_export.Add(14, 14)

dim sheet, append

append = false
for each sheet in Report.Sheets
  if not no_export.Exists(sheet.Index) then
    call sheet.ExportToPDF(CurrentScriptPath & "Engine", append)
    append = true
  end if
next
0 Kudos
Message 3 of 3
(1,087 Views)