Extrahera temadata från Excel fil

C#-kod för att extrahera temadata från Excel-fil

Följande kodexempel extraherar temanamnet som tillämpats på källarbete bok och sedan extraherar det temafärg som tillämpas på cell A1 och temafärg som tillämpas på cellens nedre kant.

from aspose.cells import BorderType, Workbook
# For complete examples and data files, please go to https:# github.com/aspose-cells/Aspose.Cells-for-.NET
# The path to the documents directory.
dataDir = RunExamples.GetDataDir(".")
# Create workbook object
workbook = Workbook(dataDir + "source.xlsx")
# Extract theme name applied to this workbook
print(workbook.theme)
# Access first worksheet
worksheet = workbook.worksheets[0]
# Access cell A1
cell = worksheet.cells.get("A1")
# Get the style object
style = cell.get_style()
if style.foreground_theme_color != None:
# Extract theme color applied to this cell if theme has foregroundtheme color defined
print(style.foreground_theme_color.color_type)
else:
print("Theme has not foreground color defined.")
# Extract theme color applied to the bottom border of the cell if theme has border color defined
bot = style.borders.get(BorderType.BOTTOM_BORDER)
if bot.theme_color != None:
print(bot.theme_color.color_type)
else:
print("Theme has not Border color defined.")