Skip to main content
Known Participant
November 19, 2010
Question

I am not able to access empty paragraphs

  • November 19, 2010
  • 1 reply
  • 362 views

I have problem in VBScript with accessing paragraphs with no contents inside of table cells.

Here is a snippet of my code (Row is the table row I am working on):

For Each Cell in Row.Cells

   For Each Paragraph In Cell.Paragraphs

      ' Do something with Paragraph

   Next

Next

This only gives me the paragraphs which contain some text. If they are empty, I don't get access to them at all (Cell.Paragraphs.Count = 0). When I have the document in InDesign, each cell does have a paragraph style inside of if, and I only have to write one character in the cell to get it to work, but as soon as I delete the last character, the paragraph becomes inaccessible from the script.

My aim is to replace the text within each paragraph with content from a database no matter what the paragraph might already contain. I cannot just create new paragraphs, because I use the paragraph style of the existing paragraphs to determine what text from the database goes where.

This topic has been closed for replies.

1 reply

FrankB62Author
Known Participant
November 19, 2010

PS: The thing which is important is that I can identify what paragraph style is applied inside the table cell (and there is one). If I know that, then I can create a new paragraph, apply the style, and fill in the contents from the database.

FrankB62Author
Known Participant
November 19, 2010

Okay, I think I got a solution. If I set Cell.Contents = "some text", then it creates a paragraph with the already applied style, and I can then use that to fill in the correct text. It does seem like a workaround though.