Do not input private or sensitive data. View Qlik Privacy & Cookie Policy.
Skip to main content

Announcements
Qlik Open Lakehouse is Now Generally Available! Discover the key highlights and partner resources here.
cancel
Showing results for 
Search instead for 
Did you mean: 
Not applicable

Macro for exporting object as jpg

Hi,

I need a simple macro for exporting objects to a .jpg. Customer needs to publish objects on a Intranet (EPiServer)...

Something like this would be helpful:

sub ExportBitmapToFile
GraphPath = "X:\Development\Export\"
ActiveDocument.GetSheetObject( "CH115").ExportBitmapToFile GraphPath & "B.jpg"
ActiveDocument.GetSheetObject( "CH116").ExportBitmapToFile GraphPath & "C.jpg"
end sub

But this doesn't wotk, and I'm not a developer...

Thanks!

Best regards

Torbjörn Ungvall (@Ungvall)

Senior Business Discovery Manager @ Advectas AB

1 Solution

Accepted Solutions
stephencredmond
Partner - Specialist II
Partner - Specialist II

Hi Torbjörn,

I pasted your code into a demo document, change the path and the CH numbers and it worked for me!

Is the path OK?  Write Access, etc?  Can you manually export the images by right-clicking on the chart to that location?


Regards,

Stephen

View solution in original post

3 Replies
stephencredmond
Partner - Specialist II
Partner - Specialist II

Hi Torbjörn,

I pasted your code into a demo document, change the path and the CH numbers and it worked for me!

Is the path OK?  Write Access, etc?  Can you manually export the images by right-clicking on the chart to that location?


Regards,

Stephen

Not applicable
Author

Hm...

Had to change the path and rewrite end sub - then it worked...

Thanks!

Best regards

Torbjörn Ungvall (@Ungvall)

Senior Business Discovery Manager @ Advectas AB

Alexander_Thor
Employee
Employee

You could write up a vbscript like this,

set Qv = CreateObject("QlikTech.QlikView")
set Doc = Qv.OpenDoc ("C:\test.qvw","","")

Doc.GetSheetObject("CH01").ExportBitmapToFile"C:\B.jpg"
Doc.GetSheetObject("CH02").ExportBitmapToFile"C:\C.jpg"

Schedual it in windows. You might also need to add a Desktop folder to C:\Windows\SysWOW64\config\systemprofile\ to workaround the head less session issue.

Be aware that this will consume a CAL.