Skip to main content
Announcements
Have questions about Qlik Connect? Join us live on April 10th, at 11 AM ET: SIGN UP NOW
cancel
Showing results for 
Search instead for 
Did you mean: 
Not applicable

Exporting Sheets and images to png files.

Hi I was looking for some help on exporting sheets and images to Bmp files.

I am using the below code but this only seems to work if i run the reload on the sheet i want to export, if i am on a different sheet i get a blank white image exported.

Below is my code.

 

ActiveDocument.GetSheetObject("CH23").ExportBitmapToFile "
xxxxxxx\OpenCallsChart.png"

  ActiveDocument.Sheets("SH07").ExportBitmapToFile "
xxxxxxxx\CallsChart.png"

ActiveDocument.Sheets("SH10").ExportBitmapToFile \\xxxxxx\TodaysCalls.png .

I am using Qlikview 11.

Any help would be appreciated.





1 Solution

Accepted Solutions
Not applicable
Author

I have managed to get this working now. I done it by using a series of triggers on startup to activate certain sheets, these sheets then had a macro on a trigger which executed when the sheet was opened which exported the image to a PNG file. If anyone else has a simular error i would be happpy to help.

View solution in original post

7 Replies
Siva_Sankar
Master II
Master II

Try something like below.. instead of  ActiveDocument.GetSheetObject("CH23").ExportBitmapToFile try using CopyBitmapToClipboard.   code sample below:  ‘'defining Macro name sub Export_to_Microsoft_Word       'setting the object as Word and creating the application set objWord = CreateObject("Word.Application")  objWord.visible = false set objDoc=objWord.Documents.add Const wdOrientLandscape = 1 'setting the orientation for MS Word objDoc.PageSetup.Orientation = wdOrientLandscape 'instructing the Macro to copy the Table object(TB01) ActiveDocument.GetSheetObject("TB01").CopyTableToClipboard true objWord.Selection.Paste 'Instructing the Macro to save the file in a particular location objDoc.SaveAs "D:\EmpSalaryReport" 'instructing the Macro to copy the Chart object(CHO1) ActiveDocument.GetSheetObject("CH01").CopyBitmapToClipboard objWord.Selection.Paste objDoc.SaveAs "D:\EmpSalaryReport" end sub   hope it helps  regards. siva

Not applicable
Author

I have tryed the above code, but when i reload i dont get any output at all. Any ideas?

Siva_Sankar
Master II
Master II

try the following...  sub printsheet set objWord = CreateObject("Word.Application") ' Define Object objWord.visible = true set objDoc=objWord.Documents.add Const wdOrientLandscape = 1 objDoc.PageSetup.Orientation = wdOrientLandscape ActiveDocument.ActiveSheet.CopyBitmapToClipboard false objWord.Selection.Paste end sub       Click Check to validate       Click test to run and click ‘ok’ button.      Return to the “Table and Chart” page.      Click the Export button to export the all objects into word.      You can edit the above code so that you can export selective objects to Word Document. Example:                        ActiveDocument.GetSheetObject("Visual Information of Salary Details ").CopyBitmapToClipboard  This will give export only the chart to Word Document

Not applicable
Author

I was more looking for code to export the images when the QV file is run as a batch job, as I want the files to be exported out without user intervention on a schedule.

Not applicable
Author

I have managed to get this working now. I done it by using a series of triggers on startup to activate certain sheets, these sheets then had a macro on a trigger which executed when the sheet was opened which exported the image to a PNG file. If anyone else has a simular error i would be happpy to help.

Siva_Sankar
Master II
Master II

could u please post the qvw if possible it may help others?

Not applicable
Author

Hi Matthew Smith,

Can you please post the qvw. I am facing a similar kind of issue.

Thanks in advance.