Qlik Community

QlikView Scripting

Discussion Board for collaboration on QlikView Scripting.

Announcements
QlikView Fans! We’d love to hear from you.
Share your QlikView feedback with the product team… Click here to participate in our 5-minute survey.
Rules, plus terms and conditions, can be found here.
thierrytt
Contributor

export QlikView Objects to *.BMP

Hello,

I have a problem here trying to export QlikView Objects to images.

I developped this macro:

sub Exportation

ActiveDocument.ClearAll

DocSheet = ActiveDocument.Sheets("Sheet").Activate

Objects = ActiveDocument.ActiveSheet.GetSheetObjects

FOR i = lBound(Objects) TO uBound(Objects)

SET obj = Objects(i)

obj.ExportBitmapToFile "C:\ "&i&".bmp"

next

end sub

It works fine but I'd like to:

1. take the objects of every sheets

2. rename the file with the name of the object.

Does anyone can help me?

Thanks a lot.

10 Replies
danielrozental
Honored Contributor II

export QlikView Objects to *.BMP

you can go through all sheets like this  

     for j= 0 to ActiveDocument.NoOfSheets - 1
        set s=ActiveDocument.Sheets(j)

and you can go through all objects in the sheet like this

Objects = s.GetSheetObjects

For i = lBound(Objects) To uBound(Objects)

If you want to use the ID like this, or the title

Object.GetObjectId

Object.GetProperties.Title.v

Not applicable

Re: export QlikView Objects to *.BMP

Hi,

Please see if the attached sample can help you.

Cheers.

thierrytt
Contributor

export QlikView Objects to *.BMP

Dear.


Thnks for yout file but I cannot open it as I'm using the Personal Edition. Could you show me the code? Thank you very much

Not applicable

Re: export QlikView Objects to *.BMP

Hi,

Please find the macro, call this on the click of a button:

sub Exportation()

    ActiveDocument.ClearAll

    for j= 0 to ActiveDocument.NoOfSheets - 1

   

        ActiveDocument.ActivateSheet j

        set s=ActiveDocument.Sheets(j)

        Objects = s.GetSheetObjects

       

        FOR i = 0 TO uBound(Objects)

            SET obj = Objects(i)

            obj.ExportBitmapToFile "C:\Temp\"& replace(obj.GetCaption.Name.v," ","") & ".bmp"       

        next

    

    next

   

    ActiveDocument.ActivateSheet 0

end sub

Cheers.

thierrytt
Contributor

export QlikView Objects to *.BMP

Thank you BlackRockS

However  Qlikview crashes when executing your  code...

Do you have an explanantion as you code seems to be ok?

Thanks

Not applicable

Re: export QlikView Objects to *.BMP

Hi,

I am not sure why it is not working, but for me it works fine.

Cheers.

thierrytt
Contributor

export QlikView Objects to *.BMP

Hi,

This is strange indeed. I made a button "macro" in the first sheet and the result is different when executed from the third... same name, same macro.

I took the qlikview example of "films". Normally it has to display more than 50 objects... I have only 11.

Hope you checked the integrity out as well.

Cheers.

Not applicable

export QlikView Objects to *.BMP

Hi All,

I am trying to use an export macro to get images of specific charts into "BMP" format in order to use them to update links on a PowerPoint presentation.

The macro does work, but there instances where QlikView does not respond quick enough and a blank image gets exported.

Heres the code I am currently using in my macro:

set APP = ActiveDocument.GetApplication

           set c=ActiveDocument.GetSheetObject("CH158")

           APP.WaitForIdle

           c.Restore

           APP.WaitForIdle

            APP.Sleep 1000

           ActiveDocument.ClearAll

           APP.WaitForIdle

           APP.Sleep 1000

           ActiveDocument.RecallDocBookmark "Slide2"

           APP.WaitForIdle

            APP.Sleep 1000

          set obj = ActiveDocument.GetSheetObject("CH158")

          obj.WriteToFile "C:\Insight\PPT Images\MetCash\" & "001 National - National - LAD’s by Manufacturer Share.bmp", 0

           APP.Sleep 1000

          APP.WaitForIdle

It does this for about 10 images. Majority of them are fine, but there are a few that turn up blank now and again.

Any suggestions?

Not applicable

Re: export QlikView Objects to *.BMP

Hi,

I have tested the above macro script for 25 times and it could export the image all the 25 times with out any problem.

How big is the qlikview file? Do you have too many data points in the chart you are trying to export?

Please let me know further details.

Cheers.

Community Browser