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.

Tue Jul 30, 2024 2:48 am

Used Spire.Doc for Python version: 12.7.1
Local Environment:maxOS-v14.4.1 python3.7

CODE:
Code: Select all
document = Document()
document.LoadFromFile(doc_path)  # This line of code throws an error.
document.SaveToFile(html_file_path, FileFormat.Html)
document.Close()


Exception:
Code: Select all
TypeInitialization_Type_NoTypeAvailable:   at System.Runtime.CompilerServices.ClassConstructorRunner.EnsureClassConstructorRun(StaticClassConstructionContext*) + 0x148
   at System.Runtime.CompilerServices.ClassConstructorRunner.CheckStaticClassConstructionReturnNonGCStaticBase(StaticClassConstructionContext*, IntPtr) + 0x9
   at sprbsz..ctor(Int32, Int32, Single, Single, SKColorType) + 0x137
   at spreyl.spra() + 0x78
   at spreyl.sprd(Stream) + 0x132
   at sprf6f.spra(Stream, spreym) + 0x216
   at sprexp.spra(ShapeBase, Boolean, sprf6i) + 0x44f
   at sprexp.spra(ShapeBase, Paragraph) + 0x786
   at sprexp.spra(ParagraphBase, Boolean&, ParagraphBase&) + 0x2f3
   at sprexp.spre(Paragraph) + 0x624
   at sprexp.spra(Section) + 0x459
   at sprexp.sprc(Document) + 0x51b
   at sprexp.sprb(Document, String) + 0x13a
   at sprexp.sprc(Document, String) + 0x524
   at Spire.Doc.Document.sprq(String) + 0x56
   at Spire.Doc.AOT.NLDocument.Document_SaveToFileFF(IntPtr, IntPtr, Int32, IntPtr) + 0x71

waynespt
 
Posts: 6
Joined: Mon Jul 29, 2024 8:57 am

Tue Jul 30, 2024 9:45 am

Hello,

Thanks for your inquriy.
I tested your case with Python 3.12.4, but did not reproduce the issue you mentioned. Can you switch to this version and retest the code?

Sincerely,
William
E-iceblue support team
User avatar

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

Wed Jul 31, 2024 2:53 am

This error occurs in Python 3.9+.
WX20240731-105516.png

waynespt
 
Posts: 6
Joined: Mon Jul 29, 2024 8:57 am

Wed Jul 31, 2024 10:12 am

Hello,

Thanks for your reply.
Have you tried installing whl file of our Spire.Doc directly?

Sincerely,
William
E-iceblue support team
User avatar

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

Fri Aug 02, 2024 8:39 am

The error still occurs, and my colleagues around me are experiencing the same issue.
111.png

waynespt
 
Posts: 6
Joined: Mon Jul 29, 2024 8:57 am

Mon Aug 05, 2024 3:31 am

Hello,

Thanks for your reply.
Can we further discuss through QQ? Our company's QQ number is 2790765778.

Sincerely,
William
E-iceblue support team
User avatar

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

Return to Spire.Doc

cron