在形状内作为纹理平铺图片
Contents
[
Hide
]
可能的使用场景
当图片较小且不覆盖整个形状表面而又不失真时,可以选择将其平铺。平铺会通过重复小图像来填充形状表面,就像它们是瓷砖一样。
在形状内部将图片作为纹理平铺
您可以使用Shape.Fill.TextureFill.IsTiling属性填充形状表面并设置为true以平铺。请查看以下示例代码、示例Excel文件以及屏幕截图供参考。
屏幕截图
示例代码
This file contains 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-.NET | |
//Load sample Excel file | |
Workbook wb = new Workbook(sourceDir + "sampleTextureFill_IsTiling.xlsx"); | |
//Access first worksheet | |
Worksheet ws = wb.Worksheets[0]; | |
//Access first shape inside the worksheet | |
Shape sh = ws.Shapes[0]; | |
//Tile Picture as a Texture inside the Shape | |
sh.Fill.TextureFill.IsTiling = true; | |
//Save the output Excel file | |
wb.Save(outputDir + "outputTextureFill_IsTiling.xlsx"); |