How to get empty paragraph font properties

Hi Team,

In the attached extra_line.doc, I have a second paragraph, which is empty. If the check the font properties of it, it's Verdana with size 12. However, using Aspose Words for Java, I'm not able to get font properties from the Paragaph (com.aspose.words.Paragraph) element.

Thanks,
Kumar

import java.util.UUID;

import com.aspose.words.Cell;
import com.aspose.words.Document;
import com.aspose.words.DocumentBuilder;
import com.aspose.words.FileFormatUtil;
import com.aspose.words.ListLevel;
import com.aspose.words.Node;
import com.aspose.words.NodeType;
import com.aspose.words.NumberStyle;
import com.aspose.words.Paragraph;
import com.aspose.words.ParagraphFormat;
import com.aspose.words.Row;
import com.aspose.words.Run;
import com.aspose.words.Shape;
import com.aspose.words.Table;

public class TestIterateDocument
{
public static void main(String[] args) throws Exception
{
TestAsposeUtils.setupLicense(TestAsposeUtils.lICENSE_FILE_PATH);
String docPath = "D:\\extra_line.doc";
Document doc = new Document(docPath);
DocumentBuilder docBuilder = new DocumentBuilder(doc);

iterateDocument(doc, docBuilder);

System.out.println("done");
}

private static void iterateDocument(Document doc, DocumentBuilder docBuilder) throws Exception
{
Node node = doc;
while (node != doc.getLastSection().getBody().getLastParagraph().getLastChild())
{
node = node.nextPreOrder(doc);

if (node != null)
{
// System.out.println("#########: " + Node.nodeTypeToString(node.getNodeType()));
if (NodeType.RUN == node.getNodeType())
{
Run run = (Run) node;
// System.out.println("Style (text) :" + run.getParentParagraph().getParagraphFormat().getStyle().getName());
System.out.println("Font name (text) :" + run.getFont().getName());
System.out.println("Text:" + run.getText());
// System.out.println("Is bold: " + run.getFont().getBold());
}
if (NodeType.PARAGRAPH == node.getNodeType())
{
Paragraph para = (Paragraph) node;
System.out.println("Style (para) :" + para.getParagraphFormat().getStyle().getName());
System.out.println("How to get font name for the paragraph... Verdana");
}
}
}
}

private static String getMyDir()
{
return System.getProperty("java.io.tmpdir");
}
}

Hi Kumar,


Thanks for your inquiry. Please see the following simple code:

Document doc = new Document(getMyDir() + “extra_line.doc”);
Paragraph targetPara = doc.getFirstSection().getBody().getLastParagraph();
System.out.println(targetPara.getParagraphBreakFont().getName() + " & " +
targetPara.getParagraphBreakFont().getSize());

Hope, this helps.

Best regards,