• Post Reply Bookmark Topic Watch Topic
  • New Topic
programming forums Java Mobile Certification Databases Caching Books Engineering Micro Controllers OS Languages Paradigms IDEs Build Tools Frameworks Application Servers Open Source This Site Careers Other all forums
this forum made possible by our volunteer staff, including ...
Marshals:
  • Campbell Ritchie
  • Devaka Cooray
  • Liutauras Vilda
  • Jeanne Boyarsky
  • Bear Bibeault
Sheriffs:
  • Paul Clapham
  • Knute Snortum
  • Rob Spoor
Saloon Keepers:
  • Tim Moores
  • Ron McLeod
  • Piet Souris
  • Stephan van Hulst
  • Carey Brown
Bartenders:
  • Tim Holloway
  • Frits Walraven
  • Ganesh Patekar

Adding, Replacing & Removing Bookmarks in Word in Java

 
Greenhorn
Posts: 2
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Introduction

A bookmark in Word works like a bookmark we might place in a book. We can use a bookmark to quickly jump to a specific location within a Word document. In this article, we’re going to introduce how to add bookmarks, replace the content of bookmarks and remove bookmarks in a Word document programmatically in Java using Free Spire.Doc for Java API.

Before Start

Download Free Spire.Doc for Java from this link and import the Spire.Doc.jar file into your Java project.

Using the code

  • Adding Bookmarks


  • The following example demonstrates how to add simple bookmark and nested bookmark to a Word document.




  • Replacing the content of bookmarks


  • The following examples shows how to replace the content of an existing bookmark.




  • Remove bookmarks


  • The following example shows how to remove a bookmark from a Word document but keep the content in the bookmark.




    Hope you find this article helpful and informative.
     
    It is sorta covered in the JavaRanch Style Guide.
    • Post Reply Bookmark Topic Watch Topic
    • New Topic
    Boost this thread!