Skip to main content
cancel
Showing results for 
Search instead for 
Did you mean: 
francesco_menin
Partner - Creator III
Partner - Creator III

Exporting PDF Reports in XML from QlikView Server

Hi everybody,

I was wondering if anybody had ever needed to export some reports created by an user in their Server's workspace to import in the document.

I know it's possible to do so by working with the GUI but I was looking for a straightforward way to do it without user or admin intervention.

The APIs don't seem to have a method to export directly the reports from any document or through the server.

It's possible though to use the documented command:
ActiveDocument.ExportLayoutFile "c:\AppLayout.xml"

to create an XML file that is comparable to the prj- folder.

This doesn't seem to be working through the server.

Any hint or suggestion is welcome.

Francesco

8 Replies
marcus_sommer

I don't believe that it will be directly possible within the server. But you could use the above mentioned macro-statement within the fat-client. Maybe with a loop through your directories and triggered per server-task which runs an app with an execute-statement which runs such a macro-app.

- Marcus

francesco_menin
Partner - Creator III
Partner - Creator III
Author

It's really too bad, I think that the user created reports are "lost" in the Shared file then...

marcus_sommer

Maybe the power tools are helpful for you: Power Tools for QlikView now available

- Marcus

Peter_Cammaert
Partner - Champion III
Partner - Champion III

They're not really "lost". It's just that trying to recover user-generated content is a very tedious process at the moment. It would help a lot if Qlik would provide a method to copy-paste entire sheets - including the objects on 'em - in the GUI interface...

Peter

francesco_menin
Partner - Creator III
Partner - Creator III
Author

Thanks, I'm going to look into it!!!!

francesco_menin
Partner - Creator III
Partner - Creator III
Author

And it looks like the PDF Reports are entirely a different software from Qlik though it's integrated in the GUI, given the fact that there is not an "extended" API support.

marcus_sommer

Yes, you are right - the reports aren't completely integrated in qv and handling them is far away from easy and beautiful. But you could (manually) export and import reports within the report-properties and you could do a copy & paste per macro. Both I have already done and it made really no fun - but should I do it again I would use export/import and use the possibilty of edit the xml-files manually and then adjust it after an import final again manually.

Here an example which read and copied the most important report-properties:

'###########################################################################################################################################

sub ReportInfo

'Routine um Reports per Makro zu kopieren und dabei auch verschiedene Dinge abzuändern, z.B. die ObjektID's der Reportobjekte

'um somit ähnliche Reports einfach reproduzieren zu können

dim doc, i, j, SourceRep, jRep, iRep, iiRep, arrRep(), arrRepItem(), kRep, arrChangeID, TargetRep

set doc = ActiveDocument

set SourceRep = doc.GetDocReport("RP15")

set jRep = SourceRep.Pages.Item(0)

set iRep = SourceRep.Pages.Item(0).Items

kRep = SourceRep.PrintOptions

Redim arrRep(8)

arrRep(0) = jRep.Landscape

arrRep(1) = jRep.PageMode

arrRep(2) = jRep.Intro.Height

arrRep(3) = jRep.ScaleMode

arrRep(4) = kRep.MarginTop

arrRep(5) = kRep.MarginBottom

arrRep(6) = kRep.MarginLeft

arrRep(7) = kRep.MarginRight

Redim arrRepItem(iRep.Count, 12)

for i = 0 to iRep.Count - 1

    set iiRep = iRep.Item(i)

    arrRepItem(i, 0) = iiRep.ObjectId

    arrRepItem(i, 1) = iiRep.Rect.Top

    arrRepItem(i, 2) = iiRep.Rect.Left

    arrRepItem(i, 3) = iiRep.Rect.Height

    arrRepItem(i, 4) = iiRep.Rect.Width

    arrRepItem(i, 5) = iiRep.UseFrame

    arrRepItem(i, 6) = iiRep.FrameColor.PrimaryCol

    arrRepItem(i, 7) = iiRep.FrameWidth

    arrRepItem(i, 😎 = iiRep.Clip

    arrRepItem(i, 9) = iiRep.HorizontalAlign

    arrRepItem(i, 10) = iiRep.VerticalAlign

    arrRepItem(i, 11) = iiRep.KeepFontSize

next

'-------------------------------------------------------------------------------------------------------------------------------------------

set TargetRep = doc.GetApplication.CreateEmptyReport

TargetRep.Name = "CopyPastePerRoutine (4)"

TargetRep.ID = "RP95"

TargetRep.Comment = "change objectid and other things"

kRep = TargetRep.PrintOptions

kRep.MarginTop = arrRep(4)

kRep.MarginBottom = arrRep(5)

kRep.MarginLeft = arrRep(6)

kRep.MarginRight = arrRep(7)

TargetRep.Pages.Add

TargetRep.Pages.Item(0).Landscape = arrRep(0)

TargetRep.Pages.Item(0).PageMode = arrRep(1)

TargetRep.Pages.Item(0).Intro.Height = arrRep(2)  

TargetRep.Pages.Item(0).ScaleMode = arrRep(3)     

'first 8 items are original ID and the second 8 items are the changed ID

arrChangeID = array("CH10026", "CH10021", "CH10024", "CH10031", "CH10030", "CH10029", "CH10028", "CH10027", "CH10036", "CH10035", "CH10033", "CH10032", "CH10034", "CH10039", "CH10037", "CH10038")

'-------------------------------------------------------------------------------------------------------------------------------------------

for i = 0 to iRep.Count - 1

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

    for j = 0 to ubound(arrChangeID)

        if replace(arrRepItem(i, 0), "Document\", "") = arrChangeID(j) then

            arrRepItem(i, 0) = arrChangeID(j + 😎

            exit for

        end if

    next

    TargetRep.Pages.Item(0).Items.Item(i).ObjectId = arrRepItem(i, 0)

    TargetRep.Pages.Item(0).Items.Item(i).Rect.Top = arrRepItem(i, 1)

    TargetRep.Pages.Item(0).Items.Item(i).Rect.Left = arrRepItem(i, 2)

    TargetRep.Pages.Item(0).Items.Item(i).Rect.Height = arrRepItem(i, 3)

    TargetRep.Pages.Item(0).Items.Item(i).Rect.Width = arrRepItem(i, 4)

    TargetRep.Pages.Item(0).Items.Item(i).UseFrame = arrRepItem(i, 5)

    TargetRep.Pages.Item(0).Items.Item(i).FrameColor.PrimaryCol = arrRepItem(i, 6)

    TargetRep.Pages.Item(0).Items.Item(i).FrameWidth = arrRepItem(i, 7)

    TargetRep.Pages.Item(0).Items.Item(i).Clip = arrRepItem(i, 😎

    TargetRep.Pages.Item(0).Items.Item(i).HorizontalAlign = arrRepItem(i, 9)

    TargetRep.Pages.Item(0).Items.Item(i).VerticalAlign = arrRepItem(i, 10)

    TargetRep.Pages.Item(0).Items.Item(i).KeepFontSize = arrRepItem(i, 11)

next

doc.AddDocReport TargetRep

end sub

'-------------------------------------------------------------------------------------------------------------------------------------------

Maybe within the easter egg are further possibilities, too.

- Marcus

francesco_menin
Partner - Creator III
Partner - Creator III
Author

I went a little bit further in my investigation on this issue and found out a couple of things.

1) QlikView stores user created local reports in %appdata%\Roaming\QlikTech\QlikView\Reports\ in an XML file with the QlikView file name and an UUID.

Technically this one could be moved from a PC to another one, given that the UUID is replaced correctly.

The problem eventually would be replacing the ObjectIDs with new IDs of the session of another PC (as you do in the macro), but I suppose it's possible to export the XML of the original objects and recreate it in the other session and then replace the ObjectIDs with these new IDs.

2) If the user moves the report to the server, the report then is deleted locally and saved in the shared file so it is possible to get the XML only through GUI or Power Tools (SharedFileViewer). Then this report can be shared with any server user but it is impractical to know which user objects were included in the original report and to match the objects manually.

----

As a side note, I wonder if this is in any way related to the difference between the ActiveDocument.PrintDocReport, ActiveDocument.PrintReport and ActiveDocument.PrintUserReport, API functions as well (maybe another topic actually).