Text boxes: Unexpected Subdocument Type Exception

Dear Aspose team!

Currently, I got a problem with text boxes.

Please find attached our template 10000906.doc. If we try to insert the text module 10000895.doc into the template’s bookmark C7251Tsr000000010000895R0000000018, we get the following exception:

Message: Unexpected subdocument type.
Source --- Aspose.Words
StackTrace ---
bei ⤈.⩿.⪘(⢲ ⣬)
bei ⢯.â- ¾.â¸"(ShapeBase á¬�)
bei ⢯.â- ¾.â¸�(ShapeBase á¬�)
bei ⢯.â- ¾.⸊(ShapeBase á¬�)
bei ⢯.â- ¾.⸉(ShapeBase á¬�)
bei ⢯.â- ¾.â¸...(Shape á¬�)
bei ⢯.⢮.VisitShapeStart(Shape shape)
bei Aspose.Words.Drawing.Shape.Accept(DocumentVisitor visitor)
bei Aspose.Words.CompositeNode.á—�(DocumentVisitor Ú›)
bei Aspose.Words.Paragraph.Accept(DocumentVisitor visitor)
bei Aspose.Words.CompositeNode.á—�(DocumentVisitor Ú›)
bei Aspose.Words.Drawing.Shape.Accept(DocumentVisitor visitor)
bei Aspose.Words.CompositeNode.á—�(DocumentVisitor Ú›)
bei Aspose.Words.Paragraph.Accept(DocumentVisitor visitor)
bei Aspose.Words.CompositeNode.á—�(DocumentVisitor Ú›)
bei Aspose.Words.Body.Accept(DocumentVisitor visitor)
bei ⢯.⢮.⣗(Section âš- )
bei ⢯.⢮.⣕()
bei ⢯.⢮.â£"(⢚ ⢙)
bei Aspose.Words.Document.á-š(Stream Ö², String Öº, SaveFormat á-›)
bei Aspose.Words.Document.Save(String fileName, SaveFormat fileFormat)

To reproduce and debug this issue with our code, you could use our demo VS project https://forum.aspose.com/t/56483

I found a problem in this forum that could be similar to my current one:
https://forum.aspose.com/t/77477

But please keep in mind that we are not calling Document.UpdatePageLayout() directly and we are not saving as PDF. Please let me know if you found out what our problem is.

Thank you very much for your great support,
Stephan

Hi

Thanks for your request. The problem occurs because in your code you insert textbox shapes into another textbox shape. This is not allowed. That is why Aspose.Words throws an exception.
Maybe in your case it would be better to use tables instead of textboxes.
Best regards,

Hi Alexey!
Thanks a lot for your immediate help!
I’ll check if embedding text boxes can be worked around by using tables in our scenarios.
Thank you,
cheers,
Stephan

Hi Stephan,

Please feel free to ask if you need more assistance, I will be glad to help you.
Best regards,