Dear team,
I need to remove anchor from given document, I have attached one document this document have anchors in images, Please provide source code to remove anchor from given document
Input : Input.docx (178.7 KB)
Dear team,
I need to remove anchor from given document, I have attached one document this document have anchors in images, Please provide source code to remove anchor from given document
Input : Input.docx (178.7 KB)
@e503824 You can make shapes in your document inline, but this might lead to layout differences since there are a lot of floating shapes which are placed one behind another. Making the shapes inline will make such shapes to be placed one next to another.
Document doc = new Document("C:\\Temp\\in.docx");
// Make shapes inline
Iterable<Shape> shapes = doc.getChildNodes(NodeType.SHAPE, true);
for (Shape s : shapes)
{
if (s.isTopLevel())
{
s.setWrapType(WrapType.INLINE);
}
}
// Make groupshapes inline.
Iterable<GroupShape> groups = doc.getChildNodes(NodeType.GROUP_SHAPE, true);
for (GroupShape g : groups)
{
if (g.isTopLevel())
{
g.setWrapType(WrapType.INLINE);
}
}
doc.save("C:\\Temp\\out.docx");