Copy link to clipboard
Copied
Hi !
I've been working on this all day and have been able to find only half an answer so I come here full of hope⦠! š
I have a table which I import from Excel. In this table I have empty cells sometimes and I want to put a "-" in them.
I tried this grep request to find the empty spaces : (?<!.)$
Which seems to work, it finds empty spaces in the format I searching when I press "Next"
I tried to "replace" the empty spaces using : $0-
Which, oddly enough, works when I press "Replace" but doesn't when I press "Replace all"
Here is my problem then, how can I make it work all at once ? Since I don't want to replace them all at once⦠^^''
Thanks in advance !
It ought to be as easy as Find: $ and Change to: - ... but it's not.
You may find interesting this thread. Don't bother with the answer marked as 'correct', look for Jongware's posts 6 and maybe 14.
Didn't try it myself, though.
Copy link to clipboard
Copied
It ought to be as easy as Find: $ and Change to: - ... but it's not.
You may find interesting this thread. Don't bother with the answer marked as 'correct', look for Jongware's posts 6 and maybe 14.
Didn't try it myself, though.
Copy link to clipboard
Copied
Hi
This is an interesting puzzler.
Like winterm said before, you probably need a script to achieve this.
I haven't tested Jongware's script either, but I'm sure it would do the job...
Although, I would like to share a few thoughts :
For Each cel In Range("A1:Z200") //Don't forget to adjust your Range
If IsEmpty(cel.Value) Then cel.Value = "-"
Next
So, if you use linked file, it could be an acceptable solution.
Copy link to clipboard
Copied
Point 1. Macros in Excel still aren't my friends, couldn't comment.
Point 2. I must confess I also considered (silently) this trick, but found it too drastic and didn't dare to share... Hey man, you're the brutal beast!
Point 3. Ha! Again, we think alike! Also played this all (incl. clipboard contents), and got identical results. So could only confirm here.
Jongware's script is the way to go, imo.
Copy link to clipboard
Copied
Theun is right here!
Place the cursor in any cell! Short version:
var a = app.selection[0].parent.parent, b = a.cells, c = b.length;
while (c--) if (b
.contents.length == 0) b .contents = "-";
(^/)
Copy link to clipboard
Copied
Jongware's script is the way to go, imo.
Well, that's definitely true!
Copy link to clipboard
Copied
Use "^$" without the Quotes.
Note: If you hit the "Find Next" button it will say it cannot find a match. Hit the "Change All" and it will work. At least it does for me.
Copy link to clipboard
Copied
FWIW:
With the current versions of InDesign, e.g. InDesign 2021 and 2022 the following will work:
GREP Find pattern:
^\Z
GREP Change:
-
No issue to find the first instance, then do change and find next.
No need to do Change All.
Regards,
Uwe Laubender
( Adobe Community Professional )
Copy link to clipboard
Copied
A warning:
GREP will not recognize the special character that makes a Table object!
So, if you do a Change All the pattern "Find the beginning of a story, its first text insertion point, or the beginning of a table's text cell, the first insertion point in that cell, followed by the end of the story or the end of the text of a table cell" will also find the insertion point after that table and add a - after the table that is positioned in an otherwise empty text frame.
Regards,
Uwe Laubender
( Adobe Community Professional )
Copy link to clipboard
Copied
Running the latest version of InDesign and this (^\Z) only works with the Change All button for me, just the same as using match End of Line ($).
Copy link to clipboard
Copied
Copy link to clipboard
Copied
Copy link to clipboard
Copied
Thanks @TheAngryPorge ,
well, I also have some issues with your document looking for empty cells.
But this changed as soon as I switched the scope of the search from Document to Selection when I selected some of the table rows. Strange indeedā¦
Regards,
Uwe Laubender
( Adobe Community Professional )
Copy link to clipboard
Copied
Indeed, it does seem to work with the scope changed to story or selection, but only when I had an insertion point in a cell and not with just the table selected. Just for giggles I tried ^$ using both scopes and it worked as well if having the insertion in the table.
Copy link to clipboard
Copied
Also had this:
Had my Find scope set on Document.
Pressed the button for Find.
Message was: Nothing found.
Next I clicked Change All and over 1245 instances were reported found and changed.
Regards,
Uwe Laubender
( Adobe Community Professional )