6 Replies Latest reply: Jun 14, 2012 9:55 AM by Siva Sankar RSS

Exporting Sheets and images to png files.

Matthew Smith

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.





  • Exporting Sheets and images to BMP files.
    Siva Sankar

    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

    • Exporting Sheets and images to png files.
      Matthew Smith

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

      • Exporting Sheets and images to BMP files.
        Siva Sankar

        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

  • Re: Exporting Sheets and images to BMP files.
    Matthew Smith

    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.

  • Re: Exporting Sheets and images to png files.
    Matthew Smith

    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.