• No se han encontrado resultados

Teoría Del Municipio Libre Mexicano (Poder Originario)

CAPITULO SEGUNDO AUTONOMIA DEL MUNICIPIO

2. Teorías desde la concepción American y Europeas

2.3. Teoría Del Municipio Libre Mexicano (Poder Originario)

For those of you who are old like me, you’ll remember when Microsoft introduced new Office file formats back with Office 1997. It was a bit painful for a while—you would produce a document or a spreadsheet and send it to someone to review and they wouldn’t be able to open it. You would have to save it back to the old format and send it to them again. Certainly not a difficult task, but an annoyance nonetheless and, after doing it a few dozen times, a major annoyance.

Office 2007 again introduces new file formats. It’s going to be painful again for a little while. Unlike before, the new file formats are now set as the default format for saving files. That’s going to make things worse. Like before, Microsoft is introducing an update for older versions of Office that will allow them to work with the new formats. This time around, however, that update will allow older versions of Office to both read

and write the new formats. That should make things a little bit easier on everyone.

All of that is interesting, but what do the new formats mean to us as developers? Simple. The new file formats, as I’ve mentioned, are all XML based. This means that working with them is no different than working with any other XML file. Reading and writing Office files can now be done with familiar XML tools and code. The DOM, XPath, namespaces, and so forth will become even more critical to understand. As developers, the new XML file formats open up a whole new world for us.

For our custom activity, the most important aspect of the new formats we need to understand is the concept of a package. Quite simply, a single Office document is in reality not a single, monolithic, binary file anymore. From a user’s point of view, nothing is different—they will see one file, and they will interact with one file and never know the difference. As developers, however, we are aware that the single file that looks like an Office document is actually a collection of individual files, packaged and compressed (using the familiar ZIP algorithm). The constituent files that make up the ZIP package represent the elements of the file—styles, content, properties, markup, and so forth. Each of those components is stored in individual XML files within the package—and are therefore called package parts. Besides those that I just mentioned, other package parts include images, embedded objects, attachments, and macros. The XML-based parts can be extracted from the package and worked with just like any other XML file. To help facilitate this, Microsoft has introduced a new set of packaging APIs to allow us to work with the new packages.

One final element you should understand is the concept of relationships. Rather than dictating naming standards or other rules to define what each part is, and how it interacts with the other parts, relationships are used to define parts and their connections to each other. A part with a relationship type of style to the main document content is going to define the stylistic elements for the document. Similarly, a part with a relation- ship type of vbaProject is going to represent the macros contained within the file. We’ll be making use of these relationships in our activity.

That’s a five-paragraph overview of an element that will have entire chapters devoted to it in other books. It’s enough of the important stuff that you can understand the code we’ll write in a bit, but is by no means an exhaustive reference. If you’d like to read more, please visit www.kcdholdings.com and peruse the list of resources there.

Setting Up the Environment

First, we need to set up our project and explore the activity environment inside Visual Studio, so go ahead and create a new project. The Workflow Extensions for Visual Studio has added a number of project templates to the standard New Project dialog box specifically related to Workflow. We’re going to make use of only one of them here: the Workflow Activity Library. SelectWorkflow for the Project Type and then select Workflow Activity Library for the Template. For this example, I’m going to call the project KCD.SharePoint.Activities.

The Visual Studio IDE will open up, looking much like it does for any project we create. The IDE opens up in Design view, which we don’t need right now, so you can go ahead and close it.

There are a few steps to walk through to tweak our project before we start coding:

1. In the Solution Explorer, right-click on the Activity1.cs file and select Rename from the context menu. Rename the file to MacroStripperActivity.cs. Click Yes when you’re asked whether you want to rename all references to Activity1.

2. In the Solution Explorer, expand the References list and notice the additional assemblies that have been added for our activity:

•System.Workflow.Activities

•System.Workflow.ComponentModel

•System.Workflow.Runtime

Each of these namespaces provides functionality we need in our activity.

3. Add references to the following assemblies:

•WindowsBase: This one should be near the bottom of the .NET tab in the Add Reference dialog box. It provides access to the packaging APIs to work with the new file formats. •Microsoft.Sharepoint: Browse to \Program Files\Common Files\Microsoft Shared\

Web Server Extensions\12\ISAPI to add this one. It gives us access to the majority of the SharePoint APIs.

4. Examine other aspects of our project inside the Solution Explorer. Note that all other aspects of the project are the same as any other class library project in Visual Studio 2005.