Créer un objet Style à l'aide de la classe CellsFactory
Contents
[
Hide
]
Créer un objet Style à l’aide de la classe CellsFactory
L’exemple de code suivant créeStyle objet utilisantUsine de cellules class, puis définit le style par défaut du classeur. Veuillez télécharger lefichier excel de sortie pour voir les résultats de ce code pour votre référence.
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 | |
// The path to the documents directory. | |
string dataDir = RunExamples.GetDataDir(System.Reflection.MethodBase.GetCurrentMethod().DeclaringType); | |
// Create a Style object using CellsFactory class | |
CellsFactory cf = new CellsFactory(); | |
Style st = cf.CreateStyle(); | |
// Set the Style fill color to Yellow | |
st.Pattern = BackgroundType.Solid; | |
st.ForegroundColor = Color.Yellow; | |
// Create a workbook and set its default style using the created Style object | |
Workbook wb = new Workbook(); | |
wb.DefaultStyle = st; | |
// Save the workbook | |
wb.Save(dataDir + "output_out.xlsx"); |