使用SmartArt冷渲染
SmartArt图形用于快速轻松地创建信息的可视化表示。 您只需从大量最适合您的情况的布局中进行选择。 这种易用性使得SmartArt图形在某些用途上非常受欢迎。
Microsoft Word生成并保存预渲染的绘图以及SmartArt
对象。 在大多数情况下,预渲染的绘图通过Aspose.Words很好地呈现,并且不需要额外的操作。 但是,如果文档由其他应用程序保存,则预呈现的SmartArt绘图可能丢失或不正确。 在这种情况下,SmartArt
对象本身应该使用Aspose.Words进行布局和呈现。 我们将此过程称为SmartArt
冷渲染。
使用SmartArt冷渲染
Aspose.Words允许您使用预渲染绘图或执行冷渲染:
- 如果预渲染的绘图可用,Aspose.Words使用它来渲染
SmartArt
对象。 - 如果缺少预渲染绘图,Aspose.Words隐式执行冷渲染以渲染
SmartArt
对象。 - 如果存在预渲染的绘图但不正确,则需要通过调用UpdateSmartArtDrawing方法显式执行SmartArt冷渲染。
下面的代码示例演示如何更新文档中所有关系图的绘图:
// For complete examples and data files, please go to https://github.com/aspose-words/Aspose.Words-for-Java | |
NodeCollection shapes = doc.getChildNodes(NodeType.SHAPE, true); | |
for (Shape shape : (Iterable<Shape>) shapes) | |
if(shape.hasSmartArt()) | |
shape.updateSmartArtDrawing(); |
支持标准SmartArt布局
目前,仅支持有限数量的标准Microsoft WordSmartArt布局。 此外,部分支持这些布局,这意味着显着的节点和图表的形状被呈现,但Microsoft Word和Aspose.Words图表布局之间可能存在差异。
下表列出了完全和部分支持的布局:
SmartArt布局组 | 完全支持的布局 | 部分支持的布局 |
---|---|---|
List |
|
|
Process |
|
|
Cycle |
|
|
Hierarchy |
|
|
Relationship |
|
|
Matrix |
|
|
Pyramid |
|
Aspose.Words和Microsoft中SmartArt渲染的比较
下表显示了与Microsoft Word输出相比,一些标准布局的Aspose.Words冷渲染的示例图片:
Aspose.Words | Microsoft Word | |
---|---|---|
Basic Process | ![]() |
![]() |
Circular Bending Process | ![]() |
![]() |
Repeating Bending Process | ![]() |
![]() |
Trapezoid List | ![]() |
![]() |