7. What is your gender?
If "Male" skip to item 9.
8. Have you ever been pregnant?
9. What is your age?
I want to be able to insert a cross-reference after the "Male" response linking to paragraph number in item 9.
Any suggestions on how to do this would be greatly appreciated!
To create a cross-reference, you need three things: a cross-reference format, the referenced paragraph, and the insertion point where the reference is to be inserted. You then create a source (a crossReferenceSource, using the xref format), a target (a paragraphDestination), and a hyperlink from the source to the target:
// The cross-reference format (make sure it exists) crFormat = doc.crossReferenceFormats.item ('Paragraph Number'); // The referenced paragraph, in your example, "9. What is your age?" targetParagraph = . . . // some paragraph // The place where the cross-reference should appear in the text, // in your example, after 'If "Male" skip to item ' reference = . . . // some insertion point target = doc.paragraphDestinations.add (targetParagraph); xRef = doc.crossReferenceSources.add (reference, crFormat); doc.hyperlinks.add (xRef, target);
Thanks Peter, that worked perfectly!!!