Spire.XLS is a professional Excel API that enables developers to create, manage, manipulate, convert and print Excel worksheets. Get free and professional technical support for Spire.XLS for .NET, Java, Android, C++, Python.

Tue Dec 09, 2025 12:27 am

I am attempting to use spire-xls. I have the "One Developer OEM Subscription" and received a license via email. However, it seems that my registration somehow isn't being applied, despite setting and loading the license.

I am using python 3.11.14 with spire-xls 15.7.1 (installed via pip).

I tried setting the license in two ways: via the xml file provided via email, and via the license key directly (contained in the xml file).

Code: Select all
from spire.xls import LicenseProvider as xlsLicense
# method A: using the XML file
from spire.xls import LicenseProvider as xlsLicense
xlsLicense.SetLicenseFileName("/path/to/license.xml")
xlsLicense.LoadLicense()

# method B: using the key directly
spire_license_key = "my_key_string_here"
xlsLicense.SetLicenseKey(spire_license_key)


No exception is raised using either method. However, I note that *after* registering the license, my Python code which extracts chart images (using SaveChartAsImage) fails, with the exception `Failed to extract chart 0 from sheet 0: Format_BadBase64Char: at System.Convert.FromBase64CharPtr(Char*, Int32) + 0xb6`. When I use the same code, but without registering the license, the same Python code (using the same input file) extracts chart images successfully, but the images contain the Spire "Evaluation Warning" watermark.

Is this a problem with how I am registering the license? Could there be a bug in the SaveChartAsImage code path? Is there a way to "check" that a license has been properly validated?

jgardner
 
Posts: 1
Joined: Mon Oct 27, 2025 8:42 pm

Tue Dec 09, 2025 3:58 am

Hello,

Thank you for your inquiry.
The issue you encountered is due to a failure in applying your license. When using the method of reading the license file path, certain read permissions for the license file are required. We recommend applying the license using the license key value method instead. Please refer to the following sample code for applying the license:
Code: Select all
from spire.xls import *
from spire.xls.common import License as xlsLicense

spire_license_key = "your license key "
xlsLicense.SetLicenseKey(spire_license_key)

inputFile = r"ChartToImage.xlsx"
outputFile = r"ChartToImage2.png"
#Create a workbook
workbook = Workbook()
workbook.LoadFromFile(inputFile)
#Save chart as image
image = workbook.SaveChartAsImage(workbook.Worksheets[0], 0)
image.Save(outputFile)
workbook.Dispose()
image.Dispose()


Please note that the key value is the long string of characters in the license file. Ensure that you copy the entire key value completely (starting with "Bwn1" and ending with "BzQ=="). If your issue persists, please send your complete code to my email: [email protected]. We will conduct further investigation and look forward to your test feedback.
Sincerely,
Talia
E-iceblue support team
User avatar

talia.liu
 
Posts: 341
Joined: Mon Apr 14, 2025 3:33 am

Return to Spire.XLS