Unlock a world of possibilities! Login now and discover the exclusive benefits awaiting you.
Hi There,
Have list of text box arranged horizontally. Based on condition, I need to hide one of text box and re-arrange itself to fill hidden text object. Can this be achieved through Macro?
eg.,
If vShow=1
Text 1 - Text 2 - Text 3 - Text 4
if vShow = 2
Text 1 - Text 2 - Text 4
Notice the Text 3 is hidden and Text 4 gets re positioned to follow Text 2
We can hide Text Objects through layout properties Show > Condition. But how do we change position of the other text box?
So thought of using Macro completely to hide and re-position. If found following API would help to re-position text object.
What is the API that would allow us to hide a text object?
Sub repositionTextObj
set txtObj = ActiveDocument.GetSheetObject( "TX01" )
set grapos = txtObj.GetRect
grapos.Left = 300
txtObj.SetRect grapos
End Sub
Do we have API to access textbox object Show > Conditionally property?
set obj = ActiveDocument.GetSheetObject(strNewObjectID)
set prop = obj.GetProperties
prop.Layout.Frame.Show.Expression.v = Your condition here
obj.SetProperties prop
set obj = ActiveDocument.GetSheetObject(strNewObjectID)
set prop = obj.GetProperties
prop.Layout.Frame.Show.Expression.v = Your condition here
obj.SetProperties prop
Thanks Mike. I tried following and it works.
Set FD = TxtObj.GetFrameDef
FD.Show.Always = False
FD.Show.Expression.v = "1 = 2"
TxtObj.SetFrameDef FD
Now I have following questions
1) As I am not familiar with VB scripts, I tried Java Script (Edit Module > Scripting Engine > JScript) with following test code. It always fails saying 'Qv' is undefined. Any idea?
Init = function() {
var doc = Qv.GetCurrentDocument();
var txt = doc.GetObject("TX001");
alert(txt.GetText());
}
Reference for JScript API JsDoc Reference - Qv