Skip to main content
Robert at ID-Tasker
Legend
August 4, 2024
Question

Words collection is empty in Story with ONLY Tables in separate Paragraphs...

  • August 4, 2024
  • 2 replies
  • 398 views

Looks like a bug to me?

 

Words collection for a Story - or Paragraph - that has ONLY Tables - is empty...

 

 

 

 

 

 

This topic has been closed for replies.

2 replies

rob day
Community Expert
Community Expert
August 5, 2024

Words collection for a Story - or Paragraph - that has ONLY Tables - is empty...

 

The word collection for a story with multiple returns or white spaces also empty.

 

 

var i = app.activeDocument.stories.everyItem().insertionPoints.everyItem().getElements();
$.writeln(i.length)
//returns 15

var w = app.activeDocument.stories.everyItem().words.everyItem().getElements();
$.writeln(w.length)
//returns 0
Robert at ID-Tasker
Legend
August 5, 2024

@rob day

 

Yes, words are build from letters, so empty paragraph or space won't return words.

 

Peter Kahrel
Community Expert
Community Expert
August 4, 2024

Well, depends on how you look at it. From InDesign's perspective it's consistent. A table sits in a placeholder that's dubbed Character, but it's not a character in the sense of a glyph. When you (grep) search . (any character( you won't find anything.

 

The same goes for embedded frames, you get the same results.

Robert at ID-Tasker
Legend
August 4, 2024

But "it occupies some space" in the collection of characters? And even one letter words are words?

 

m1b
Community Expert
Community Expert
August 4, 2024

Conceptually a word is not a "building block" in the same way that character is. If I was writing a word-parser I probably would opt to to treat non-glyph characters as word boundary markers, ie. not part of a word. So my parser would return zero too. 
- Mark