Skip to main content
Known Participant
November 16, 2010
Question

Footnote contents

  • November 16, 2010
  • 1 reply
  • 456 views

Hello again,

I'm trying to change the contents of a footnote. To make sure the footnote character is added correctly I tried 2 different ways:

footnote.contents = SpecialCharacters.FOOTNOTE_SYMBOL;

footnote.contents += 'test';

and

footnote.contents = String.fromCharCode(4) + 'test';

but in both cases the footnote symbol is missing after the procedure, but the text is shown correct in the document. Is there something I am missing here or simply a bug?

Thanks.

This topic has been closed for replies.

1 reply

Jongware
Community Expert
Community Expert
November 17, 2010

Are you sure this is not a scripting question?

When scripting, I know that the SpecialCharacters(etc.) solution does not work with 'contents', because that's a plain ASCII string (well, actually Unicode) that cannot contain any special InDesign character at all. The Characters property, on the other hand, can contain special characters (as well as formatting, by the way).

So -- again, when scripting -- to insert this character, I'd use something like

footnote.insertionPoint[0].characters = SpecialCharacters.FOOTNOTE_SYMBOL;

The downside is the conversion does not automatically work in two directions: you cannot put plain text right into characters, so you have to work around that using (yep!) 'contents':

footnote.insertionPoint[1].contents = 'test';

Hope this helps.

PeterPowAuthor
Known Participant
November 17, 2010

Of course, this is a scripting question. Sorry for posting in wrong forum...:)

Anyway, your suggestion was helpful. The following code works like a charm:

        var separator = myDoc.footnoteOptions.separatorText;

        for(var i = footnote.characters.length - 1; i >= 1; i--){
          footnote.characters.item(i).remove();
        }
        footnote.insertionPoints.item(1).contents = separator + 'test';

Thanks!