ویب پر گرفت اور تبدیل کرنے کے اوزار

URL اور HTML کو DOCX میں تبدیل کریں

ازگر API

ایچ ٹی ایم ایل یا ویب صفحات کو تبدیل کرنے کی صلاحیت شامل کرنا into آپ کی درخواست میں لفظ دستاویزات کبھی بھی آسان نہیں تھے GrabzIt کا ازگر API. تاہم ، اس سے پہلے کہ آپ فون کریں ، یاد رکھیں یو آر ایل ٹوڈاکس, HTMLToDOCX or FileToDOCX طریقوں Save or SaveTo دراصل DOCX بنانے کے ل method طریقہ کو پکارا جانا چاہئے۔

بنیادی اختیارات

DOCX کے بطور ویب صفحات پر گرفت پورے ویب صفحے کو تبدیل کرتی ہے 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

کسٹم شناختی

آپ کو ایک کسٹم شناخت کنندہ پاس کرسکتے ہیں DOCX جیسا کہ ذیل میں دکھایا گیا ہے ، اس کی قیمت آپ کے GrabzIt ازگر ہینڈلر کو واپس کردی جاتی ہے۔ مثال کے طور پر یہ کسٹم شناخت کنندہ ایک ڈیٹا بیس کا شناخت کنندہ ہوسکتا ہے ، جس سے 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")

ہیڈر اور فوٹر

ورڈ دستاویز میں ہیڈر یا فوٹر شامل کرنے کے ل you آپ درخواست کرسکتے ہیں کہ آپ کسی خاص کو لاگو کرنا چاہتے ہیں سانچے 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 عنصر کو DOCX میں تبدیل کریں

اگر آپ صرف کسی HTML عنصر کو تبدیل کرنا چاہتے ہیں جیسے کہ Div یا مدت براہ راست intoa ورڈ دستاویز جو آپ GrabzIt کی ازگر لائبریری کے ساتھ کرسکتے ہیں۔ آپ کو پاس کرنا ہوگا سی ایس ایس سلیکٹر 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")