Comments (1)
@zuwensong,
请尝试使用以下代码:
Document doc = new Document("D:\\Temp\\in.docx");
ArrayList shapesToRemove = new ArrayList();
NodeCollection shapeCollection = doc.getChildNodes(NodeType.SHAPE, true);
for (int i=0; i<shapeCollection.getCount(); i++) {
Shape shape = (Shape) shapeCollection.get(i);
if(shape.hasImage()) {
String imageFileName = java.text.MessageFormat.format(
"Image.ExportImages.{0} Out{1}", i, FileFormatUtil.imageTypeToExtension(shape.getImageData().getImageType()));
ImageData imageData = shape.getImageData();
imageData.save("D:\\temp\\pic\\" + imageFileName);
shapesToRemove.add(shape);
}
}
for(Shape shape : (Iterable<Shape>) shapesToRemove) {
shape.remove();
}
doc.save("D:\\Temp\\awjava-18.4.docx");
from aspose.words-for-java.
Related Issues (20)
- 如何在手机上使用? HOT 1
- how to show all content of page by structure from top to bottom HOT 1
- Error in compressed image example on official website HOT 3
- All tests for table in LINQ_Reporting_Engine failed HOT 3
- fixed header on each page of the table HOT 2
- docx文件中表格每行高会增加,怎么处理呢?aspose word 15 HOT 6
- 为什么java docx转pdf 红头文件标题直接没了 HOT 5
- Insert html to Word,html forrmat is HOT 9
- Aspose.word function is missing HOT 9
- @SnowflyW Unfortunately, your request is not quite clear. Could you please elaborate your requirements in more details and attach your input document, sample data and the expected output? We will investigate and provide you more information.
- Invalid paragraph spacing setting HOT 2
- Typo Contents_managment HOT 1
- Missing text when convert word to pdf HOT 1
- word生成pdf时,段落中间若有——或短横线-,符号后会莫名加一个换行符 HOT 6
- fonts overlap using aspose HOT 1
- word添加水印后页眉变高 HOT 10
- word转pdf后行距增加 HOT 2
- reporting engine how to fill in content controls HOT 1
- 如何在指定页面渲染目录 HOT 1
- the overlapping of labels and values for pie charts HOT 5
Recommend Projects
-
React
A declarative, efficient, and flexible JavaScript library for building user interfaces.
-
Vue.js
🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.
-
Typescript
TypeScript is a superset of JavaScript that compiles to clean JavaScript output.
-
TensorFlow
An Open Source Machine Learning Framework for Everyone
-
Django
The Web framework for perfectionists with deadlines.
-
Laravel
A PHP framework for web artisans
-
D3
Bring data to life with SVG, Canvas and HTML. 📊📈🎉
-
Recommend Topics
-
javascript
JavaScript (JS) is a lightweight interpreted programming language with first-class functions.
-
web
Some thing interesting about web. New door for the world.
-
server
A server is a program made to process requests and deliver data to clients.
-
Machine learning
Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.
-
Visualization
Some thing interesting about visualization, use data art
-
Game
Some thing interesting about game, make everyone happy.
Recommend Org
-
Facebook
We are working to build community through open source technology. NB: members must have two-factor auth.
-
Microsoft
Open source projects and samples from Microsoft.
-
Google
Google ❤️ Open Source for everyone.
-
Alibaba
Alibaba Open Source for everyone
-
D3
Data-Driven Documents codes.
-
Tencent
China tencent open source team.
from aspose.words-for-java.