Skip to main content
Announcements
SYSTEM MAINTENANCE: Thurs., Sept. 19, 1 AM ET, Platform will be unavailable for approx. 60 minutes.
cancel
Showing results for 
Search instead for 
Did you mean: 
Not applicable

Is it possible to write a function to print a sheet (not report)?

Hi,

I'm a new QlikView customer running SBE Version 10 with the latest service pack.

I have a few daily sheets with are daily reports, which I am planning to batch generate every day using a windows scheduled task. This has been well covered in other posts.

My sheets are already formatted nicely to fit onto a single page, and I found that after converting one of them into a report, I had to do some extra rework by recreating captions (which do not apparently get carried over into the report and ran into limitation such as not being able to use date functions within the header (to display yesterday's date for example using Today()-1.

My question is:

- Is it possible to write a function that prints the Sheet Object?

All of the examples I have seen provide the ID of a report with the "RP" prefix. I have tried replacing the report id with that of a sheet with no luck. There does not appear to be a "PrintSheet" method either. While I suppose reports are objects which are intended for printing, I don't understand why it wouldn't be possible to automate the printing of a sheet since this can be done manually using File > Print Sheet.

The function I have works fine for a report:

Function printReportPDF

ActiveDocument.PrintReport "RP01", "PDF-XChange 3.0", false

Set objFSO = CreateObject("Scripting.FileSystemObject")

objFSO.MoveFile "C:\TestPDF\QlikView Printing.pdf", "C:\TestPDF\Exec.pdf"

End Function

I would appreciate any direction on this, and welcome your thoughts in general on the benefits of report printing vs sheet printing. I have already gathered the obvious points which are pointed out in the manual (i.e.: ability to compile a specific selection of charts, reformatting dashboard objects into a traditional report format).

Regards,

Jouni

1 Solution

Accepted Solutions
erichshiino
Partner - Master
Partner - Master

Actually there is a PrintSheet method.

Please, try to adapt this code to your app (this prints the first sheet)


sub print
set ss= ActiveDocument.GetSheet(0)
ss.print
end sub


View solution in original post

4 Replies
erichshiino
Partner - Master
Partner - Master

Actually there is a PrintSheet method.

Please, try to adapt this code to your app (this prints the first sheet)


sub print
set ss= ActiveDocument.GetSheet(0)
ss.print
end sub


Not applicable
Author

Hi,

You can try this one

sub Export

tempFolder="D:\Upendra\"

reportName="TestDashboard"

reportFile = tempFolder & reportName & day(date) & monthname(month(date))&".pdf"

'msgbox reportFile

printReportPDF reportFile

ActiveDocument.GetApplication.Sleep 5000

ActiveDocument.sheets("SH05").Print

ActiveDocument.GetApplication.Sleep 5000

' SendMail

'msgbox "saved."

end sub

'===========================================================================

Function printReportPDF(pdfOutputFile)

Set WSHShell = CreateObject("WScript.Shell")

WSHShell.RegWrite "HKCU\Software\QlikviewPDF\OutputFile", pdfOutputFile, "REG_SZ"

WSHShell.RegWrite "HKCU\Software\QlikviewPDF\BypassSaveAs", "1", "REG_SZ"

Set WSHShell = nothing

End function



Hope this will help you.

Thanks & Regards

Not applicable
Author

Thank you gentlemen for the advice. I was able to print the sheet using either method. Getting the sheet by ID is more convenient, but both methods work the same.

Not applicable
Author

Hi upendra11,

Thank you for your post . I tried your macro ans it works good .

Im asking you if we can print mutilple Sheets in the same PDF document then save this .PDF in a folder automatically ( without the windo appending to save documents) ?? Thnks