Bookmark Topic Watch 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:
  • Liutauras Vilda
  • Campbell Ritchie
  • Tim Cooke
  • Bear Bibeault
  • Devaka Cooray
Sheriffs:
  • Jeanne Boyarsky
  • Knute Snortum
  • Junilu Lacar
Saloon Keepers:
  • Tim Moores
  • Ganesh Patekar
  • Stephan van Hulst
  • Pete Letkeman
  • Carey Brown
Bartenders:
  • Tim Holloway
  • Ron McLeod
  • Vijitha Kumara
  • Mark post as helpful
  • send pies
  • Report post to moderator
Note: As of POI 3.15, this code no longer compiles, and it's not clear how it can be fixed. Creating DOCX files (rather than DOC files) is apparently possible; see http://stackoverflow.com/questions/13507424/how-to-create-a-word-document-using-apache-poi for basic code.

This program shows how to use Apache POI HWPF to create a Word document. It sets various font and paragraph properties (like bold, italic, center alignment and first line indent), and adds a custom document property. For more options, check out the JavaDoc:org.apache.poi.hwpf.usermodel.Paragraph and JavaDoc:org.apache.poi.hwpf.usermodel.CharacterRun classes. For some reason, HWPF can't create a document from scratch, so an empty document ('empty.doc') needs to be present when the code is run.



CategoryCodeSamples CodeBarn
 
With a little knowledge, a cast iron skillet is non-stick and lasts a lifetime.
    Bookmark Topic Watch Topic
  • New Topic
Boost this thread!