Infoga bakgrundsbild till Excel

Inställning av arkbakgrund i Microsoft Excel

Så här ställer du in ett arks bakgrundsbild i Microsoft Excel (till exempel Microsoft Excel 2019):

  1. FrånSidlayout menyn, hittaUtskriftsformat och klicka sedan påBakgrund alternativ.
  2. Välj en bild för att ställa in arkets bakgrundsbild.

Inställningsarkbakgrund med Aspose.Cells

Koden nedan ställer in en bakgrundsbild med en bild från en ström.

import jpype
import asposecells
jpype.startJVM()
from asposecells.api import Workbook
# Create a new Workbook.
workbook = Workbook()
# Get the first worksheet.
worksheet = workbook.getWorksheets().get(0)
# Get the background picture.
with open('Background.jpg', 'rb') as f:
data = f.read()
# Set the background image for the sheet.
worksheet.setBackgroundImage(data)
# Save the excel file
workbook.save("output.xlsx")
jpype.shutdownJVM()