How to read caption of Tables and Figures in aspose?

Please provide any way bu which I can read caption of Tables and Figures in aspose.

@mhtsharma9,

Please ZIP and upload your sample Word document you want to read table/figure captions from here for testing. We will investigate the scenario on our end and provide you code to achieve this.

Attached file containing a Table and a Image with caption. Can you please provide way to extract these caption from table or image?
TestAsposecaption.zip (504.2 KB)

@mhtsharma9,

You can use the following sample code to get the caption texts:

Document doc = new Document("D:\\Temp\\TestAsposecaption\\TestAsposecaption.docx");

foreach (Table tbl in doc.GetChildNodes(NodeType.Table, true))
{
    Paragraph caption = tbl.NextSibling as Paragraph;
    Console.WriteLine(caption.ToString(SaveFormat.Text));
}

foreach (Shape shape in doc.GetChildNodes(NodeType.Shape, true))
{
    Paragraph caption = shape.GetAncestor(NodeType.Paragraph).NextSibling as Paragraph;
    Console.WriteLine(caption.ToString(SaveFormat.Text));
}