We're sorry Aspose doesn't work properply without JavaScript enabled.

Free Support Forum - aspose.com

Unable to get vanished Contents in paragraph

Hi ,
I am using latest version of apose.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());

}


<!–[if gte mso 9]>
<w:WordDocument>
<w:View>Normal</w:View>
<w:Zoom>0</w:Zoom>
<w:TrackMoves/>
<w:TrackFormatting/>
<w:PunctuationKerning/>
<w:ValidateAgainstSchemas/>
<w:SaveIfXMLInvalid>false</w:SaveIfXMLInvalid>
<w:IgnoreMixedContent>false</w:IgnoreMixedContent>
<w:AlwaysShowPlaceholderText>false</w:AlwaysShowPlaceholderText>
<w:DoNotPromoteQF/>
<w:LidThemeOther>EN-US</w:LidThemeOther>
<w:LidThemeAsian>X-NONE</w:LidThemeAsian>
<w:LidThemeComplexScript>X-NONE</w:LidThemeComplexScript>
<w:Compatibility>
<w:BreakWrappedTables/>
<w:SnapToGridInCell/>
<w:WrapTextWithPunct/>
<w:UseAsianBreakRules/>
<w:DontGrowAutofit/>
<w:SplitPgBreakAndParaMark/>
<w:EnableOpenTypeKerning/>
<w:DontFlipMirrorIndents/>
<w:OverrideTableStyleHps/>
</w:Compatibility>
<m:mathPr>
<m:mathFont m:val=“Cambria Math”/>
<m:brkBin m:val=“before”/>
<m:brkBinSub m:val="–"/>
<m:smallFrac m:val=“off”/>
<m:dispDef/>
<m:lMargin m:val=“0”/>
<m:rMargin m:val=“0”/>
<m:defJc m:val=“centerGroup”/>
<m:wrapIndent m:val=“1440”/>
<m:intLim m:val=“subSup”/>
<m:naryLim m:val=“undOvr”/>
</m:mathPr></w:WordDocument>
<![endif]–><!–[if gte mso 10]>

/* Style Definitions */ table.MsoNormalTable {mso-style-name:"Table Normal"; mso-tstyle-rowband-size:0; mso-tstyle-colband-size:0; mso-style-noshow:yes; mso-style-priority:99; mso-style-parent:""; mso-padding-alt:0in 5.4pt 0in 5.4pt; mso-para-margin-top:0in; mso-para-margin-right:0in; mso-para-margin-bottom:8.0pt; mso-para-margin-left:0in; line-height:107%; mso-pagination:widow-orphan; font-size:11.0pt; font-family:"Calibri",sans-serif; mso-ascii-font-family:Calibri; mso-ascii-theme-font:minor-latin; mso-hansi-font-family:Calibri; mso-hansi-theme-font:minor-latin;}

<![endif]–>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());

}


<!–[if gte mso 9]>
<w:WordDocument>
<w:View>Normal</w:View>
<w:Zoom>0</w:Zoom>
<w:TrackMoves/>
<w:TrackFormatting/>
<w:PunctuationKerning/>
<w:ValidateAgainstSchemas/>
<w:SaveIfXMLInvalid>false</w:SaveIfXMLInvalid>
<w:IgnoreMixedContent>false</w:IgnoreMixedContent>
<w:AlwaysShowPlaceholderText>false</w:AlwaysShowPlaceholderText>
<w:DoNotPromoteQF/>
<w:LidThemeOther>EN-US</w:LidThemeOther>
<w:LidThemeAsian>X-NONE</w:LidThemeAsian>
<w:LidThemeComplexScript>X-NONE</w:LidThemeComplexScript>
<w:Compatibility>
<w:BreakWrappedTables/>
<w:SnapToGridInCell/>
<w:WrapTextWithPunct/>
<w:UseAsianBreakRules/>
<w:DontGrowAutofit/>
<w:SplitPgBreakAndParaMark/>
<w:EnableOpenTypeKerning/>
<w:DontFlipMirrorIndents/>
<w:OverrideTableStyleHps/>
</w:Compatibility>
<m:mathPr>
<m:mathFont m:val=“Cambria Math”/>
<m:brkBin m:val=“before”/>
<m:brkBinSub m:val="–"/>
<m:smallFrac m:val=“off”/>
<m:dispDef/>
<m:lMargin m:val=“0”/>
<m:rMargin m:val=“0”/>
<m:defJc m:val=“centerGroup”/>
<m:wrapIndent m:val=“1440”/>
<m:intLim m:val=“subSup”/>
<m:naryLim m:val=“undOvr”/>
</m:mathPr></w:WordDocument>
<![endif]–><!–[if gte mso 10]>

/* Style Definitions */ table.MsoNormalTable {mso-style-name:"Table Normal"; mso-tstyle-rowband-size:0; mso-tstyle-colband-size:0; mso-style-noshow:yes; mso-style-priority:99; mso-style-parent:""; mso-padding-alt:0in 5.4pt 0in 5.4pt; mso-para-margin-top:0in; mso-para-margin-right:0in; mso-para-margin-bottom:8.0pt; mso-para-margin-left:0in; line-height:107%; mso-pagination:widow-orphan; font-size:11.0pt; font-family:"Calibri",sans-serif; mso-ascii-font-family:Calibri; mso-ascii-theme-font:minor-latin; mso-hansi-font-family:Calibri; mso-hansi-theme-font:minor-latin;}

<![endif]–>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.