Jump to content

suppress text wrap on graphic frame if empty


Recommended Posts

You can't directly determine when a text frame is empty, but, in OnRecordStart, you can test whether whatever field or rule you're inserting into the frame is empty, and if so, turn off text wrap.

Something like:

if (!Field("YourFieldName"))
    FindTextFrame("YourFrameName").textWrap = false;

Or, more succinctly:

FindTextFrame("YourFrameName").textWrap = !!Field("YourFieldName");

 

Link to comment
Share on other sites

Hi Rick, you mean, don't wrap text around a picture if the graphic frame is empty, right?

To do this, first give the text frame a name such as "TheTextFrame" in the frame properties dialog box.

Then make a new OnRecordStart rule (or add to one if you have one.)

if (Len(Field("TheGraphic")) == 0)
{
  TextFrame = FindTextFrame("TheTextFrame");
  TextFrame.textWrap.textWrap =false;
}

 

Replace "TheGraphic" with the name of the field that if empty triggers the text to not wrap. Let me know if this works.

 

Link to comment
Share on other sites

3 minutes ago, Dan Korn said:

You can't directly determine when a text frame is empty, but, in OnRecordStart, you can test whether whatever field or rule you're inserting into the frame is empty, and if so, turn off text wrap.

Something like:

if (!Field("YourFieldName"))
    FindTextFrame("YourFrameName").textWrap = false;

Or, more succinctly:

FindTextFrame("YourFrameName").textWrap = !!Field("YourFieldName");

 

Thank you, I'll give it a go.

Link to comment
Share on other sites

4 minutes ago, Douglas Cogan said:

Hi Rick, you mean, don't wrap text around a picture if the graphic frame is empty, right?

To do this, first give the text frame a name such as "TheTextFrame" in the frame properties dialog box.

Then make a new OnRecordStart rule (or add to one if you have one.)

if (Len(Field("TheGraphic")) == 0)
{
  TextFrame = FindTextFrame("TheTextFrame");
  TextFrame.textWrap.textWrap =false;
}

 

Replace "TheGraphic" with the name of the field that if empty triggers the text to not wrap. Let me know if this works.

 

Great! Thank you, I'll give it a shot!

Link to comment
Share on other sites

3 hours ago, Douglas Cogan said:

Hi Rick, you mean, don't wrap text around a picture if the graphic frame is empty, right?

To do this, first give the text frame a name such as "TheTextFrame" in the frame properties dialog box.

Then make a new OnRecordStart rule (or add to one if you have one.)

if (Len(Field("TheGraphic")) == 0)
{
  TextFrame = FindTextFrame("TheTextFrame");
  TextFrame.textWrap=false;
}

 

Replace "TheGraphic" with the name of the field that if empty triggers the text to not wrap. Let me know if this works.

 

So yes, text needs to wrap around a graphic frame which I given it a resource file. This code works perfectly with a text wrap but not a graphic frame wrap.

Link to comment
Share on other sites

Hi Rick, sorry that didn't work. I did see a typo where I put .textWrap twice in my note above.

I don't quite know what you mean that it doesn't work with a graphic frame wrap. What can we use to determine if the graphic frame would be empty? That's what I was putting in the "if" statement above.  What data values can we test to determine the frame would end up empty? We just need to put that in the if clause of the expression in OnRecordStart and we're set.

Link to comment
Share on other sites

Join the conversation

You can post now and register later. If you have an account, sign in now to post with your account.
Note: Your post will require moderator approval before it will be visible.

Guest
Reply to this topic...

×   Pasted as rich text.   Paste as plain text instead

  Only 75 emoji are allowed.

×   Your link has been automatically embedded.   Display as a link instead

×   Your previous content has been restored.   Clear editor

×   You cannot paste images directly. Upload or insert images from URL.

×
×
  • Create New...