/// <summary> /// Create XML tags in the indd file, /// and mark up the text and style of indd file with special xml tags. /// </summary> private void MarkupInddFile() { // Get root element of the document. InDesign.XMLElements elements = (InDesign.XMLElements)m_inDesignDoc.XMLElements; InDesign.XMLElement rootElm = (InDesign.XMLElement)elements.FirstItem(); // Get all stories in current document. InDesign.Stories stories = m_inDesignDoc.Stories; int storyCount = stories.Count; InDesign.Story story = null; for (int i = 0; i < storyCount; i++) { if (i == 0) { story = (InDesign.Story)stories.FirstItem(); } else { story = (InDesign.Story)stories.NextItem(story); } MarkupInddStory(rootElm, story); } }
/// <summary> /// Unmark up the special xml tags with the text and style of indd file . /// </summary> private void UnmarkInddFile() { InDesign.XMLElement root = (InDesign.XMLElement)m_inDesignDoc.XMLElements.FirstItem(); InDesign.XMLElements elmts = null; InDesign.XMLElement elm = null; InDesign.XMLTag tag = null; tag = (InDesign.XMLTag)root.MarkupTag; elmts = root.XMLElements; for (int i = elmts.Count; i > 0; i--) { elm = (InDesign.XMLElement)elmts.FirstItem(); IterateXmlElement(elm); } }