Skip to main content
Level 2
Sep 19, 2016 11:06 AM UTC
Solved

Word document creation from AEM 6.2

We have a requirement to generate PDF and Word document from AEM 6.2. Is it possible to generate a word document from AEM directly or with help of any add on packages?

This post is no longer active and is closed to new replies. Need help? Start a new post to ask your question.
kautuk_sahni
kautuk_sahniAccepted solution
Level 9
Sep 20, 2016 8:26 AM UTC

Hi, there is no direct OOTB/Service available in AEM for this.

But, you can create a custom service/Component to achieve it.

There is Apache POI library for read,writ,create and manage MS-Word documents using Java.

Link doe Tutorial :- http://www.tutorialspoint.com/apache_poi_word/apache_poi_word_document.htm

//Example ti create a blank Document

import java.io.File;
import java.io.FileOutputStream;
import org.apache.poi.xwpf.usermodel.XWPFDocument;

public class CreateDocument
{
   public static void main(String[] args)throws Exception
   {
   //Blank Document
   XWPFDocument document= new XWPFDocument();
   //Write the Document in file system
   FileOutputStream out = new FileOutputStream(
   new File("createdocument.docx"));
   document.write(out);
   out.close();
   System.out.println(
   "createdocument.docx written successully");
   }
}

Now just create a OSGi sling service or component and use above library to read,writ,create and manage MS-Word documents.

Please have a look at this forum post:- http://help-forums.adobe.com/content/adobeforums/en/experience-manager-forum/adobe-experience-manager.topic.html/forum__4iyk-hi_a_requirement.html

I hope this would help you.

Thanks and Regards

Kautuk Sahni

Kautuk Sahni

3 replies

smacdonald2008
Level 10
Sep 19, 2016 1:39 PM UTC

AEM does not generate Word docs. To achieve this use case, you would need to build a custom AEM service and use a Java Word API as part of that service -- such as: 

https://poi.apache.org/

As a guideline - we have a article with a similar use case - its building a custom AEM service that uses integrates the Excel API. See: 

https://helpx.adobe.com/experience-manager/using/creating-custom-excel-service-experience.html

Hope this helps... 

Translate
kautuk_sahni
kautuk_sahniAccepted solution
Level 9
Sep 20, 2016 8:26 AM UTC

Hi, there is no direct OOTB/Service available in AEM for this.

But, you can create a custom service/Component to achieve it.

There is Apache POI library for read,writ,create and manage MS-Word documents using Java.

Link doe Tutorial :- http://www.tutorialspoint.com/apache_poi_word/apache_poi_word_document.htm

//Example ti create a blank Document

import java.io.File;
import java.io.FileOutputStream;
import org.apache.poi.xwpf.usermodel.XWPFDocument;

public class CreateDocument
{
   public static void main(String[] args)throws Exception
   {
   //Blank Document
   XWPFDocument document= new XWPFDocument();
   //Write the Document in file system
   FileOutputStream out = new FileOutputStream(
   new File("createdocument.docx"));
   document.write(out);
   out.close();
   System.out.println(
   "createdocument.docx written successully");
   }
}

Now just create a OSGi sling service or component and use above library to read,writ,create and manage MS-Word documents.

Please have a look at this forum post:- http://help-forums.adobe.com/content/adobeforums/en/experience-manager-forum/adobe-experience-manager.topic.html/forum__4iyk-hi_a_requirement.html

I hope this would help you.

Thanks and Regards

Kautuk Sahni

Translate
Kautuk Sahni
Level 2
Sep 20, 2016 9:05 AM UTC

Will try the above options and revert back in case of any issues.

Translate