Overview and Concepts in Word Automation Services


SharePoint 2010 introduces a service application called Word Automation Services. It is used for server side conversion of word documents into other file formats.

File types that word can open:

  • Open XML File Format documents (.docx, .docm, .dotx, .dotm).
  • Word 97-2003 documents (.doc, .dot).
  • Rich Text Format files (.rtf).
  • Single File Web Pages (.mht, .mhtml).
  • Word 2003 XML Documents (.xml).
  • Word XML Document (.xml).

File types that word can save:

  • Portable Document Format (PDF) files.
  • XML Paper Specification (XPS) files.
  • Open XML File Format documents (.docx, .docm, .dotx, .dotm).
  • Word 97-2003 documents (.doc, .dot).
  • Rich Text Format files (.rtf).
  • Single File Web Pages (.mht, .mhtml).
  • Word 2003 XML Documents (.xml).
  • Word XML Document (.xml).

Word Automation Service is a part of SharePoint 2010. Word Automation Service is available in the Standard edition and in the Enterprise edition. It is a feature of SharePoint 2010, so SharePoint 2010 should be purchased and installed to use Word Automation Services.

For Word Automation Services Architecture refer http://msdn.microsoft.com/en-us/library/ee556832.aspx.

For the concepts that are basic for Word Automation Services refer my previous article named Concepts in Word Automation Services.

Using C# code you can convert the word documents into different formats. There are three different ways for converting the received word documents into other formats.

  • AddFile ()
  • AddFolder()
  • AddLibrary()

For AddFile() method refer http://www.c-sharpcorner.com/UploadFile/anavijai/4816/Default.aspx.

For AddFolder() method refer http://www.c-sharpcorner.com/UploadFile/anavijai/4823/Default.aspx.

For AddLibrary() method refer http://www.c-sharpcorner.com/UploadFile/anavijai/4822/Default.aspx.

Using powershell you can use Word Automation Services to convert the word document into other formats. Refer http://www.c-sharpcorner.com/UploadFile/anavijai/4820/ and http://www.c-sharpcorner.com/UploadFile/anavijai/4801/Default.aspx.

The following concepts are basic for Word Automation Services:

  • Conversion
  • Conversion Job
  • Document Queue

Conversion:

Conversion in Word Automation Services is a process of converting the word document to other formats. For example converting .doc file format to .pdf format. It constitutes of the following steps:

  • Create a conversion job

    ConversionJob job = new ConversionJob("Word Automation Services");
     
  • Set the desired output file format

    job.Settings.OutputFormat = SaveFormat.PDF;
     
  • Add files to the conversion job

    AddFile ()


    Syntax:

    job.AddFile(string inputFile, string outputFile)

    Example:

    job.AddFile("http://serverName:31829/sites/Home/Shared%20Documents/ArticleLinks.docx", "http://serverName:31829/sites/Home/Shared%20Documents/ArticleLinks.pdf");

    AddFolder ()

    Syntax:

    job.AddFolder(SPFolder inputFolder, SPFolder outputFolder, bool recursion);

    AddLibrary ()

     Syntax:

    job.AddLibrary(SPList inputList, SPList outputList);

  • Submit the job to the document queue

    job.Start();

Conversion Job:

Conversion job describes the files to be converted and the operation to perform on them.
Each file is considered to be a conversion item, and the conversion item will be mapped to Conversion job. Conversion job contains one or more conversion items.

Document Queue:

Document Queue is a "first in, first out", which is used to start the conversion and that schedule can be set in the conversion job.

Up Next
    Ebook Download
    View all
    Learn
    View all