Java –jar WordImporter.jar input.doc input.doc.map –listAs result you should get new file “input.doc.map” in addition to your original document. For convenience, the generated .map file includes comments, explaining how to configure mapping, the possible options, etc. This text is, of course, static. However at the end of the file there are generated statements, which are specific for your concrete document:
#Styles in file input.doc#style1=Heading 1 #style2=List Paragraph #style3=Normal #style4=Heading 2 #style5=TOC 1 #style6=TOC 2 #style7=TOC Heading #style8=TitleThe entries are commented, because now those styles can be reused in a “H<x>” section (mapping to the Headings) and in an “ignore” section (meaning to completely skip during the import).
ignore=TOC 1,TOC 2,TOC 3,Header,Footer,Copyright H1=Heading 1 H2=Heading 2 H3=Heading 3 H4=Heading 4 H5=Heading 5 H6=Heading 6 H7=Heading 7 H8=Heading 8 H9=Heading 9…which says following: All paragraphs, starting with “Heading 1” formatted title will be recognized as top-level elements, “Heading 2” will be recognized as subitems of “Heading 1”, etc. There might be some cosmetic texts in the document, which should be ignored by the importer: for example, page headers and footers should not be interpreted, and they should simply be skipped by the processor. Those styles are listed in the ‘ignore’ section. Please note that if you don’t list Header or Footer in the ‘ignore’ section, there is a danger that texts of headers/footers will repeat in every work item description that crosses the page border. As mentioned above, text between headings would be mapped to work item descriptions, and headers and footers between pages are also processed as paragraphs. Those entries are just by way of example. You need to find what’s actually present in the document you intend to import. All styles used in the document are listed in the commented section at the end of the file:
#Styles in file input.doc#style1=Heading 1 #style2=List Paragraph #style3=Normal #style4=Heading 2 #style5=TOC 1 #style6=TOC 2 #style7=TOC Heading #style8=TitleFor our relatively simple document, we’ll create requirement type work items out of the styles Heading 1 and Heading 2:
H1=Heading 1 H2=Heading 2The example document was saved from Word 2007 and there are two additional styles: “TOC Heading” and “Title”, which are non-relevant for the data to be imported, so let’s put these to the mapping:
ignore=TOC 1,TOC 2,TOC 3,Header,Footer,Copyright,TOC Heading,TitleAs the result, the mapping file may look as following:
java -jar WordImporter.jar "input.doc" "input.doc.map" –simulateAs result you should see simulate.html generated in your working directory. Open it in your browser and see if recognition of your items is correct.
java -jar WordImporter.jar "input.doc" "input.doc.map" "http://admin:admin@localhost:81/polarion/ws/services/" WordImport requirement -module:"First Requirements"Note: requirement in the command line refers to default type of work item to be used. This is a mandatory property of each work item, therefore a default has to be provided in the arguments. Please check the URL and credentials for the Polarion server. In this example “localhost:81” is used to access Polarion server. Please replace it with the actual URL of your server. Also replace admin:admin with the username/password of the Administrator user, and specify the port number. You’ll see messages about creation of particular work items in the console Window, similar to:
INFO - Started processing root context. INFO - Skipping empty heading. INFO - Finished processing root context INFO - Started processing Workitem. INFO - Updated Workitem WORD-1 INFO - Started processing Workitem. INFO - Updated Workitem WORD-2How many times one work item might be updated depends on the number of attributes, so don’t be worried when the same work item is updated several times. During WebService application, especially one sending a large amount of data, the server may refuse to confirm a commit immediately. WebService repeats requests until “ok” or “rollback” response is received. Therefore, don’t worry when messages like these appear in the console:
INFO - Committing changes... INFO - I/O exception (org.apache.commons.httpclient.NoHttpResponseException) caught when processing request: The server localhost failed to respond INFO - Retrying request INFO - Commit finished.These are not error messages, they are just info for the user that the operation is not yet confirmed by the server. Now, when the Import is finished, you may return to the Polarion web portal and see the results: Compare to the original Document: If you switch to the Table view and set the Module view mode, you’ll find quick navigation just like a Table of Contents: Compare to the Word document: And one last screenshot on the imported content to demonstrate that the pictures are also imported along with text:
for %%i in ("*.*") do run.bat %%iDo not use importer as a frequent tool. If you need to maintain MS Word use LiveDoc documents... The Importer does not update any information in Polarion – it just imports information and creates NEW work items. If you need to continue to work with the work items in a MS Office application consider using LiveDoc documents. Limit importer use to trained persons… The Importer supposes that the user knows some internal details of Polarion (e.g. Project ID, IDs of the custom fields, definition of the work item hierarchy, etc.). Also, the user should have sufficient permissions to import data. Please remember that deletion of created items is not supported – one can mark them as obsolete, or even delete them from Subversion, but there is no permanent deletion in Subversion). Import to a Polarion sandbox project, verify integrity, then transfer to a Polarion project… Related to the previous, to make sure that the importer works exactly as expected, it makes sense to try first with test project or module and only then import into the production environment. Standardize MS Word document format to leverage common mapping properties… The more straightforward the formatting of the source documents, the easier imports will be in the future. If several documents have similar formatting, application of the importer will be matter of seconds, and could be even automated. When importing MS word embedded graphics … The graphics will be transferred to standalone files and referred as images from the work item description and/or custom fields. However if you have embedded OLE objects, those are not supported by browsers and will be replaced by placeholders. Importer doesn’t really care about the type of the embedded image – if your browser supports the type, you’ll see the image in the GUI, if not – just a placeholder. When importing MS Word tables, or spreadsheets, …. Importer converts Word formatting to HTML, so there might be some lost of information on transferring tables –row or column spans, for example. Switch off notifications during the import… Importer creates work items in the system. Depending on the notification and autoassignment configurations, your users might be notified about the creation of the work items. Import could potentially cause quite a lot of emails to be sent out if there are many items, or if your configuration notified many people about new item. You might consider temporarily disabling notifications in your Polarion configuration before running Importer.
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.