Skip to main content
cancel
Showing results for 
Search instead for 
Did you mean: 
Not applicable

[Macro] why it is different lacation between qv-server and desktop client

Hello everybody,

     Thanks for you look at this question.

     I meet a problem in Qlikview macro.

     I have been built a macro in Qlikview desktop,which used to Create Text object when i need to add.

     The source like that:

function ReloadIcon(TextobjectID,countcar)

    rem **根據數據創建文本對象**

    rem **獲取所需要創建文本對象的數量**

    set bosstable=ActiveDocument.GetSheetObject("DataFC001")

    set sumcarcell=bosstable.GetCell(1,bosstable.GetColumnCount-1)

    sumcar=Cint(sumcarcell.text)

   

    for i=2 to sumcar+1

        rem **創建TextBoxObject**

        set Forion=ActiveDocument.Sheets("Main").CreateTextObject

        rem **設置圖片屬性**

        set ObjPro=Forion.GetProperties

        ObjPro.Layout.BkgImageSettings.HorizontalAdjust=1 'center

        rem **設置顯示的圖片**

        if bosstable.GetCell(i,8).text="載貨中" then

            ObjPro.Layout.Text.v="='d:\RiocasGuan\Desktop\icon_auto\working.png'"

        elseif bosstable.GetCell(i,8).text="休息中" then

            ObjPro.Layout.Text.v="='d:\RiocasGuan\Desktop\icon_auto\rest.png'"

        else

            ObjPro.Layout.Text.v="='d:\RiocasGuan\Desktop\icon_auto\broken.png'"

        end if

        ObjPro.Layout.ImageRepresentation.Presentation=1

        ObjPro.Layout.ImageRepresentation.Fallback=0

       

        rem  **設置透明度**

        ObjPro.Layout.BkgColor.Alpha=0   

       

        rem **設置對象ID**

        ObjPro.Layout.Frame.ObjectID=CStr("TXB"&(i-1))

        TextobjectId(i-2)=CStr("TXB"&(i-1))

        rem **應用配置**

        Forion.SetProperties ObjPro

       

        rem **記錄已創建叉車數量總數**

        countcar=countcar+1

       

        rem **定義圖標大小以及位置**

        pos=Forion.GetRect

        pos.Top=CInt(bosstable.GetCell(i,1).text)

        pos.Left=bosstable.GetCell(i,2).text

        pos.Width=20

        pos.Height=20

        Forion.setRect pos

       

       

    next

end function

end function

it     

     This macro run well in qlikview desktop,but  it will change lacation when run in server (QMEC),

     for exemple,i wanna one textobject pos-x=100,pos-x=200,width=20,height=20,it will become to pos-x=122,pos-y=156,width=6,height=6.

     So what can i do to fix it ,get a normal value what i want?

    

     I'm sorry for my rookie english.

Hope to get the answer.

2 Replies
Not applicable
Author

I'm sorry for the  bad design of qlik site.When i write the question,i write code in html tool of qlikview site,but they change all after  published!

Peter_Cammaert
Partner - Champion III
Partner - Champion III

If you use macros to display a QlikView Server document, then you won't be able to change either the size or the position of any sheet or object in your document. That's how QlikView Server works.

See the first bullet in the second bullet list of paragraph "Macro functionality limitations" in Using Macros in QV Documents on the QV-Server ‒ QlikView