theThought's thoughts

Kevin A Gray - Creative Strategy Guy

Success IBM SPSS Data Collection integrates with WordML (OpenXML)

SUCCESS

It’s taken a few weeks, in which the company has changed name, the product has changed name (again) and I have been busy getting ready for everything.  But 10:00 am (GMT) today I managed to run my first survey where responses from the survey were posted into a Custom Part within a Word Document so that the Word document is automatically updated.  If nothing else this proves that IBM SPSS Data Collection can integrate with OpenXML.

Although there are a few other things I would like to do, generate a PDF from the document, do all the work in memory so that the document is not actually written to file, send the file as an attachment to an email.  But this is a great start.

So Monday will see me move to my third project (the above being my second, after a very simple manipulation of WordML in my first).  I will be moving from Word to PowerPoint and I will be moving from Collection to analysis.  I would like to be able to show that output from an MRS (Reporting Script) can push data into an existing Powerpoint presentation without losing any formatting.

One work day off then and then back to the grindstone (what I really mean is one day with my Flash project before moving back to OpenXML – but I can pretend it’s a day off.)

I hope you have enjoyed the posts so far and will continue to read about my endeavours in the future.

Filed under  //   Data Collection   IBM   Microsoft Word   OpenXML   SPSS   WordML  

Data Collection to OpenXML a simple class for populating custom parts (Technical Design)

So far in this project a survey (the survey) has been created that accepts details of a train complaint.  A Word document (the word doc) has been created that provides a printed copy of the complaint details and a custom part (the custom part) has been defined and added to the Word document to facilitate the transfer of information from IBM SPSS Data Collection to Microsoft Word.  In the last post (creating XML in Data Collection) logic was added to the end of the survey that creates an XML document containing all the responses to the survey in the same structure as the custom part in the Word document.  In this post VB will be used to create a simple class that will accept the XML document and re-build the custom part.  It will also include methods to convert the resulting document into a PDF ready for emailing to the respondent.

Technical Design

The purpose of this DLL is to handle the interaction  between Data Collection and an OpenXML document.  The class will receive the XML to be inserted into the document and the details of the custom part to be updated.  IT will then replace the content of the existing custom part with the new XML content.  It will not delete the custom part itself as this would result in the loss of the existing unique ID for the document. This would in turn cause all the document relationships and form field bindings to break.

The second part of the process is to create a PDF version of the document.  Word can now do this without the use of third party components.  The returned PDF can then be attached to an e-Mail for distribution to the survey respondent (complainant)

Update Part method
Inputs:

·         XML (containing the survey responses)

·         Document name (the name of the Word document to change)

·         Custom Part name (name of the custom part to be changed)

Outputs

·         Success/Fail Signal (indicating whether update succeeded)

Create PDF Method

Inputs: None

Outputs:

·         PDF version of document

Internal Functions

As well as methods exposed to other applications (in this case IBM SPSS Data Collection) this dll will require some internal functions.

OpenWordDoc (Opens the document defined by the Update Part Method)

Locate Custom Part (takes the open document and finds the custom part)

Adjust Custom Part (having found the custom part the XML needs to be fed in)

There is no need to save the document as the OpenXML SDK will automatically save when the custom part is changed.

Filed under  //   Custom Part   Data Collection   IBM   IBM SPSS Data Collection   OpenXML   SPSS   VB.net   XML