HTML ਜਾਂ ਵੈਬ ਪੇਜਾਂ ਨੂੰ ਬਦਲਣ ਦੀ ਯੋਗਤਾ ਸ਼ਾਮਲ ਕਰਨਾ into ਤੁਹਾਡੀ ਅਰਜ਼ੀ ਦੇ ਸ਼ਬਦ ਦਸਤਾਵੇਜ਼ ਇਸ ਨਾਲ ਕਦੇ ਵੀ ਅਸਾਨ ਨਹੀਂ ਹੋਏ ਗਰੈਬਜ਼ਆਈਟੀ ਦਾ ਪਾਈਥਨ API. ਪਰ ਤੁਹਾਨੂੰ ਸ਼ੁਰੂ ਕਰਨ ਤੋਂ ਪਹਿਲਾਂ ਯਾਦ ਰੱਖੋ ਕਿ ਫੋਨ ਕਰਨ ਤੋਂ ਬਾਅਦ URL ਟੂਡੋਕੈਕਸ, HTMLToDOCX or FileToDOCX theੰਗ Save or SaveTo ਅਸਲ ਵਿੱਚ DOCX ਬਣਾਉਣ ਲਈ methodੰਗ ਨੂੰ ਬੁਲਾਇਆ ਜਾਣਾ ਚਾਹੀਦਾ ਹੈ.
ਵੈਬ ਪੇਜਾਂ ਨੂੰ ਡੀਓਸੀਐਕਸ ਦੇ ਤੌਰ ਤੇ ਕੈਪਚਰ ਕਰਨਾ ਪੂਰੇ ਵੈੱਬ ਪੇਜ ਨੂੰ ਬਦਲਦਾ ਹੈ intoa ਵਰਡ ਡੌਕੂਮੈਂਟ ਜਿਸ ਵਿੱਚ ਬਹੁਤ ਸਾਰੇ ਪੰਨੇ ਹੋ ਸਕਦੇ ਹਨ. ਵੈਬ ਪੇਜ ਨੂੰ ਬਦਲਣ ਲਈ ਸਿਰਫ ਇੱਕ ਪੈਰਾਮੀਟਰ ਦੀ ਲੋੜ ਹੁੰਦੀ ਹੈ intoa ਵਰਡ ਡੌਕੂਮੈਂਟ ਜਾਂ HTML ਨੂੰ DOCX ਵਿੱਚ ਤਬਦੀਲ ਕਰੋ ਜਿਵੇਂ ਕਿ ਹੇਠਾਂ ਦਿੱਤੀਆਂ ਉਦਾਹਰਣਾਂ ਵਿੱਚ ਦਿਖਾਇਆ ਗਿਆ ਹੈ.
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
ਤੁਸੀਂ ਇੱਕ ਕਸਟਮ ਪਛਾਣਕਰਤਾ ਨੂੰ ਪਾਸ ਕਰ ਸਕਦੇ ਹੋ ਡੌਕਸ shownੰਗ ਜਿਵੇਂ ਕਿ ਹੇਠਾਂ ਦਰਸਾਇਆ ਗਿਆ ਹੈ, ਇਹ ਮੁੱਲ ਫਿਰ ਤੁਹਾਡੇ ਗਰੈਬਜ਼ਿਟ ਪਾਈਥਨ ਹੈਂਡਲਰ ਨੂੰ ਵਾਪਸ ਕਰ ਦਿੱਤਾ ਜਾਵੇਗਾ. ਉਦਾਹਰਣ ਦੇ ਲਈ ਇਹ ਕਸਟਮ ਪਛਾਣਕਰਤਾ ਇੱਕ ਡੇਟਾਬੇਸ ਪਛਾਣਕਰਤਾ ਹੋ ਸਕਦਾ ਹੈ, ਜਿਸ ਨਾਲ ਇੱਕ 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.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")
ਕਿਸੇ ਵਰਡ ਡੌਕੂਮੈਂਟ ਵਿਚ ਸਿਰਲੇਖ ਜਾਂ ਫੁੱਟਰ ਜੋੜਨ ਲਈ ਤੁਸੀਂ ਬੇਨਤੀ ਕਰ ਸਕਦੇ ਹੋ ਕਿ ਤੁਸੀਂ ਕਿਸੇ ਵਿਸ਼ੇਸ਼ ਨੂੰ ਲਾਗੂ ਕਰਨਾ ਚਾਹੁੰਦੇ ਹੋ ਟੈਪਲੇਟ ਨੂੰ ਤਿਆਰ ਕੀਤਾ ਜਾ ਰਿਹਾ DOCX ਕਰਨ ਲਈ. ਇਹ ਨਮੂਨਾ ਹੋਣਾ ਚਾਹੀਦਾ ਹੈ 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ਓ ਵਰਡ ਡੌਕੂਮੈਂਟ ਜੋ ਤੁਸੀਂ ਗਰੈਬਜ਼ਿਟ ਦੀ ਪਾਈਥਨ ਲਾਇਬ੍ਰੇਰੀ ਨਾਲ ਕਰ ਸਕਦੇ ਹੋ. ਤੁਹਾਨੂੰ ਪਾਸ ਕਰਨਾ ਚਾਹੀਦਾ ਹੈ CSS ਚੋਣਕਾਰ ਐਲੀਮੈਂਟਲ ਐਲਿਮੰਟ ਦਾ ਜਿਸ ਨੂੰ ਤੁਸੀਂ ਤਬਦੀਲ ਕਰਨਾ ਚਾਹੁੰਦੇ ਹੋ targetElement
GrabzIt ਦੀ ਵਿਧੀDOCXOptions ਕਲਾਸ.
... <span id="Article"> <p>This is the content I am interested in.</p> <img src="myimage.jpg"> </span> ...
ਇਸ ਉਦਾਹਰਣ ਵਿੱਚ, ਅਸੀਂ ਸਾਰੀ ਸਮਗਰੀ ਨੂੰ ਉਸ ਅਵਧੀ ਵਿੱਚ ਕੈਪਚਰ ਕਰਨਾ ਚਾਹੁੰਦੇ ਹਾਂ ਜਿਸ ਦੀ ਆਈ ਡੀ ਹੈ Article
, ਇਸ ਲਈ ਅਸੀਂ ਇਸਨੂੰ ਗ੍ਰਾਬਜ਼ਆਈਟੀ ਏਪੀਆਈ ਨੂੰ ਹੇਠਾਂ ਦਰਸਾਉਂਦੇ ਹੋਏ ਪਾਸ ਕਰਦੇ ਹਾਂ.
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")