How to Remove Empty Line in textframe

Community Beginner ,
Aug 27, 2022 Aug 27, 2022

Copy link to clipboard

Copied

How to remove the empty line for the below text frame if a line break is applied?

 

Text_frame.jpeg

 

Here I have a Single Paragraph for which I have used a line break and here the text alignment is bottom, here I want to remove the last empty line. How can I remove the last empty line using a script?

TOPICS
Scripting

Views

228

Likes

Translate

Translate

Report

Report
Community guidelines
Be kind and respectful, give credit to the original source of content, and search for duplicates before posting. Learn more
community guidelines
Community Expert ,
Aug 27, 2022 Aug 27, 2022

Copy link to clipboard

Copied

Hi @SA8888 ,

You would remove the last line break.

But note, there is contents in the last line. A couple of special characters.

I assume they are of Unicode Code Point FEFF.

So be careful what you remove.

 

Regards,
Uwe Laubender
( Adobe Community Professional )

Likes

Translate

Translate

Report

Report
Community guidelines
Be kind and respectful, give credit to the original source of content, and search for duplicates before posting. Learn more
community guidelines
Community Beginner ,
Aug 27, 2022 Aug 27, 2022

Copy link to clipboard

Copied

Can you help with the scripting solution?

Likes

Translate

Translate

Report

Report
Community guidelines
Be kind and respectful, give credit to the original source of content, and search for duplicates before posting. Learn more
community guidelines
Community Beginner ,
Aug 27, 2022 Aug 27, 2022

Copy link to clipboard

Copied

I'm able to remove the last empty line if there is a paragraph marker at the end of "Text3", but if there is a line break marker at the end of "Text3" I'm not able to remove the last empty line. Can anyone help with the solution with a script?

Likes

Translate

Translate

Report

Report
Community guidelines
Be kind and respectful, give credit to the original source of content, and search for duplicates before posting. Learn more
community guidelines
Community Beginner ,
Aug 27, 2022 Aug 27, 2022

Copy link to clipboard

Copied

I'm able to remove the last line if there is a paragraph marker at the end of  "Text3". I'm not able to remove the last line if there is a line break marker at the end of "Text3". Please help me with this.

Likes

Translate

Translate

Report

Report
Community guidelines
Be kind and respectful, give credit to the original source of content, and search for duplicates before posting. Learn more
community guidelines
Community Beginner ,
Aug 27, 2022 Aug 27, 2022

Copy link to clipboard

Copied

Hi @Laubender I'm able to remove the last empty line  if there is a paragraph marker at the end of "Text3". But if there is a line break marker at the end of "Text3" I'm not able to remove the last empty line. Can you help with this using script?

Likes

Translate

Translate

Report

Report
Community guidelines
Be kind and respectful, give credit to the original source of content, and search for duplicates before posting. Learn more
community guidelines
Community Beginner ,
Aug 27, 2022 Aug 27, 2022

Copy link to clipboard

Copied

I'm able to remove the last empty line if there is a paragraph marker at the end of "Text3", but if there is a line break marker at the end of "Text3" I'm not able to remove the last empty line. Can anyone help with the solution with a script?

Likes

Translate

Translate

Report

Report
Community guidelines
Be kind and respectful, give credit to the original source of content, and search for duplicates before posting. Learn more
community guidelines
Community Beginner ,
Aug 27, 2022 Aug 27, 2022

Copy link to clipboard

Copied

I'm able to remove the last empty line if there is a paragraph marker at the end of "Text3", but if there is a line break marker at the end of "Text3" I'm not able to remove the last empty line. Can anyone help with the solution with a script?

Likes

Translate

Translate

Report

Report
Community guidelines
Be kind and respectful, give credit to the original source of content, and search for duplicates before posting. Learn more
community guidelines
Community Beginner ,
Aug 27, 2022 Aug 27, 2022

Copy link to clipboard

Copied

I'm able to remove the last empty line if there is a paragraph marker at the end of "Text3", but if there is a line break marker at the end of "Text3" I'm not able to remove the last empty line. Can anyone help with the solution with a script?

Likes

Translate

Translate

Report

Report
Community guidelines
Be kind and respectful, give credit to the original source of content, and search for duplicates before posting. Learn more
community guidelines
Community Beginner ,
Aug 28, 2022 Aug 28, 2022

Copy link to clipboard

Copied

Anyone with the solution?

Likes

Translate

Translate

Report

Report
Community guidelines
Be kind and respectful, give credit to the original source of content, and search for duplicates before posting. Learn more
community guidelines
Community Beginner ,
Aug 28, 2022 Aug 28, 2022

Copy link to clipboard

Copied

Is there any solution so I can remove the last empty line? 

Here if there is a paragraph marker at the end of the line "Text3"  I can remove the last empty line, but not able to remove the line if there is a line break marker at the end of "Text3". 

Likes

Translate

Translate

Report

Report
Community guidelines
Be kind and respectful, give credit to the original source of content, and search for duplicates before posting. Learn more
community guidelines
Community Expert ,
Aug 28, 2022 Aug 28, 2022

Copy link to clipboard

Copied

You can try this:

Find \n\x{FEFF}+$ and change to nothing. Do this on a copy for testing ansd removing those caracters may have unexpected consequences.

Likes

Translate

Translate

Report

Report
Community guidelines
Be kind and respectful, give credit to the original source of content, and search for duplicates before posting. Learn more
community guidelines
Community Beginner ,
Aug 28, 2022 Aug 28, 2022

Copy link to clipboard

Copied

Hi @Peter Spier  thank you for the suggestion. Can you please help  using a script.

 

Can we remove the last empty line using the textrange? 

Likes

Translate

Translate

Report

Report
Community guidelines
Be kind and respectful, give credit to the original source of content, and search for duplicates before posting. Learn more
community guidelines
Community Expert ,
Aug 28, 2022 Aug 28, 2022

Copy link to clipboard

Copied

You can't use the story.lines property, because you're not dealing with true lines (\n vs \r). Those 'lines' also aren't empty. So instead use Peter's GREP in your script with some variation of this solution: https://community.adobe.com/t5/indesign-discussions/how-to-find-last-word-lt-8-characters-of-each-pa... 

Likes

Translate

Translate

Report

Report
Community guidelines
Be kind and respectful, give credit to the original source of content, and search for duplicates before posting. Learn more
community guidelines
Community Expert ,
Aug 28, 2022 Aug 28, 2022

Copy link to clipboard

Copied

I'm not a scripter, sorry.

Likes

Translate

Translate

Report

Report
Community guidelines
Be kind and respectful, give credit to the original source of content, and search for duplicates before posting. Learn more
community guidelines
Community Expert ,
Aug 29, 2022 Aug 29, 2022

Copy link to clipboard

Copied

For removing FEFF special characters you can only use Text Find/Change with Find pattern:

<FEFF>

GREP Find is not able to find anything with:

\x{FEFF}

 

But first check if the special chatacters are really FEFF characters.

Select one and go to the Info panel to see the Unicode code points of the selected character(s).

 

Regards,
Uwe Laubender
( Adobe Community Professional )

Likes

Translate

Translate

Report

Report
Community guidelines
Be kind and respectful, give credit to the original source of content, and search for duplicates before posting. Learn more
community guidelines
Community Expert ,
Aug 29, 2022 Aug 29, 2022

Copy link to clipboard

Copied

Hi, Uwe.

I remember that problem now (which is why when I looked up the query it was text, not GREP).

In December of 2013 we had a very long discussion about removing these characters in a long data-merged document that was then to have the text frames stitched into a single thread. The original poster was having a problem with paragraph styles being reassigned during the process. I no longer remember the cause of the style change, but at the time you worked out a script to solve it...

Likes

Translate

Translate

Report

Report
Community guidelines
Be kind and respectful, give credit to the original source of content, and search for duplicates before posting. Learn more
community guidelines
Community Expert ,
Aug 29, 2022 Aug 29, 2022

Copy link to clipboard

Copied

Hi Peter,

yes, I remember this very well!

The whole thread is still available:

 

Multiple record data merge into paragraph styles-applies the wrong style
LinaD36, Nov 22, 2013
https://community.adobe.com/t5/indesign-discussions/multiple-record-data-merge-into-paragraph-styles...

 

However, it could be that some of the code I posted back then was damaged in October 2019 when it was moved over to this new incarnation of the Adobe InDesign User Forum.

 

Regards,
Uwe Laubender
( Adobe Community Professional )

Likes

Translate

Translate

Report

Report
Community guidelines
Be kind and respectful, give credit to the original source of content, and search for duplicates before posting. Learn more
community guidelines
Community Expert ,
Aug 29, 2022 Aug 29, 2022

Copy link to clipboard

Copied

And indeed, here we see damaged code:

https://community.adobe.com/t5/indesign-discussions/multiple-record-data-merge-into-paragraph-styles...

 

Guess, that's also the case with other posts in this long thread as well.

Hope, I find the time to correct that soon. Will add a comment when done.

 

Regards,
Uwe Laubender
( Adobe Community Professional )

Likes

Translate

Translate

Report

Report
Community guidelines
Be kind and respectful, give credit to the original source of content, and search for duplicates before posting. Learn more
community guidelines
Community Expert ,
Aug 29, 2022 Aug 29, 2022

Copy link to clipboard

Copied

I still have a folder full of test files and two scripts from that thread if it will help...

Likes

Translate

Translate

Report

Report
Community guidelines
Be kind and respectful, give credit to the original source of content, and search for duplicates before posting. Learn more
community guidelines
Community Expert ,
Aug 29, 2022 Aug 29, 2022

Copy link to clipboard

Copied

Sorry, only 1 script, the other is the zip archive of it.

Likes

Translate

Translate

Report

Report
Community guidelines
Be kind and respectful, give credit to the original source of content, and search for duplicates before posting. Learn more
community guidelines
Community Expert ,
Aug 29, 2022 Aug 29, 2022

Copy link to clipboard

Copied

My code posted in the linked post below should still work to remove FEFF special characters:

https://community.adobe.com/t5/indesign-discussions/multiple-record-data-merge-into-paragraph-styles...

 

Warning: FEFF special characters are used for a variety of purposes! More on this:

 

Strange symbols when creating text variable
mateuszp13156491, Jul 27, 2022
https://community.adobe.com/t5/indesign-discussions/strange-symbols-when-creating-text-variable/td-p...

 

Regards,
Uwe Laubender
( Adobe Community Professional )

Likes

Translate

Translate

Report

Report
Community guidelines
Be kind and respectful, give credit to the original source of content, and search for duplicates before posting. Learn more
community guidelines
Community Expert ,
Aug 29, 2022 Aug 29, 2022

Copy link to clipboard

Copied

OK.

Seems to me that if all the "blank" lines look like the example in the beginning of this thread, and thwe non-blank lines don't have multiple FEFF characters at the start of the line, it should be sufficient to find the forced line break followed by two FEFF characters: Find ^n<feff><feff> and change to nothing in the text tab. That would move any further FEFF characters and the end of the paragraph/story up to the previous line and would preserve the lines above that start with FEFF but have text immediately after.

Likes

Translate

Translate

Report

Report
Community guidelines
Be kind and respectful, give credit to the original source of content, and search for duplicates before posting. Learn more
community guidelines
Community Expert ,
Aug 29, 2022 Aug 29, 2022

Copy link to clipboard

Copied

LATEST

Well the forum wrapped my text.

Find ^n<feff><feff>

Likes

Translate

Translate

Report

Report
Community guidelines
Be kind and respectful, give credit to the original source of content, and search for duplicates before posting. Learn more
community guidelines

Save time with Adobe Express quick actions