એચટીએમએલ અથવા વેબપેજને કન્વર્ટ કરવાની ક્ષમતા ઉમેરવી into તમારી એપ્લિકેશનના શબ્દ દસ્તાવેજો સાથે ક્યારેય સરળ નહોતા GrabzIt ની Node.js API. જો કે તમે પ્રારંભ કરતા પહેલા યાદ રાખો કે ફોન કર્યા પછી url_to_docx, html_to_docx or file_to_docx પદ્ધતિઓ save or save_to ખરેખર DOCX બનાવવા માટે પદ્ધતિને ક .લ કરવી આવશ્યક છે.
વેબ પૃષ્ઠોને DOCX તરીકે કેપ્ચર કરવું એ આખા વેબ પૃષ્ઠને રૂપાંતરિત કરે છે intOa વર્ડ ડોક્યુમેન્ટ જેમાં ઘણા પૃષ્ઠો શામેલ હોઈ શકે છે. વેબ પૃષ્ઠને કન્વર્ટ કરવા માટે ફક્ત એક જ પરિમાણ આવશ્યક છે intઓએ વર્ડ ડોક્યુમેન્ટ અથવા ટુ 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
તમે કસ્ટમ ઓળખાણકર્તાને પાસ કરી શકો છો ડોક્સ નીચે બતાવેલ પદ્ધતિઓ, આ મૂલ્ય પછી તમારા 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; } });
જો તમે ફક્ત એચટીએમએલ તત્વ જેમ કે ડીવી અથવા સ્પ spન સીધા રૂપાંતરિત કરવા માંગો છો intOa વર્ડ દસ્તાવેજ તમે GrabzIt ની Node.js લાઇબ્રેરી સાથે કરી શકો છો. તમારે પાસ કરવું આવશ્યક છે સીએસએસ પસંદગીકાર તમે HTML માં કન્વર્ટ કરવા માંગો છો તે 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; } });