Skip to main content
Announcements
Qlik Connect 2024! Seize endless possibilities! LEARN MORE
cancel
Showing results for 
Search instead for 
Did you mean: 
Not applicable

Export a sheet with an vbs file from API

I am using this vbs code to export the entire sheet to an bmp image

CONST QvDoc = "C:\DoImageExport2.qvw"
CONST QvObj = "SH01"
CONST ImagePath = "C:\MyExportedImage2.bmp"
Call DoImageExport(QvDoc, QvObj, ImagePath)
Sub DoImageExport(QvDoc, QvObj, ImagePath)
Set objQvApp = CreateObject("QlikTech.QlikView")
Set objQvDoc = objQvApp.OpenDoc(QvDoc)
Set objQvObj = objQvDoc.ActivateSheet(QvObj)
objQvObj.ExportBitmapToFile ImagePath
objQvDoc.CloseDoc
objQvApp.Quit
End Sub

But the image does not contain any data only the sheet and and empty graph. Has anyone an idea ?
Or does anyone have an working vbs API example to export an sheet with objects and data on it ?

I want to use the function in qv under File-> Export -> Export Sheet Image

thanx for any replies
(I am using QV 9.00.7440.8 SR3 64-bit)

regards
// Daniel

5 Replies
Not applicable
Author

You can try this;

ActiveDocument.Sheets("Main").ExportBitmapToFile "C:\MyImage.bmp"

Regards



Not applicable
Author

Hi Rajesh

Well I am using that function in the script if you look a bit closer.
The problem is that there is no data on the sheet only empty graphs and the sheet itself.

// Daniel

Not applicable
Author

Dear all

when we fatch image with the help of this macro the image are crouching

Please help me

Regards

ashish

Not applicable
Author

Hi All

I want for your help urgent basic.

Regards

Ashish

Not applicable
Author

Hi

I managed to solve this problem. My was relates to delays..
- QV needs som time to load the data before I can do any export of any images.

save this file below as an.vbs file and execute it with cscript.exe %YourFileName%.vbs

CONST QvDoc = "C:\test.qvw"
CONST QvObj = "SH01"
CONST ImagePath = "C:\Image.bmp"
Call DoImageExport(QvDoc, QvObj, ImagePath)
Sub DoImageExport(QvDoc, QvObj, ImagePath)
Set objQvApp = CreateObject("QlikTech.QlikView")
Set objQvDoc = objQvApp.OpenDoc(QvDoc)
WScript.sleep 1000
Set objQvObj = objQvDoc.ActivateSheet(QvObj)
objQvObj.ExportBitmapToFile ImagePath
objQvDoc.CloseDoc
objQvApp.Quit
End Sub

If there is anyone with an example howto change the screen resolution in the script then please let me know.
I need to export the image in 800x600 resolution.
// Daniel