public abstract class Inline extends Node
To learn more, visit the Logical Levels of Nodes in a Document documentation article.
Remarks:
A class derived from Inline can be a child of Paragraph.
Examples:
Shows how to determine the revision type of an inline node.
Document doc = new Document(getMyDir() + "Revision runs.docx");
// When we edit the document while the "Track Changes" option, found in via Review -> Tracking,
// is turned on in Microsoft Word, the changes we apply count as revisions.
// When editing a document using Aspose.Words, we can begin tracking revisions by
// invoking the document's "StartTrackRevisions" method and stop tracking by using the "StopTrackRevisions" method.
// We can either accept revisions to assimilate them into the document
// or reject them to change the proposed change effectively.
Assert.assertEquals(6, doc.getRevisions().getCount());
// The parent node of a revision is the run that the revision concerns. A Run is an Inline node.
Run run = (Run) doc.getRevisions().get(0).getParentNode();
Paragraph firstParagraph = run.getParentParagraph();
RunCollection runs = firstParagraph.getRuns();
Assert.assertEquals(runs.getCount(), 6);
// Below are five types of revisions that can flag an Inline node.
// 1 - An "insert" revision:
// This revision occurs when we insert text while tracking changes.
Assert.assertTrue(runs.get(2).isInsertRevision());
// 2 - A "format" revision:
// This revision occurs when we change the formatting of text while tracking changes.
Assert.assertTrue(runs.get(2).isFormatRevision());
// 3 - A "move from" revision:
// When we highlight text in Microsoft Word, and then drag it to a different place in the document
// while tracking changes, two revisions appear.
// The "move from" revision is a copy of the text originally before we moved it.
Assert.assertTrue(runs.get(4).isMoveFromRevision());
// 4 - A "move to" revision:
// The "move to" revision is the text that we moved in its new position in the document.
// "Move from" and "move to" revisions appear in pairs for every move revision we carry out.
// Accepting a move revision deletes the "move from" revision and its text,
// and keeps the text from the "move to" revision.
// Rejecting a move revision conversely keeps the "move from" revision and deletes the "move to" revision.
Assert.assertTrue(runs.get(1).isMoveToRevision());
// 5 - A "delete" revision:
// This revision occurs when we delete text while tracking changes. When we delete text like this,
// it will stay in the document as a revision until we either accept the revision,
// which will delete the text for good, or reject the revision, which will keep the text we deleted where it was.
Assert.assertTrue(runs.get(5).isDeleteRevision());
| Constructor and Description |
|---|
Inline() |
| Modifier and Type | Method and Description |
|---|---|
void |
clearRunAttrs() |
java.lang.Object |
fetchInheritedRunAttr(int fontAttr) |
java.lang.Object |
getDirectRunAttr(int key) |
java.lang.Object |
getDirectRunAttr(int key,
int revisionsView) |
DocumentBase |
getDocument_IInline() |
Font |
getFont()
Provides access to the font formatting of this object.
|
Paragraph |
getParentParagraph_IInline() |
Paragraph |
getParentParagraph()
Retrieves the parent
Paragraph of this node. |
boolean |
isDeleteRevision()
Returns true if this object was deleted in Microsoft Word while change tracking was enabled.
|
boolean |
isFormatRevision()
Returns true if formatting of the object was changed in Microsoft Word while change tracking was enabled.
|
boolean |
isInsertRevision()
Returns true if this object was inserted in Microsoft Word while change tracking was enabled.
|
boolean |
isMoveFromRevision()
Returns
true if this object was moved (deleted) in Microsoft Word while change tracking was enabled. |
boolean |
isMoveToRevision()
Returns
true if this object was moved (inserted) in Microsoft Word while change tracking was enabled. |
void |
removeMoveRevisions() |
void |
removeRunAttr(int key) |
void |
setRunAttr(int key,
java.lang.Object value) |
accept, deepClone, getAncestor, getAncestor, getCustomNodeId, getDocument, getNextSibling, getNodeType, getParentNode, getPreviousSibling, getRange, getText, isComposite, memberwiseClone, nextPreOrder, nodeTypeToString, previousPreOrder, remove, setCustomNodeId, toString, toString, toString, visitorActionToBoolpublic Paragraph getParentParagraph()
Paragraph of this node.
Examples:
Shows how to determine the revision type of an inline node.
Document doc = new Document(getMyDir() + "Revision runs.docx");
// When we edit the document while the "Track Changes" option, found in via Review -> Tracking,
// is turned on in Microsoft Word, the changes we apply count as revisions.
// When editing a document using Aspose.Words, we can begin tracking revisions by
// invoking the document's "StartTrackRevisions" method and stop tracking by using the "StopTrackRevisions" method.
// We can either accept revisions to assimilate them into the document
// or reject them to change the proposed change effectively.
Assert.assertEquals(6, doc.getRevisions().getCount());
// The parent node of a revision is the run that the revision concerns. A Run is an Inline node.
Run run = (Run) doc.getRevisions().get(0).getParentNode();
Paragraph firstParagraph = run.getParentParagraph();
RunCollection runs = firstParagraph.getRuns();
Assert.assertEquals(runs.getCount(), 6);
// Below are five types of revisions that can flag an Inline node.
// 1 - An "insert" revision:
// This revision occurs when we insert text while tracking changes.
Assert.assertTrue(runs.get(2).isInsertRevision());
// 2 - A "format" revision:
// This revision occurs when we change the formatting of text while tracking changes.
Assert.assertTrue(runs.get(2).isFormatRevision());
// 3 - A "move from" revision:
// When we highlight text in Microsoft Word, and then drag it to a different place in the document
// while tracking changes, two revisions appear.
// The "move from" revision is a copy of the text originally before we moved it.
Assert.assertTrue(runs.get(4).isMoveFromRevision());
// 4 - A "move to" revision:
// The "move to" revision is the text that we moved in its new position in the document.
// "Move from" and "move to" revisions appear in pairs for every move revision we carry out.
// Accepting a move revision deletes the "move from" revision and its text,
// and keeps the text from the "move to" revision.
// Rejecting a move revision conversely keeps the "move from" revision and deletes the "move to" revision.
Assert.assertTrue(runs.get(1).isMoveToRevision());
// 5 - A "delete" revision:
// This revision occurs when we delete text while tracking changes. When we delete text like this,
// it will stay in the document as a revision until we either accept the revision,
// which will delete the text for good, or reject the revision, which will keep the text we deleted where it was.
Assert.assertTrue(runs.get(5).isDeleteRevision());
Paragraph value.public Font getFont()
Examples:
Shows how to construct an Aspose.Words document by hand.
Document doc = new Document();
// A blank document contains one section, one body and one paragraph.
// Call the "RemoveAllChildren" method to remove all those nodes,
// and end up with a document node with no children.
doc.removeAllChildren();
// This document now has no composite child nodes that we can add content to.
// If we wish to edit it, we will need to repopulate its node collection.
// First, create a new section, and then append it as a child to the root document node.
Section section = new Section(doc);
doc.appendChild(section);
// Set some page setup properties for the section.
section.getPageSetup().setSectionStart(SectionStart.NEW_PAGE);
section.getPageSetup().setPaperSize(PaperSize.LETTER);
// A section needs a body, which will contain and display all its contents
// on the page between the section's header and footer.
Body body = new Body(doc);
section.appendChild(body);
// Create a paragraph, set some formatting properties, and then append it as a child to the body.
Paragraph para = new Paragraph(doc);
para.getParagraphFormat().setStyleName("Heading 1");
para.getParagraphFormat().setAlignment(ParagraphAlignment.CENTER);
body.appendChild(para);
// Finally, add some content to do the document. Create a run,
// set its appearance and contents, and then append it as a child to the paragraph.
Run run = new Run(doc);
run.setText("Hello World!");
run.getFont().setColor(Color.RED);
para.appendChild(run);
Assert.assertEquals("Hello World!", doc.getText().trim());
doc.save(getArtifactsDir() + "Section.CreateManually.docx");
Font value.public boolean isInsertRevision()
Examples:
Shows how to determine the revision type of an inline node.
Document doc = new Document(getMyDir() + "Revision runs.docx");
// When we edit the document while the "Track Changes" option, found in via Review -> Tracking,
// is turned on in Microsoft Word, the changes we apply count as revisions.
// When editing a document using Aspose.Words, we can begin tracking revisions by
// invoking the document's "StartTrackRevisions" method and stop tracking by using the "StopTrackRevisions" method.
// We can either accept revisions to assimilate them into the document
// or reject them to change the proposed change effectively.
Assert.assertEquals(6, doc.getRevisions().getCount());
// The parent node of a revision is the run that the revision concerns. A Run is an Inline node.
Run run = (Run) doc.getRevisions().get(0).getParentNode();
Paragraph firstParagraph = run.getParentParagraph();
RunCollection runs = firstParagraph.getRuns();
Assert.assertEquals(runs.getCount(), 6);
// Below are five types of revisions that can flag an Inline node.
// 1 - An "insert" revision:
// This revision occurs when we insert text while tracking changes.
Assert.assertTrue(runs.get(2).isInsertRevision());
// 2 - A "format" revision:
// This revision occurs when we change the formatting of text while tracking changes.
Assert.assertTrue(runs.get(2).isFormatRevision());
// 3 - A "move from" revision:
// When we highlight text in Microsoft Word, and then drag it to a different place in the document
// while tracking changes, two revisions appear.
// The "move from" revision is a copy of the text originally before we moved it.
Assert.assertTrue(runs.get(4).isMoveFromRevision());
// 4 - A "move to" revision:
// The "move to" revision is the text that we moved in its new position in the document.
// "Move from" and "move to" revisions appear in pairs for every move revision we carry out.
// Accepting a move revision deletes the "move from" revision and its text,
// and keeps the text from the "move to" revision.
// Rejecting a move revision conversely keeps the "move from" revision and deletes the "move to" revision.
Assert.assertTrue(runs.get(1).isMoveToRevision());
// 5 - A "delete" revision:
// This revision occurs when we delete text while tracking changes. When we delete text like this,
// it will stay in the document as a revision until we either accept the revision,
// which will delete the text for good, or reject the revision, which will keep the text we deleted where it was.
Assert.assertTrue(runs.get(5).isDeleteRevision());
public boolean isDeleteRevision()
Examples:
Shows how to determine the revision type of an inline node.
Document doc = new Document(getMyDir() + "Revision runs.docx");
// When we edit the document while the "Track Changes" option, found in via Review -> Tracking,
// is turned on in Microsoft Word, the changes we apply count as revisions.
// When editing a document using Aspose.Words, we can begin tracking revisions by
// invoking the document's "StartTrackRevisions" method and stop tracking by using the "StopTrackRevisions" method.
// We can either accept revisions to assimilate them into the document
// or reject them to change the proposed change effectively.
Assert.assertEquals(6, doc.getRevisions().getCount());
// The parent node of a revision is the run that the revision concerns. A Run is an Inline node.
Run run = (Run) doc.getRevisions().get(0).getParentNode();
Paragraph firstParagraph = run.getParentParagraph();
RunCollection runs = firstParagraph.getRuns();
Assert.assertEquals(runs.getCount(), 6);
// Below are five types of revisions that can flag an Inline node.
// 1 - An "insert" revision:
// This revision occurs when we insert text while tracking changes.
Assert.assertTrue(runs.get(2).isInsertRevision());
// 2 - A "format" revision:
// This revision occurs when we change the formatting of text while tracking changes.
Assert.assertTrue(runs.get(2).isFormatRevision());
// 3 - A "move from" revision:
// When we highlight text in Microsoft Word, and then drag it to a different place in the document
// while tracking changes, two revisions appear.
// The "move from" revision is a copy of the text originally before we moved it.
Assert.assertTrue(runs.get(4).isMoveFromRevision());
// 4 - A "move to" revision:
// The "move to" revision is the text that we moved in its new position in the document.
// "Move from" and "move to" revisions appear in pairs for every move revision we carry out.
// Accepting a move revision deletes the "move from" revision and its text,
// and keeps the text from the "move to" revision.
// Rejecting a move revision conversely keeps the "move from" revision and deletes the "move to" revision.
Assert.assertTrue(runs.get(1).isMoveToRevision());
// 5 - A "delete" revision:
// This revision occurs when we delete text while tracking changes. When we delete text like this,
// it will stay in the document as a revision until we either accept the revision,
// which will delete the text for good, or reject the revision, which will keep the text we deleted where it was.
Assert.assertTrue(runs.get(5).isDeleteRevision());
public boolean isMoveFromRevision()
true if this object was moved (deleted) in Microsoft Word while change tracking was enabled.
Examples:
Shows how to determine the revision type of an inline node.
Document doc = new Document(getMyDir() + "Revision runs.docx");
// When we edit the document while the "Track Changes" option, found in via Review -> Tracking,
// is turned on in Microsoft Word, the changes we apply count as revisions.
// When editing a document using Aspose.Words, we can begin tracking revisions by
// invoking the document's "StartTrackRevisions" method and stop tracking by using the "StopTrackRevisions" method.
// We can either accept revisions to assimilate them into the document
// or reject them to change the proposed change effectively.
Assert.assertEquals(6, doc.getRevisions().getCount());
// The parent node of a revision is the run that the revision concerns. A Run is an Inline node.
Run run = (Run) doc.getRevisions().get(0).getParentNode();
Paragraph firstParagraph = run.getParentParagraph();
RunCollection runs = firstParagraph.getRuns();
Assert.assertEquals(runs.getCount(), 6);
// Below are five types of revisions that can flag an Inline node.
// 1 - An "insert" revision:
// This revision occurs when we insert text while tracking changes.
Assert.assertTrue(runs.get(2).isInsertRevision());
// 2 - A "format" revision:
// This revision occurs when we change the formatting of text while tracking changes.
Assert.assertTrue(runs.get(2).isFormatRevision());
// 3 - A "move from" revision:
// When we highlight text in Microsoft Word, and then drag it to a different place in the document
// while tracking changes, two revisions appear.
// The "move from" revision is a copy of the text originally before we moved it.
Assert.assertTrue(runs.get(4).isMoveFromRevision());
// 4 - A "move to" revision:
// The "move to" revision is the text that we moved in its new position in the document.
// "Move from" and "move to" revisions appear in pairs for every move revision we carry out.
// Accepting a move revision deletes the "move from" revision and its text,
// and keeps the text from the "move to" revision.
// Rejecting a move revision conversely keeps the "move from" revision and deletes the "move to" revision.
Assert.assertTrue(runs.get(1).isMoveToRevision());
// 5 - A "delete" revision:
// This revision occurs when we delete text while tracking changes. When we delete text like this,
// it will stay in the document as a revision until we either accept the revision,
// which will delete the text for good, or reject the revision, which will keep the text we deleted where it was.
Assert.assertTrue(runs.get(5).isDeleteRevision());
true if this object was moved (deleted) in Microsoft Word while change tracking was enabled.public boolean isMoveToRevision()
true if this object was moved (inserted) in Microsoft Word while change tracking was enabled.
Examples:
Shows how to determine the revision type of an inline node.
Document doc = new Document(getMyDir() + "Revision runs.docx");
// When we edit the document while the "Track Changes" option, found in via Review -> Tracking,
// is turned on in Microsoft Word, the changes we apply count as revisions.
// When editing a document using Aspose.Words, we can begin tracking revisions by
// invoking the document's "StartTrackRevisions" method and stop tracking by using the "StopTrackRevisions" method.
// We can either accept revisions to assimilate them into the document
// or reject them to change the proposed change effectively.
Assert.assertEquals(6, doc.getRevisions().getCount());
// The parent node of a revision is the run that the revision concerns. A Run is an Inline node.
Run run = (Run) doc.getRevisions().get(0).getParentNode();
Paragraph firstParagraph = run.getParentParagraph();
RunCollection runs = firstParagraph.getRuns();
Assert.assertEquals(runs.getCount(), 6);
// Below are five types of revisions that can flag an Inline node.
// 1 - An "insert" revision:
// This revision occurs when we insert text while tracking changes.
Assert.assertTrue(runs.get(2).isInsertRevision());
// 2 - A "format" revision:
// This revision occurs when we change the formatting of text while tracking changes.
Assert.assertTrue(runs.get(2).isFormatRevision());
// 3 - A "move from" revision:
// When we highlight text in Microsoft Word, and then drag it to a different place in the document
// while tracking changes, two revisions appear.
// The "move from" revision is a copy of the text originally before we moved it.
Assert.assertTrue(runs.get(4).isMoveFromRevision());
// 4 - A "move to" revision:
// The "move to" revision is the text that we moved in its new position in the document.
// "Move from" and "move to" revisions appear in pairs for every move revision we carry out.
// Accepting a move revision deletes the "move from" revision and its text,
// and keeps the text from the "move to" revision.
// Rejecting a move revision conversely keeps the "move from" revision and deletes the "move to" revision.
Assert.assertTrue(runs.get(1).isMoveToRevision());
// 5 - A "delete" revision:
// This revision occurs when we delete text while tracking changes. When we delete text like this,
// it will stay in the document as a revision until we either accept the revision,
// which will delete the text for good, or reject the revision, which will keep the text we deleted where it was.
Assert.assertTrue(runs.get(5).isDeleteRevision());
true if this object was moved (inserted) in Microsoft Word while change tracking was enabled.public boolean isFormatRevision()
Examples:
Shows how to determine the revision type of an inline node.
Document doc = new Document(getMyDir() + "Revision runs.docx");
// When we edit the document while the "Track Changes" option, found in via Review -> Tracking,
// is turned on in Microsoft Word, the changes we apply count as revisions.
// When editing a document using Aspose.Words, we can begin tracking revisions by
// invoking the document's "StartTrackRevisions" method and stop tracking by using the "StopTrackRevisions" method.
// We can either accept revisions to assimilate them into the document
// or reject them to change the proposed change effectively.
Assert.assertEquals(6, doc.getRevisions().getCount());
// The parent node of a revision is the run that the revision concerns. A Run is an Inline node.
Run run = (Run) doc.getRevisions().get(0).getParentNode();
Paragraph firstParagraph = run.getParentParagraph();
RunCollection runs = firstParagraph.getRuns();
Assert.assertEquals(runs.getCount(), 6);
// Below are five types of revisions that can flag an Inline node.
// 1 - An "insert" revision:
// This revision occurs when we insert text while tracking changes.
Assert.assertTrue(runs.get(2).isInsertRevision());
// 2 - A "format" revision:
// This revision occurs when we change the formatting of text while tracking changes.
Assert.assertTrue(runs.get(2).isFormatRevision());
// 3 - A "move from" revision:
// When we highlight text in Microsoft Word, and then drag it to a different place in the document
// while tracking changes, two revisions appear.
// The "move from" revision is a copy of the text originally before we moved it.
Assert.assertTrue(runs.get(4).isMoveFromRevision());
// 4 - A "move to" revision:
// The "move to" revision is the text that we moved in its new position in the document.
// "Move from" and "move to" revisions appear in pairs for every move revision we carry out.
// Accepting a move revision deletes the "move from" revision and its text,
// and keeps the text from the "move to" revision.
// Rejecting a move revision conversely keeps the "move from" revision and deletes the "move to" revision.
Assert.assertTrue(runs.get(1).isMoveToRevision());
// 5 - A "delete" revision:
// This revision occurs when we delete text while tracking changes. When we delete text like this,
// it will stay in the document as a revision until we either accept the revision,
// which will delete the text for good, or reject the revision, which will keep the text we deleted where it was.
Assert.assertTrue(runs.get(5).isDeleteRevision());
public Paragraph getParentParagraph_IInline()
public DocumentBase getDocument_IInline()
public java.lang.Object getDirectRunAttr(int key)
public java.lang.Object getDirectRunAttr(int key,
int revisionsView)
public java.lang.Object fetchInheritedRunAttr(int fontAttr)
public void setRunAttr(int key,
java.lang.Object value)
public void removeRunAttr(int key)
public void clearRunAttrs()
public void removeMoveRevisions()