Spire.Doc is a professional Word .NET library specifically designed for developers to create, read, write, convert and print Word document files. Get free and professional technical support for Spire.Doc for .NET, Java, Android, C++, Python.
Thu Apr 03, 2025 12:29 am
In python, when adding a string via `CustomDocumentProperties` - only the first character of the string is stored.
- Code: Select all
style_uuid = str(uuid.uuid4())
customProperties = doc.CustomDocumentProperties
customProperties.Add("Test1", String("Testing"))
customProperties.Add("Test2", String("Also Testing"))
customProperties.Add("Test3", DateTime(2024, 12, 31, 0, 0, 0, 0))
customProperties.Add("DocumentStyleUuid", String(style_uuid))
logging.debug(
f"Document style UUID: {style_uuid} - this will be used to create unique style names.")
# Add verification logging
try:
stored_uuid = customProperties.get_Item("DocumentStyleUuid").ToString()
logging.debug(
f"Verified stored DocumentStyleUuid value: {stored_uuid}")
except Exception as e:
logging.error(f"Failed to verify DocumentStyleUuid storage: {str(e)}")
- Code: Select all
DEBUG: Document style UUID: f3571b5b-4349-4eef-81e9-18581bf51e09 - this will be used to create unique style names.
DEBUG: Verified stored DocumentStyleUuid value: f
- Code: Select all
customProperties = doc.CustomDocumentProperties
for i in range(customProperties.Count):
try:
prop_name = customProperties.get_Item(i).Name
prop_value = customProperties.get_Item(i).ToString()
print(f"{prop_name}: {prop_value}")
except Exception as e:
logging.warning(
f"Failed to retrieve custom property '{i}': {str(e)}")
- Code: Select all
Test1: T
Test2: A
Test3: 12/31/2024 00:00:00
DocumentStyleUuid: f
DocumentVersion: 1
Login to view the files attached to this post.
-

01JQTKJTFXPCJ823TVMP
-
- Posts: 3
- Joined: Wed Apr 02, 2025 6:39 am
Fri Apr 04, 2025 10:22 am
Hello,
Thanks for your inquiry.
The issue you mentioned has been fixed in the latest
Spire.Doc for Python Version:13.3.8, please update and retest. Looking forward to your test results.
Sincerely,
William
E-iceblue support team
-


William.Zhang
-
- Posts: 732
- Joined: Mon Dec 27, 2021 2:23 am