Do not input private or sensitive data. View Qlik Privacy & Cookie Policy.
Skip to main content

Announcements
Join us to spark ideas for how to put the latest capabilities into action. Register here!
cancel
Showing results for 
Search instead for 
Did you mean: 
Not applicable

Stylistics: "batch" paste gradient

Hi,

I am playing around with the visual aspect of an application. I have a whole bunch of little text objects on a sheet, and to make the sheet more visually appealing, I want to add some light gradient to the bg color of the text objects. The problem is that I will be changing the gradient settings A LOT, and it seems pointless to spend an hour on manually "pasting gradient" for each one of these text objects.

I tried to go the Theme route, but there is a problem: the color of each text object is pulled from the database, and applying the theme just overwrites the set analysis required to grab the correct color. Unless there is a way to just limit the Theme to the gradient settings, rather than the whole set of Background settings?

Any help is appreciated.

Thanks!

1 Solution

Accepted Solutions
Not applicable
Author

I was able to solve this problem by learning how to write macros

For those of you, who run into a similar issue, the following macro loops through the active objects and changes the properties. Modify accordingly, of course.

sub SetGradient

    objs = ActiveDocument.ActiveSheet.GetActiveSheetObjects


    for i = lBound(objs) to uBound(objs)         ' loop through all active objects

        set aObj = objs(i)                       ' grab one object at a time

        prop = aObj.GetProperties                ' store the original properties

        prop.Layout.BkgColor.Luminosity = 75     ' set gradient to black

        prop.Layout.BkgColor.Mode = 1            ' set 1-color gradient

        prop.Layout.BkgColor.FillDirection = 0   ' set horizontal orientation

        prop.Layout.BkgColor.FillPattern = 0     ' set light to dark pattern

        aObj.SetProperties prop                  ' set the modified properties to the object


    next

end sub

View solution in original post

1 Reply
Not applicable
Author

I was able to solve this problem by learning how to write macros

For those of you, who run into a similar issue, the following macro loops through the active objects and changes the properties. Modify accordingly, of course.

sub SetGradient

    objs = ActiveDocument.ActiveSheet.GetActiveSheetObjects


    for i = lBound(objs) to uBound(objs)         ' loop through all active objects

        set aObj = objs(i)                       ' grab one object at a time

        prop = aObj.GetProperties                ' store the original properties

        prop.Layout.BkgColor.Luminosity = 75     ' set gradient to black

        prop.Layout.BkgColor.Mode = 1            ' set 1-color gradient

        prop.Layout.BkgColor.FillDirection = 0   ' set horizontal orientation

        prop.Layout.BkgColor.FillPattern = 0     ' set light to dark pattern

        aObj.SetProperties prop                  ' set the modified properties to the object


    next

end sub