वेब कॅप्चर आणि रूपांतरित करण्यासाठी साधने

URL आणि HTML ला DOCX मध्ये रूपांतरित करा

पायथन एपीआय

एचटीएमएल किंवा वेबपृष्ठे रूपांतरित करण्याची क्षमता जोडणे into आपल्या अनुप्रयोगातील शब्द कागदपत्रे यापेक्षा सोपे कधीच नव्हते ग्रॅबझिटची पायथन एपीआय. तथापि आपण सुरू करण्यापूर्वी लक्षात ठेवा की कॉल केल्यावर URLToDOCX, HTMLToDOCX or FileToDOCX पद्धती Save or SaveTo प्रत्यक्षात डीओसीएक्स तयार करण्यासाठी मेथड कॉल केला पाहिजे.

मूलभूत पर्याय

डीओसीएक्स म्हणून वेबपृष्ठे कॅप्चर करणे संपूर्ण वेब पृष्ठ रुपांतरित करते intoa शब्द दस्तऐवज ज्यात बर्‍याच पृष्ठांचा समावेश असू शकतो. वेबपृष्ठ रूपांतरित करण्यासाठी फक्त एक पॅरामीटर आवश्यक आहे intoa वर्ड डॉक्युमेंट किंवा टू एचटीएमएलला डीओसीएक्समध्ये रूपांतरित करा खाली दिलेल्या उदाहरणांनुसार दर्शविले आहे.

grabzIt.URLToDOCX("https://www.tesla.com")
# Then call the Save or SaveTo method
grabzIt.HTMLToDOCX("<html><body><h1>Hello World!</h1></body></html>")
# Then call the Save or SaveTo method
grabzIt.FileToDOCX("example.html")
# Then call the Save or SaveTo method

सानुकूल अभिज्ञापक

आपण एक सानुकूल अभिज्ञापक पास करू शकता डॉक्स खाली दर्शविल्या गेलेल्या पद्धती, हे मूल्य नंतर आपल्या GrabzIt पायथन हँडलरला परत केले जाईल. उदाहरणार्थ, हा सानुकूल अभिज्ञापक डेटाबेस अभिज्ञापक असू शकतो, ज्यामुळे डीओसीएक्स दस्तऐवज विशिष्ट डेटाबेस रेकॉर्डशी संबद्ध केला जाऊ शकतो.

from GrabzIt import GrabzItDOCXOptions
from GrabzIt import GrabzItClient

grabzIt = GrabzItClient.GrabzItClient("Sign in to view your Application Key", "Sign in to view your Application Secret")

options = GrabzItDOCXOptions.GrabzItDOCXOptions()
options.customId = "123456"

grabzIt.URLToDOCX("https://www.tesla.com", options)
# Then call the Save method
grabzIt.Save("http://www.example.com/handler.py")
from GrabzIt import GrabzItDOCXOptions
from GrabzIt import GrabzItClient

grabzIt = GrabzItClient.GrabzItClient("Sign in to view your Application Key", "Sign in to view your Application Secret")

options = GrabzItDOCXOptions.GrabzItDOCXOptions()
options.customId = "123456"

grabzIt.HTMLToDOCX("<html><body><h1>Hello World!</h1></body></html>", options)
# Then call the Save method
grabzIt.Save("http://www.example.com/handler.py")
from GrabzIt import GrabzItDOCXOptions
from GrabzIt import GrabzItClient

grabzIt = GrabzItClient.GrabzItClient("Sign in to view your Application Key", "Sign in to view your Application Secret")

options = GrabzItDOCXOptions.GrabzItDOCXOptions()
options.customId = "123456"

grabzIt.FileToDOCX("example.html", options)
# Then call the Save method
grabzIt.Save("http://www.example.com/handler.py")

शीर्षलेख आणि तळटीप

वर्ड दस्तऐवजात शीर्षलेख किंवा तळटीप जोडण्यासाठी आपण विनंती करू शकता की आपण एखादा विशिष्ट अर्ज करू इच्छित आहात साचा डीओएक्सएक्सला व्युत्पन्न केले जात आहे हे टेम्पलेट असणे आवश्यक आहे saveडी आगाऊ आहे आणि हेडर आणि फूटरची सामग्री कोणत्याही विशिष्ट व्हेरिएबल्ससह निर्दिष्ट करेल. खाली दिलेल्या कोडमध्ये वापरकर्ता "टेम्पलेट" म्हणून त्यांनी तयार केलेला टेम्पलेट वापरत आहे.

from GrabzIt import GrabzItDOCXOptions
from GrabzIt import GrabzItClient

grabzIt = GrabzItClient.GrabzItClient("Sign in to view your Application Key", "Sign in to view your Application Secret")

options = GrabzItDOCXOptions.GrabzItDOCXOptions()
options.templateId = "my template"

grabzIt.URLToDOCX("https://www.tesla.com", options)
# Then call the Save or SaveTo method
grabzIt.SaveTo("result.docx")
from GrabzIt import GrabzItDOCXOptions
from GrabzIt import GrabzItClient

grabzIt = GrabzItClient.GrabzItClient("Sign in to view your Application Key", "Sign in to view your Application Secret")

options = GrabzItDOCXOptions.GrabzItDOCXOptions()
options.templateId = "my template"

grabzIt.HTMLToDOCX("<html><body><h1>Hello World!</h1></body></html>", options)
# Then call the Save or SaveTo method
grabzIt.SaveTo("result.docx")
from GrabzIt import GrabzItDOCXOptions
from GrabzIt import GrabzItClient

grabzIt = GrabzItClient.GrabzItClient("Sign in to view your Application Key", "Sign in to view your Application Secret")

options = GrabzItDOCXOptions.GrabzItDOCXOptions()
options.templateId = "my template"

grabzIt.FileToDOCX("example.html", options)
# Then call the Save or SaveTo method
grabzIt.SaveTo("result.docx")

HTML घटक डीओसीएक्समध्ये रूपांतरित करा

आपण फक्त एखादा एचटीएमएल घटक रूपांतरित करू इच्छित असाल जसे की डिव किंवा स्पॅन थेट intओ वर्ड डॉक्युमेंट जे तुम्ही ग्रॅबझिटच्या पायथन लायब्ररीमध्ये करू शकता आपण पास करणे आवश्यक आहे सीएसएस निवडकर्ता आपण रूपांतरित करू इच्छित HTML घटकाचे targetElement GrabzIt पद्धतDOCXOptions वर्ग.

...
<span id="Article">
<p>This is the content I am interested in.</p>
<img src="myimage.jpg">
</span>
...

या उदाहरणात, आम्ही आयडी असलेल्या स्पॅनमधील सर्व सामग्री हस्तगत करू इच्छितो Article, म्हणून आम्ही खाली दर्शविल्यानुसार हे GrabzIt API वर पाठवित आहोत.

from GrabzIt import GrabzItDOCXOptions
from GrabzIt import GrabzItClient

grabzIt = GrabzItClient.GrabzItClient("Sign in to view your Application Key", "Sign in to view your Application Secret")

options = GrabzItDOCXOptions.GrabzItDOCXOptions()
options.targetElement = "#Article"

grabzIt.URLToDOCX("http://www.bbc.co.uk/news", options)
# Then call the Save or SaveTo method
grabzIt.SaveTo("result.docx")