Textbox to normal text

Hi team,
I have to convert all shapes with text to normal paragraph text in the attached word document (input.doc). The normal text should replace the respective shapes in the document. Herewith, I have attached the sample output for your review.
Could you help us to do this, using Aspose .Net words?

Hi Harish,

Thanks for your inquiry. Please use following code example to extract the paragraph nodes from the Shape node insert them after shape’s parent paragraph.

Regarding the shape’s text (In line text), please note that a shape node may contains multiple paragraphs. If your document have shapes with Shape.WrapType as Inline, please insert a Run node before Shape node and set the Run’s text with shape’s text.

Document doc = new Document(MyDir + "input.doc");
DocumentBuilder builder = new DocumentBuilder(doc);
int bm = 1;
foreach (Shape shape in doc.GetChildNodes(NodeType.Shape, true))
{
    NodeCollection paragraphs = shape.GetChildNodes(NodeType.Paragraph, true);
    Node refNode = shape.ParentParagraph;
    builder.MoveTo(refNode);
    builder.StartBookmark("BM_" + bm);
    builder.EndBookmark("BM_" + bm);
    bm++;
    for (int i = 0; i < paragraphs.Count; i++)
    {
        refNode = shape.ParentParagraph.ParentNode.InsertAfter(paragraphs[i].Clone(true), refNode);
    }
    if (paragraphs.Count > 0)
        shape.Remove();
}
foreach (Bookmark bookmark in doc.Range.Bookmarks)
{
    if (bookmark.Name.StartsWith("BM_"))
    {
        Node node = bookmark.BookmarkStart.ParentNode;
        if (node.ToString(SaveFormat.Text).Trim() == "")
            node.Remove();
    }
}
doc.Save(MyDir + "Out.docx");

Thanks for your support.

Hi Harish,

Thanks for your feedback. Please feel free to ask if you have any question about Aspose.Words, we will be happy to help you.