Unable to get vanished Contents in paragraph

Hi ,
I am using latest version of Aspose.Words . When i try to get vanished contents in paragraph it skips .Please refer the attached document .

Thanks
Anbu.S

Hi Anbu,

Thanks for your inquiry. Font.Hidden property return true if the font is formatted as hidden text. Your document contains some text with hidden formatting.

Please check the following code example for your kind reference.

Document doc = new Document(MyDir + "NOTE+Transformation+File+with+Track+Changes.doc");
doc.UpdateListLabels();
foreach (Paragraph paragraph in doc.GetChildNodes(NodeType.Paragraph, true))
{
    Console.WriteLine("Hidden Paragraph : " + paragraph.ParagraphBreakFont.Hidden);
    ListLabel label = paragraph.ListLabel;
    Console.WriteLine("Numerical Id: " + label.LabelValue);
    Console.WriteLine("List label combined with text: " + label.LabelString + " " + paragraph.ToString(SaveFormat.Text).Trim());
}

Could you please share some detail about your query along with code which you are using? We will then provide you more information about your query along with code.

Hi Thair ,
Thanks for your response . In the document i attached, vanished property is in Rpr which comes under PPr node ( refer document.xml ). Please make use of the attached document .

Document doc = new Document("VANISHED.docx");
NodeList paraCollection = doc.selectNodes("//Paragraph");
for (int i = 0; i < paraCollection.getCount(); i++)
{
    Paragraph para = (Paragraph)paraCollection.get(i);
    System.out.println(para.getParagraphFormat().getStyle().getFont().getHidden());
}

Regards,
Anbu

Hi Anbu,

Thanks for your inquiry. Font.Hidden property return true if the font is formatted as hidden
text
.

All text of the document is stored in runs of text. Your
document contains Paragraphs with hidden formatting true and these
paragraphs have no Run nodes. These hidden paragraph have style ‘List
Paragraph’ and hidden formatting is not set for this style. So, ParagraphFormat().getStyle().getFont().getHidden() will return false.

In your case, I suggest you please use following code example to check the hidden formatting.

Document doc = new Document(MyDir + "VANISHED.docx");
NodeList paraCollection = doc.selectNodes("//Paragraph");
for (int i = 0; i < paraCollection.getCount(); i++)
{
    Paragraph para = (Paragraph)paraCollection.get(i);
    if (para.hasChildNodes())
        System.out.println(para.getRuns().get(0).getFont().getHidden());
    else
        System.out.println(para.getParagraphBreakFont().getHidden());
}

Moreover, please note that formatting is
applied on a few different levels. For example, let’s consider
formatting of simple text. Text in documents is represented by Run
element and a Run can only be a child of a Paragraph. You can apply
formatting

  1. to Run nodes by using Character Styles e.g. a Glyph Style
  2. to the parent of those Run nodes i.e. a Paragraph node (possibly via paragraph Styles)
  3. you can also apply direct formatting to Run nodes by using Run
    attributes (Font). E.g if you apply Garamond, 10pt to some text, you can use Run.Font.

Hope this answers your query. Please let us know if you have any more queries.