Skip to content

More info on libraries imported through spire.Doc and spire.Doc.common? #5

@ShekharNarayanan

Description

@ShekharNarayanan

Hi! First, thanks for making this awesome tool. The only reason I made an issue is that when I use spire.Doc along with along libraries that also deal with conversion of documents, it is hard to tell what I am importing from spire.Doc and spire.Doc.common.

Here is some code below using popular libraries like python-docx that will cause issues with spire.Doc


from spire.doc import *
from spire.doc.common import *
from docx import Document 

So now if I wanted to parse through paragraphs of a docx file:

for file_path in tqdm(input_paths,total=len(input_paths) ,desc="merging docx files into one file"):
            src = Document(file_path)
            for para in src.paragraphs:
                merged_docx.add_paragraph(para.text)

This will cause a conflict as the Document class exists both in the API and the python-docx library, and the methods from both are not common/integrated i.e., paragraphs. I am aware that I can import the Document class from other libraries with different import names, but I would like to do the same for spire.Doc as well as it will improve readability by quite a bit!

If users could have some insight into what classes/ functions (e.g., Document) are in spire.Doc or spire.Doc.common it would be very useful, and perhaps will make the usage of the API more compatible with other popular conversion libraries.

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions