I've created a MWE, which can be found at github: /EricRobertCampbell/spire-doc-failure-mwe.
The code is
- Code: Select all
#!/usr/bin/env python3
from spire.doc import *
from spire.doc.common import *
def main():
doc = Document()
section = doc.AddSection()
table = Table(doc, True)
section.Tables.Add(table)
doc.SaveToFile("table.docx", FileFormat.Docx2019)
doc.Close()
doc.Dispose()
if __name__ == "__main__":
main()
which is taken almost vebatim from the tutorial here: (this site) /Tutorials/Python/Spire.Doc-for-Python/Program-Guide/Table/Python-Create-Tables-in-a-Word-Document.html.
The error in this case is
- Code: Select all
Traceback (most recent call last):
File "/home/eric/documents/spire-doc-failure-poc/./generate.py", line 20, in <module>
main()
File "/home/eric/documents/spire-doc-failure-poc/./generate.py", line 11, in main
table = Table(doc, True)
File "/home/eric/documents/spire-doc-failure-poc/venv/lib/python3.9/site-packages/plum/function.py", line 642, in __call__
return self.f(self.instance, *args, **kw_args)
File "/home/eric/documents/spire-doc-failure-poc/venv/lib/python3.9/site-packages/plum/function.py", line 592, in __call__
return _convert(method(*args, **kw_args), return_type)
File "/home/eric/documents/spire-doc-failure-poc/venv/lib/python3.9/site-packages/spire/doc/Table.py", line 37, in __init__
intPtr = CallCFunction(GetDllLibDoc().Table_CreateTableDS,intPdoc,showBorder)
File "/home/eric/documents/spire-doc-failure-poc/venv/lib/python3.9/site-packages/spire/doc/common/__init__.py", line 105, in CallCFunction
result = func(*args, **kwargs)
RuntimeError: ffi_prep_cif_var failed
Exception ignored in: <function SpireObject.__del__ at 0x7f1d93c1dee0>
Traceback (most recent call last):
File "/home/eric/documents/spire-doc-failure-poc/venv/lib/python3.9/site-packages/spire/doc/common/SpireObject.py", line 31, in __del__
CallCFunction(dlllib.Spire_FreeHandle,self.Ptr)
File "/home/eric/documents/spire-doc-failure-poc/venv/lib/python3.9/site-packages/spire/doc/common/SpireObject.py", line 27, in Ptr
return self._ptr
AttributeError: 'Table' object has no attribute '_ptr'
We are also using Spire.Xls on the same project, and I can use that just fine.
My environment:
Windows: 11 Home, version 10.0.22631 Build 22631
Python: 3.9.16
Spire.Doc 12.4.0
WSL Version 2.2.4.0
WSL Kernel Version 5.15.153.1-2 (Ubuntu)
Sorry for the lack of proper URLs; apparently I'm not allowed to post them.
Please let me know if there's any additional information I can provide. We would very much like to use this, but obviously the inability to create tables or change formatting options is a deal breaker!