平铺图片作为形状内的纹理
Contents
[
Hide
]
可能的使用场景
当图片很小并且无法在不损失其质量的情况下覆盖整个形状表面时,您可以选择平铺它。平铺通过像平铺一样重复它们来用小图像填充形状表面。
平铺图片作为形状内的纹理
您可以用一些图像填充形状表面并使用形状.填充.TextureFill.IsTiling属性并设置它真的.请看下面的示例代码,其示例 Excel 文件, 它的输出Excel文件以及屏幕截图以供参考。
截屏
示例代码
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
// For complete examples and data files, please go to https://github.com/aspose-cells/Aspose.Cells-for-Java | |
//Load sample Excel file | |
Workbook wb = new Workbook(srcDir + "sampleTextureFill_IsTiling.xlsx"); | |
//Access first worksheet | |
Worksheet ws = wb.getWorksheets().get(0); | |
//Access first shape inside the worksheet | |
Shape sh = ws.getShapes().get(0); | |
//Tile Picture as a Texture inside the Shape | |
sh.getFill().getTextureFill().setTiling(true); | |
//Save the output Excel file | |
wb.save(outDir + "outputTextureFill_IsTiling.xlsx"); |