વેબને કેપ્ચર અને કન્વર્ટ કરવા માટેનાં સાધનો

URL ને અને HTML ને DOCX માં કન્વર્ટ કરો

રૂબી API

એચટીએમએલ અથવા વેબપેજને કન્વર્ટ કરવાની ક્ષમતા ઉમેરવી into તમારી એપ્લિકેશનના શબ્દ દસ્તાવેજો સાથે ક્યારેય સરળ નહોતા GrabzIt નું રૂબી API. જો કે તમે પ્રારંભ કરતા પહેલા યાદ રાખો કે ફોન કર્યા પછી url_to_docx, html_to_docx or file_to_docx પદ્ધતિઓ save or save_to ખરેખર DOCX બનાવવા માટે પદ્ધતિને ક .લ કરવી આવશ્યક છે.

મૂળભૂત વિકલ્પો

વેબ પૃષ્ઠોને DOCX તરીકે કેપ્ચર કરવું એ આખા વેબ પૃષ્ઠને રૂપાંતરિત કરે છે intOa વર્ડ ડોક્યુમેન્ટ જેમાં ઘણા પૃષ્ઠો શામેલ હોઈ શકે છે. વેબ પૃષ્ઠને કન્વર્ટ કરવા માટે ફક્ત એક જ પરિમાણ આવશ્યક છે intઓએ વર્ડ ડોક્યુમેન્ટ અથવા ટુ HTML ને DOCX માં કન્વર્ટ કરો નીચેના ઉદાહરણોમાં બતાવ્યા પ્રમાણે.

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

કસ્ટમ ઓળખકર્તા

તમે કસ્ટમ ઓળખાણકર્તાને પાસ કરી શકો છો ડોક્સ નીચે બતાવેલ પદ્ધતિઓ, આ મૂલ્ય પછી તમારા GrabzIt રૂબી હેન્ડલર પર પાછા ફર્યા છે. હમણાં પૂરતું આ કસ્ટમ આઇડેન્ટિફાયર ડેટાબેસ ઓળખકર્તા હોઈ શકે છે, જેમાં કોઈ ડીઓસીએક્સ દસ્તાવેજને ચોક્કસ ડેટાબેઝ રેકોર્ડ સાથે જોડવાની મંજૂરી આપવામાં આવે છે.

grabzItClient = GrabzIt::Client.new("Sign in to view your Application Key", "Sign in to view your Application Secret")

options = GrabzIt::DOCXOptions.new()
options.customId = "123456"

grabzItClient.url_to_docx("https://www.tesla.com", options)
# Then call the save method
grabzItClient.save("http://www.example.com/handler/index")
grabzItClient = GrabzIt::Client.new("Sign in to view your Application Key", "Sign in to view your Application Secret")

options = GrabzIt::DOCXOptions.new()
options.customId = "123456"

grabzItClient.html_to_docx("<html><body><h1>Hello World!</h1></body></html>", options)
# Then call the save method
grabzItClient.save("http://www.example.com/handler/index")
grabzItClient = GrabzIt::Client.new("Sign in to view your Application Key", "Sign in to view your Application Secret")

options = GrabzIt::DOCXOptions.new()
options.customId = "123456"

grabzItClient.file_to_docx("example.html", options)
# Then call the save method
grabzItClient.save("http://www.example.com/handler/index")

હેડરો અને ફૂટર્સ

વર્ડ ડોક્યુમેન્ટમાં હેડર અથવા ફૂટર ઉમેરવા માટે તમે વિનંતી કરી શકો છો કે તમે કોઈ ખાસ લાગુ કરવા માંગો છો નમૂનો DOCX જનરેટ થઈ રહી છે. આ ટેમ્પલેટ હોવો જોઈએ saveડી અગાઉથી અને કોઈપણ ખાસ ચલો સાથે હેડર અને ફૂટરની સામગ્રીનો ઉલ્લેખ કરશે. નીચે આપેલા ઉદાહરણ કોડમાં વપરાશકર્તા નમૂના બનાવે છે જેનો તેઓએ "મારુ ટેમ્પલેટ" કહે છે.

grabzItClient = GrabzIt::Client.new("Sign in to view your Application Key", "Sign in to view your Application Secret")

options = GrabzIt::DOCXOptions.new()
options.templateId = "my template"

grabzItClient.url_to_docx("https://www.tesla.com", options)
# Then call the save or save_to method
grabzItClient.save_to("result.docx")
grabzItClient = GrabzIt::Client.new("Sign in to view your Application Key", "Sign in to view your Application Secret")

options = GrabzIt::DOCXOptions.new()
options.templateId = "my template"

grabzItClient.html_to_docx("<html><body><h1>Hello World!</h1></body></html>", options)
# Then call the save or save_to method
grabzItClient.save_to("result.docx")
grabzItClient = GrabzIt::Client.new("Sign in to view your Application Key", "Sign in to view your Application Secret")

options = GrabzIt::DOCXOptions.new()
options.templateId = "my template"

grabzItClient.file_to_docx("example.html", options)
# Then call the save or save_to method
grabzItClient.save_to("result.docx")

HTML તત્વને DOCX માં કન્વર્ટ કરો

જો તમે ફક્ત એચટીએમએલ તત્વ જેમ કે ડીવી અથવા સ્પ spન સીધા રૂપાંતરિત કરવા માંગો છો intOa વર્ડ દસ્તાવેજ તમે GrabzIt ના રૂબી જેમ સાથે કરી શકો છો. તમારે પાસ કરવું આવશ્યક છે સીએસએસ પસંદગીકાર તમે HTML માં કન્વર્ટ કરવા માંગો છો તે HTML ઘટક છે targetElement ની પદ્ધતિ DOCXOptions વર્ગ.

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

આ ઉદાહરણમાં, અમે સ્પેનમાં બધી સામગ્રી કેપ્ચર કરવા માંગીએ છીએ જેની આઈડી છે Article, તેથી અમે નીચે બતાવ્યા પ્રમાણે તેને GrabzIt API પર પસાર કરીએ છીએ.

grabzItClient = GrabzIt::Client.new("Sign in to view your Application Key", "Sign in to view your Application Secret")

options = GrabzIt::DOCXOptions.new()
options.targetElement = "#Article"

grabzItClient.url_to_docx("http://www.bbc.co.uk/news", options)
# Then call the save or save_to method
grabzItClient.save_to("result.docx")