वेब पर कब्जा और परिवर्तित करने के लिए उपकरण

URL और HTML को DOCX में बदलें

Node.js एपीआई

HTML या वेबपृष्ठों को परिवर्तित करने की क्षमता जोड़ना intआपके आवेदन के लिए वर्ड दस्तावेज़ कभी भी आसान नहीं रहे हैं GrabzIt की Node.js एपीआई। हालांकि इससे पहले कि आप याद रखें कि कॉल करने के बाद url_to_docx, html_to_docx or file_to_docx तरीके save or save_to विधि को वास्तव में DOCX बनाने के लिए कहा जाना चाहिए।

मूल विकल्प

DOCX के रूप में वेबपृष्ठों को कैप्चर करना पूरे वेब पेज को परिवर्तित करता है intoa वर्ड डॉक्यूमेंट जिसमें कई पेज हो सकते हैं। वेब पेज को रूपांतरित करने के लिए केवल एक पैरामीटर की आवश्यकता होती है intoa वर्ड डॉक्यूमेंट या HTML को DOCX में बदलें जैसा कि नीचे दिए गए उदाहरणों में दिखाया गया है।

client.url_to_docx("https://www.tesla.com");
//Then call the save or save_to method
client.html_to_docx("<html><body><h1>Hello World!</h1></body></html>");
//Then call the save or save_to method
client.file_to_docx("example.html");
//Then call the save or save_to method

कस्टम पहचानकर्ता

आप एक कस्टम पहचानकर्ता को पास कर सकते हैं Docx नीचे दिखाए गए तरीके, यह मान तब आपके GrabzIt Node.js हैंडलर को वापस कर दिया जाता है। उदाहरण के लिए, यह कस्टम पहचानकर्ता एक डेटाबेस पहचानकर्ता हो सकता है, जो किसी विशेष डेटाबेस रिकॉर्ड के साथ DOCX दस्तावेज़ को जोड़ने की अनुमति देता है।

var grabzit = require('grabzit');

var client = new grabzit("Sign in to view your Application Key", "Sign in to view your Application Secret");

var options = {"customId":123456};

client.url_to_docx("https://www.tesla.com", options);
//Then call the save method
client.save("http://www.example.com/handler", function (error, id){
    if (error != null){
        throw error;
    }
});
var grabzit = require('grabzit');

var client = new grabzit("Sign in to view your Application Key", "Sign in to view your Application Secret");

var options = {"customId":123456};

client.html_to_docx("<html><body><h1>Hello World!</h1></body></html>", options);
//Then call the save method
client.save("http://www.example.com/handler", function (error, id){
    if (error != null){
        throw error;
    }
});
var grabzit = require('grabzit');

var client = new grabzit("Sign in to view your Application Key", "Sign in to view your Application Secret");

var options = {"customId":123456};

client.file_to_docx("example.html", options);
//Then call the save method
client.save("http://www.example.com/handler", function (error, id){
    if (error != null){
        throw error;
    }
});

शीर्षलेख और पाद लेख

किसी वर्ड डॉक्यूमेंट में हेडर या फूटर जोड़ने के लिए आप अनुरोध कर सकते हैं कि आप किसी विशेष को लागू करना चाहते हैं टेम्पलेट DOCX को जनरेट किया जा रहा है। यह टेम्पलेट होना चाहिए saveडी अग्रिम में और किसी विशेष चर के साथ हेडर और फुटर की सामग्री को निर्दिष्ट करेगा। उपयोगकर्ता के नीचे दिए गए उदाहरण कोड में वे "मेरे टेम्पलेट" नामक एक टेम्पलेट का उपयोग कर रहे हैं।

var grabzit = require('grabzit');

var client = new grabzit("Sign in to view your Application Key", "Sign in to view your Application Secret");

var options = {"templateId":"my template"};

client.url_to_docx("https://www.tesla.com", options);
//Then call the save or save_to method
client.save_to("result.docx", function (error, id){
    //this callback is called once the capture is downloaded
    if (error != null){
        throw error;
    }
});
var grabzit = require('grabzit');

var client = new grabzit("Sign in to view your Application Key", "Sign in to view your Application Secret");

var options = {"templateId":"my template"};

client.html_to_docx("<html><body><h1>Hello World!</h1></body></html>", options);
//Then call the save or save_to method
client.save_to("result.docx", function (error, id){
    //this callback is called once the capture is downloaded
    if (error != null){
        throw error;
    }
});
var grabzit = require('grabzit');

var client = new grabzit("Sign in to view your Application Key", "Sign in to view your Application Secret");

var options = {"templateId":"my template"};

client.file_to_docx("example.html", options);
//Then call the save or save_to method
client.save_to("result.docx", function (error, id){
    //this callback is called once the capture is downloaded
    if (error != null){
        throw error;
    }
});

HTML तत्व को DOCX में बदलें

यदि आप किसी HTML एलिमेंट जैसे डिव या स्पैन को सीधे कन्वर्ट करना चाहते हैं intoa Word दस्तावेज़ आप GrabzIt's Node.js लाइब्रेरी के साथ कर सकते हैं। आपको पास होना चाहिए सीएसएस चयनकर्ता जिस HTML एलिमेंट को आप कन्वर्ट करना चाहते हैं setTargetElement पैरामीटर।

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

इस उदाहरण में, हम उस अवधि की सभी सामग्री को कैप्चर करना चाहते हैं जिसके पास आईडी है Article, इसलिए हम इसे GrabzIt API से पास करते हैं जैसा कि नीचे दिखाया गया है।

var grabzit = require('grabzit');

var client = new grabzit("Sign in to view your Application Key", "Sign in to view your Application Secret");

client.url_to_docx("http://www.bbc.co.uk/news", {"targetElement": "#Article"});
//Then call the save or save_to method
client.save_to("result.docx", function (error, id){
    //this callback is called once the capture is downloaded
    if (error != null){
        throw error;
    }
});