Themendaten aus Excel Datei extrahieren
Aspose.Cells ermöglicht es den Benutzern, themenbezogene Daten aus einer Excel-Datei zu extrahieren. Zum Beispiel können Sie den Namen des für die Arbeitsmappe angewendeten Themas und die für die Zelle oder Rahmen der Zelle angewendete Farbe des Themas extrahieren.
Sie können ein Thema für Ihre Arbeitsmappe in Microsoft Excel über den Befehl Seite-Layout > Themen anwenden.
Beispiel
// 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(ExtractThemeData.class); | |
// Create workbook object | |
Workbook workbook = new Workbook(dataDir + "TestBook.xlsx"); | |
// Extract theme name applied to this workbook | |
System.out.println(workbook.getTheme()); | |
// Access first worksheet | |
Worksheet worksheet = workbook.getWorksheets().get(0); | |
// Access cell A1 | |
Cell cell = worksheet.getCells().get("A1"); | |
// Get the style object | |
Style style = cell.getStyle(); | |
// Extract theme color applied to this cell | |
System.out.println(style.getForegroundThemeColor().getColorType() == ThemeColorType.ACCENT_2); | |
// Extract theme color applied to the bottom border of the cell | |
Border bot = style.getBorders().getByBorderType(BorderType.BOTTOM_BORDER); | |
System.out.println(bot.getThemeColor().getColorType() == ThemeColorType.ACCENT_1); |
Beispielausgabe
Hier ist eine Beispielausgabe in der Konsole des oben genannten Codes.
Civic
true
true