Skip to main content
Woohoo! Qlik Community has won “Best in Class Community” in the 2024 Khoros Kudos awards!
Announcements
Nov. 20th, Qlik Insider - Lakehouses: Driving the Future of Data & AI - PICK A SESSION
cancel
Showing results for 
Search instead for 
Did you mean: 
shantanu73
Creator II
Creator II

Help require to develop the PDF by using macro of 2 tables objects and 1 labels object one below others

Hello Forums,

I want a help to development on PDF by using macro of 2 tables objects and 2 labels object as follows PFA of same screen shot.

I want page Header Title as 'Sample Report' and page footer as "EOF Sample Report'

Note : For Information, I don't want to use Report Edit Menu.

Thanks in Advance

SRS

3 Replies
neetu_singh
Partner - Creator III
Partner - Creator III

Hi,

Try this macro, hope it will work.

sub WebAPI

rem ** print all pivot tables on sheet Main **


set s=ActiveDocument.Sheets("Main")
charts=s.GetPivotTableBoxes

for i=lbound(charts) to ubound(charts)
 
  set chart = charts(i)
  set cp = chart.GetProperties
  set cps = cp.PrintSettings
  cps.Scale = 100                       ' 75%
  cps.UseScale = false
  chart.SetProperties cp
  chart.PrintEx ,1

next

end sub

Regards

Neetu SIngh


      

shantanu73
Creator II
Creator II
Author

Hello Neetu,

I hope you understand the requirement. I want to generate the PDF file by using Macro of QV.

Where there will me 2 tables objects and 2 labels object. After generateion the report the format should look as the screen shot attached in first Discussion.

Can you please develop small QVD file and send me the same as per my requirment.

Thanks in Advance

SRS

Not applicable

Hello !

I also looking at how to build the pdf report without going through edit report menu .

I tried to do it like this:

function creatReport(ObjectID,NameObject,currenstSelection)

set rep = ActiveDocument.GetApplication.CreateEmptyReport

rep.Name = NameObject

     'rep.Comment = "Sample report"

rep.Pages.Add

rep.Pages.Item(0).Landscape = false

rep.PrintOptions.Header_Left = NameObject

rep.PrintOptions.Header_right = currenstSelection

rep.PrintOptions.Header_Center = "Bolloré Africa Logistic "

rep.PrintOptions.footer_left = [Date]

rep.PrintOptions.footer_Center = "1"

'rep.PrintOptions.Header_Left =getcurrentselections()

rep.Pages.Item(0).PageMode = 1

    'single paper page

rep.Pages.Item(0).Items.Add

rep.Pages.Item(0).Items.Item(0).ObjectId = ObjectID

rep.Pages.Item(0).Items.Item(0).Rect.Top = 10  'top

' rep.Pages.Item(0).Items.Item(0).Rect.Clip = 3

rep.Pages.Item(0).Items.Item(0).Rect.Left = 0  'left

rep.Pages.Item(0).Items.Item(0).Rect.Height =0 'half paper height

rep.Pages.Item(0).Items.Item(0).Rect.Width = 1 'half paper width

ActiveDocument.AddDocReport rep

' ReportAdd=true

end function

function getIDreport (Path)

set repsID = ActiveDocument.GetDocReports

for i = 0 to repsID.Count-1

    set rep = repsID.Item(i)

     p=inStr(rep.Id,"\")

    reportID = right(rep.Id,len(rep.Id)-p)

     'msgbox(reportID)

     repp = ActiveDocument.GetReport(reportID)

     reportName = repp.Name

    reportFile = path & reportID & "_" & reportName & ".pdf"

    ActiveDocument.PrintReport(reportID), "Bullzip PDF Printer", false

    MyPrintPDFWithBullZip(reportFile)

    ActiveDocument.GetApplication.Sleep 75000

  

   ActiveDocument.Save

next

end function

FUNCTION MyPrintPDFWithBullZip (reportFile)

set obj = CreateObject("Bullzip.PDFSettings")

obj.PrinterName = "Bullzip PDF Printer"

obj.SetValue "Output" , reportFile

obj.SetValue "ConfirmOverwrite", "no"

obj.SetValue "ShowSaveAS", "never"

obj.SetValue "ShowSettings", "never"

obj.SetValue "ShowPDF", "never"

obj.SetValue "RememberLastFileName", "never"

obj.SetValue "RememberLastFolderName", "never"

obj.SetValue "ShowProgressFinished", "never"

obj.SetValue "ShowProgress", "yes"

obj.WriteSettings True

END FUNCTION

next

end function

You have use the Bullzip PDF Printer  by default !

but the layout is complicated with positioning object! try it and if you can do better please let me know please!

A hope positione many objects on a single page but i dont have the differents syntaxis for this !

Any idea ?

Cordialy