Archive

Archive for the ‘Office System’ Category

Sending Office Documents with VSTO Customisation to Other Parties

December 18, 2008 Leave a comment

When you create a document-level customisation for Office using VSTO, the customisation is compiled into a .NET assembly and the location of this assembly is stored in a custom document property called _AssemblyLocation. When loading the document, Office first checks to see whether this custom property is present and if it is, it tries to load the customisation. Now what if you are going to send this document to another organisation or department who don’t have (or don’t want to have) that customisation (assembly)? Since they don’t have the assembly on their machine, they will see an error message presented via a dialog box saying that the assembly could not be found, which is not nice.One way to prevent the code from running but without receiving an error message is to hold down the SHIFT key (as described on MSDN) when you are opening the document via the File menu. Note that this solution does not work if you are opening the document using the “Getting Started” task pane. This solution works but it requires the user to open the document using the File menu and they need to remember to hold down the SHIFT key so it is not necessarily a desired solution.   

The alternative solution is to remove the custom document property that points to the customisation assembly. This way Office will not try loading the customisation assembly on the end-user’s machine so they will not get the error message. However, you may need to put those custom properties back in the document if they user modifies the document and returns the document back to you.So how can you remove the custom properties? 

Manually
Open the document in the Office application (Word, Excel or PowerPoint), go to Properties -> Advanced Properties -> Custom and remove the assembly location custom property.

ServerDocument Class in VSTO
Both versions of VSTO (VSTO 2005 SE and VSTO 3.0) come with their own version of this class and have a very similar functionality. Note that you don’t need to have Office installed on the machine that is trying to modify the document using the ServerDocument class so you can perform this process on a server machine as part of an automated process that you run before sending out Office documents. You can find more information on this approach here.

OpenXML
If you are using Office 2007, you can access and manipulate the custom document properties by using the types in the System.IO.Packaging namespace or by using the Open XML Format SDK. Again, you don’t need to have Office installed on the machine that is using these components to manipulate the Office documents.  

As I mentioned earlier, when you receive the document from the other party, you may want to add the VSTO customisation again. You can use any of the approaches mentioned above to put the custom properties back on. (Thanks to Mary Lee for the pointers)

PowerTools for Open XML

June 12, 2008 2 comments

One of the namespaces introduced in the .NET Framework 3.0 is System.IO.Packaging (in the WindowsBase assembly), which provides classes that support storage of multiple data objects in a single container, like a ZIP file. These data objects can be referenced in a hierarchical format, similar to the file system. This functionality can be used to open, read and manipulating the files based on the Open XML standard since the Open XML file format follows the same principle. A while back, I wrote a piece of code for a customer to use the classes in this namespace for setting the values for custom properties in Word 2007 documents and Excel 2007 spreadsheets. This wasn’t hard but I had to use XPath queries and use the appropriate XML namespaces in order to find the elements I was trying to update. 

We then had an initiative to create an SDK that provides strongly-typed part classes for use with the documents based on Open XML. This SDK was available in CTP mode until earlier this week when its first version was released. You can now download the Open XML Format SDK from the Download Center. This SDK relies on the functionality provided by the System.IO.Packaging namespace so it requires .NET Framework 3.0. 

The Open XML Format SDK makes the life so much easier for the developers, but wait… we are not finished yet. Right after the release of the Open XML Format SDK, another open source project called “PowerTools for Open XML” was announced, which provides more than 30 PowerShell cmdlets to manipulate the Open XML files. So for example, there are cmdlets for manipulating the watermark, header and footer, style, etc. This means you can read and edit Open XML files on the server-side without using the Office object model and without a need for an Office 2007 license on the server machine. Here is a great screencast that includes some nice demos that show how you can use the PowerTools to go through a list of Word documents, add a watermark to all of them and make sure they all use the same text style. There is also another demo that performs a mail merge using a simple PowerShell script.

I remember that a few years back, I was working on a project where the customer decided to spend a considerable amount of cash on a document generation and rendering solution and the development team had to write a lot of code to populate the templates provided by the third-party solution. The integration and testing experience was quite painful too. It is great to see how the publication of Open XML as a standard and the development of great tools by Microsoft and the open source community has simplified the document generation process and I can clearly see how this will result in reduction of licensing and development costs.

OpenXML ISO Standardization

April 2, 2008 2 comments

Great news: ISO/IEC DIS 29500 (Office OpenXML) has received the necessary votes for approval as an ISO standard. 

This decision was made by the national bodies in the Ballot Resolution Meeting in Geneva during the week 25-29 Feb 2008. In order to be approved as an ISO standard, at least 66% of the votes cast should be positive and no more than 25% of the votes should be negative. By the end of the ballot resolution process (at midnight on Sat 29 Mar 2008), 75% of the votes cast were positive and only 14% of the votes cast were negative so the criteria for approval as an ISO standard have been met.

Categories: Microsoft, Office System

Expanded Interoperability Initiatives at Microsoft

February 21, 2008 Leave a comment

Microsoft will apply changes to its technology and business practices, which will cover high-volume business products including Windows Vista, Windows Server 2008, SQL Server 2008, Office 2007, Exchange Server 2007, Office SharePoint Server 2007 and all future versions of these products.

Here are some of the specific actions Microsoft is taking to implement these new interoperability principles: 

  • Ensuring open connections to Microsoft’s high-volume products
  • Documenting how Microsoft supports industry standards and extensions
  •  Enhancing Office 2007 to provide greater flexibility of document formats
  • Launching the Open Source Interoperability Initiative
  • Expanding industry outreach and dialogue

You can find more about these initiatives here.

2007 Microsoft Office System SP1 Released

December 13, 2007 Leave a comment

The first Service Pack for the 2007 Office System was released to web earlier this week.



2007 Microsoft Office Suite SP1 [
DownloadKB936982 ]


Applies to:


    - Office Basic 2007 
    - Office Enterprise 2007
    – Office Home and Student 2007 
    - Office Professional 2007 
    - Office Professional Plus 2007 
    - Office Small Business 2007 
    - Office Small Business Management 2007 
    - Office Standard 2007 
    - Office Ultimate 2007 
    - Office Access 2007 
    - Office Excel 2007 
    - Office InfoPath 2007 
    - Office Outlook 2007 
    - Office PowerPoint 2007 
    - Office Publisher 2007 
    - Office Word 2007 
    - Office OneNote 2007 
    - Office Groove 2007



Windows SharePoint Services 3.0 SP1
[ Download | KB936988 ]

Applies to:
    – Windows SharePoint Services 3.0 



2007 Microsoft Office Servers SP1
 [Download | KB936984]

Requies:
    – Windows SharePoint Services 3.0 SP1

Applies to:
    - SharePoint Server 2007
    – Project Server 2007
    – Form Server 2007
    – Groove Server 2007, 64-bit edition

Categories: Office System
Follow

Get every new post delivered to your Inbox.