Blocco della filigrana WordArt
Contents
[
Hide
]
Aspose.Cells Le API consentono di aggiungere filigrane WordArt al foglio di lavoro in modo che la WordArt diventi un oggetto che può essere spostato e posizionato sul foglio di lavoro. È anche possibile bloccare l’oggetto WordArt per qualsiasi interazione come modifica, movimento e selezione. Questo articolo spiega l’utilizzo diShape.setLockedProperty per bloccare alcuni aspetti della filigrana.
Blocco della filigrana WordArt
Aspose.Cells Le API consentono di bloccare alcuni aspetti della filigrana in modo che l’interazione dell’utente possa essere limitata o completamente bloccata. Il seguente frammento di codice illustra l’utilizzo di Aspose.Cells for Java API per creare una filigrana per ogni foglio di lavoro nel foglio di calcolo caricato e bloccare la selezione, lo spostamento, la modifica e il ridimensionamento della filigrana.
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 | |
// The path to the documents directory. | |
String dataDir = Utils.getDataDir(LockWordArtWatermark.class); | |
// Instantiate a new Workbook | |
Workbook workbook = new Workbook(); | |
// Get the first default sheet | |
Worksheet sheet = workbook.getWorksheets().get(0); | |
// Add Watermark | |
Shape wordart = sheet.getShapes().addTextEffect(MsoPresetTextEffect.TEXT_EFFECT_1, "CONFIDENTIAL", | |
"Arial Black", 50, false, true, 18, 8, 1, 1, 130, 800); | |
// Get the fill format of the word art | |
FillFormat wordArtFormat = wordart.getFill(); | |
// Set the color | |
wordArtFormat.setOneColorGradient(Color.getRed(), 0.2, GradientStyleType.HORIZONTAL, 2); | |
// Set the transparency | |
wordArtFormat.setTransparency(0.9); | |
// Make the line invisible | |
wordart.setHasLine(false); | |
// Lock Shape Aspects | |
wordart.setLocked(true); | |
wordart.setLockedProperty(ShapeLockType.SELECTION, true); | |
wordart.setLockedProperty(ShapeLockType.SHAPE_TYPE, true); | |
wordart.setLockedProperty(ShapeLockType.MOVE, true); | |
wordart.setLockedProperty(ShapeLockType.RESIZE, true); | |
wordart.setLockedProperty(ShapeLockType.TEXT, true); | |
// Save the file | |
workbook.save(dataDir + "output.xls"); |