MS Office Processing Canonical Workflow
Introduction
The MS Office Processing Canonical Workflow processes .docx/.pptx files and can perform 3 different tasks:
Text Chunking: extracts text from the .docx/.pptx files pages/slides. It extracts text chunks based on the file structure of the documents.
Image Extraction: extracts a list of images per page with their corresponding metadata and content. Also, if the user desires, it can create subjobs for each image for further processing.
Table Extraction: extracts HTML representations of tables in the .docx/.pptx files.
The MS Office Processing Canonical Workflow has 3 main stages: one stage for the workflow configuration, one stage for processing .docx files, and one stage for processing .pptx files. It also has an optional stage for .docx file chunking (since it is processed with a different component).
For the instructions below, please request and reference the following files:
“workflow_ms office processing canonical workflow_export.aspire”
“pom.xml”
Workflow configuration
Each Canonical Workflow has a configuration script where initialization variables can be set or changed according to the needs of the client. This script is always at the very beginning of the workflow stages.
Also, all necessary external jars are preloaded in the file “ms-office-processing-workflow -[VERSION].jar” which needs to be loaded in the “External Resources” sections of the two main processing stages.
Configuration Variables
useDOCXChunking
This variable has to be set to true if .docx files’ text chunk extraction is required. Otherwise, set this variable to false.
docxChunksFieldName
This variable controls the name of the field where the text chunks list is stored for .docx files.
useDOCXImageExtraction
This variable has to be set to true if .docx files’ image extraction is required. Otherwise, set this variable to false.
docxImagesFieldName
This variable controls the name of the field where the images list is stored for .docx files.
createDOCXImageSubjobs
This variable has to be set to true if you need to generate subjobs for images extracted from .docx files. Otherwise, set this variable to false.
useDOCXTableExtraction
This variable has to be set to true if .docx files’ table extraction is required. Otherwise, set this variable to false.
docxTablesFieldName
This variable controls the name of the field where the tables list is stored for .docx files.
usePPTXChunking
This variable has to be set to true if .pptx files’ text chunk extraction is required. Otherwise, set this variable to false.
pptxChunksFieldName
This variable controls the name of the field where the text chunks list is stored for .pptx files.
usePPTXImageExtraction
This variable has to be set to true if .pptx files’ image extraction is required. Otherwise, set this variable to false.
pptxImagesFieldName
This variable controls the name of the field where the images list is stored for .pptx files.
createPPTXImageSubjobs
This variable has to be set to true if you need to generate subjobs for images extracted from .pptx files. Otherwise, set this variable to false.
usePPTXTableExtraction
This variable has to be set to true if .pptx files’ table extraction is required. Otherwise, set this variable to false.
pptxTablesFieldName
This variable controls the name of the field where the tables list is stored for .pptx files.
Expected Input
Job input
Job variable name | Job variable description |
contentStream | This variable holds the content of the file being processed. Normally it is not accessed directly but through framework functions such as “getContentStream “. Aspire connector’s text extraction consumes this stream, so be sure to turn off text extraction in the connector that uses the workflow. |
Document Input
Document variable name | Document variable description |
title | This variable is used to infer the type of document being processed. |
Workflow output
Job Output
No job output is generated.
Job variable name | Job variable description |
Document Output
Document variable name | Document variable description |
[user_defined_field for .docx chunks] | A list of text chunk objects extracted from .docx files. Each chunk object contains a section name, a list of paragraphs in the chunk, a chunk number, and a total number of words in the chunk (from all paragraphs in it). The name of the field is defined by the user in the workflow configuration. |
[user_defined_field for .docx images] | A list of image objects extracted from the .docx files. Each image object contains image metadata and the content of the image. The name of the field is defined by the user in the workflow configuration. |
[user_defined_field for .docx tables] | A list of HTML table representations of tables in the .docx files. The name of the field is defined by the user in the workflow configuration. |
[user_defined_field for .pptx chunks] | A list of text chunk objects extracted from .pptx files. Each chunk object contains a section name, a list of paragraphs in the chunk, a chunk number, and a total number of words in the chunk (from all paragraphs in it). The name of the field is defined by the user in the workflow configuration. |
[user_defined_field for .pptx images] | A list of image objects extracted from the .pptx files. Each image object contains image metadata and the content of the image. The name of the field is defined by the user in the workflow configuration. |
[user_defined_field for .pptx tables] | A list of HTML table representations of tables in the .pptx files. The name of the field is defined by the user in the workflow configuration. |
Sub jobs | Sub jobs for images in .docx and .pptx documents can be generated if the workflow is configured to do so. |
This is an output example for .docx text chunking with the name field set to “docxChunks”:
This is an output example for .docx image extraction with the name field set to “docxImages”:
This is an output example for .docx table extraction with the name field set to “docxTables”:
This is an output example for .pptx text chunking with the name field set to “pptxChunks”:
This is an output example for .pptx image extraction with the name field set to “pptxImages”:
This is an output example for .pptx table extraction with the name field set to “pptxTables”:
These are examples of subjobs generated by image extraction:
Limitations
Formats
The workflow is designed to extract data exclusively from Word .docx and PowerPoint .pptx formats. Older Word .doc and PowerPoint .ppt formats are not supported. Any other formats besides the ones mentioned above, such as MS Excel, PDF, text files, or any other format, are also not supported.
Errors and Troubleshooting
CloseChannelException
You will get this exception if the content stream for the file being processed is consumed before the workflow processes it. The typical case is when an Aspire connector with enabled text extraction is used. It can also happen if the content stream is consumed in a previous workflow.
Done!
Your workflow is now configured and ready to be used.