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

Free Support Forum - aspose.com

Unable to fetch textboxes from *.docx document

I’m using Aspose.Words for .NET version

I have a document (“test.docx”) that contains a couple of textboxes. I try the following code to fetch the number of textboxes:

var count =
.GetChildNodes(NodeType.Shape, true)
.Count(s => s.ShapeType == ShapeType.TextBox);

Surprisingly, count is 0. But there’s more.
I’ve created a blank docx using LibreOffice Writer (“test_copy.docx”) and copy-pasted all textboxes from test.docx to test_copy.docx. I’ve run the same code for both files and got this:
test.docx: 0
text_copy.docx: 10

I understand the fact that these files are different on binary level, but LibreOffice writer allows me to manipulate textboxes in both files (for example, chage the size of a textbox).

Is there a solution for this problem?

Hi Artem,

Thanks for your inquiry. The textboxes in “test.docx” are actually “Frames” and Aspose.Words does not support them. However, textboxes in “test_copy.docx” are indeed TextBoxes and Aspose.Words can correctly detect such textboxes as Shape objects. So, this is expected behavior. If we can help you with anything else, please feel free to ask.

Best regards,