Skip to main content
Known Participant
July 11, 2008
Question

How to group one or more textFrames

  • July 11, 2008
  • 6 replies
  • 966 views
Hi All:
There are two textFrames(textFrame1,textFrame2) in my page,I want to
group the two textFrames.The code is like this (vb.net):

Dim Ary(1)
Ary.SetValue(textFrame1,0)
Ary.SetValue(textFrame2,1)
Dim myGroup As InDesignServer.Group = oDocument.Groups.Add(Ary)

The error is: Invalid Paramer.

Any suggestion? Thanks
This topic has been closed for replies.

6 replies

Known Participant
July 17, 2008
Resolved it.
May 5, 2010

Would you please share how you resolved this problem? Been pulling my hair out for a couple of hours on this one. All the samples I find out there are either for old VBScript or older VB.Net that still liked using arrays.

I had to convert lots of code to the new methodology when CS3 came out, but until now all my usage involed only arrays of integers or doubles, not arrays of Indesign objects.

MANY thanks if you can help.

Known Participant
July 16, 2008
oh,yes,I forgot to add the textFrames to the array.
But how can I do this in VB.net?My code is like this:
Dim myDocument As InDesignServer.Document = oApp.Open("c:/test.indd")
Dim page1 As InDesignServer.Page = myDocument.Pages.Item(1)
Dim textFrame1 As InDesignServer.TextFrame = page1.TextFrames.Item(1)
Dim textFrame2 As InDesignServer.TextFrame = page1.TextFrames.Item(2)
Dim myObjectList(1)
myObjectList.SetValue(textFrame1, 0)
myObjectList.SetValue(textFrame2, 1)
Dim myGroup = myDocument.Groups.Add(myObjectList)//here, it said Unable to cast object of type 'System.Object[]' to type 'InDesignServer.Objects'

What should I define myObjectList?
Inspiring
July 16, 2008
Your array is empty. Try:

var myObjectList = new Array(textFrame1, textFrame2);

Dave
Known Participant
July 16, 2008
Hi:
my javascript code is like this
var myDocument = app.open("c:/test.indd")
var page1 = myDocument.pages.item(0)
var textFrame1 = page1.textFrames.item(0)
var textFrame2 = page1.textFrames.item(1)
var myObjectList = new Array

var myGroup = myDocument.groups.add(myObjectList) //here, it said invalid paramer.
How can I do with this?
Thanks
Known Participant
July 14, 2008
Yes, I can group the textFrames in js, but I tried that in VB, the above error appeared. Any help?Thanks
Loic.Aigon
Legend
July 11, 2008
Hi, don't know VB but in JS you create a group first then add object to the group. Maybe that's the same for VB ? Hope it helps.