Welcome to MSDN Blogs Sign in | Join | Help

News

  • who's online visitors here with you. Programming Microsoft® Office Business Applications Locations of visitors to this page
    Bookmark and Share
    Erika Ehrli on Twitter MSDN_Office in Twitter Follow us on Twitter
    MSDN_Office in Facebook Join MSDN Office on Facebook
What’s New for Developers in Office 2010 and SharePoint 2010?

The upcoming release of Office and SharePoint offers a wealth of interesting new scenarios and solutions that can be built thanks to new features and improvements added to different Office and SharePoint products and technologies. There’s more possibilities to integrate Office and SharePoint to build rich client-server solutions using tools such as Visual Studio 2010, SharePoint Designer 2010, InfoPath 2010, and Access 2010.

Some of you already had an opportunity to play with the Betas and write code, read lots of blogs, twitter feeds, and some MSDN articles and videos. Some others are eager to get the final release to start building solutions and are already starting to ramp-up. In either case, I realize there’s a lot of information out there already and it’s always helpful to get some advice on where to start.

I find it fascinating to learn new technologies, and I truly enjoy working on training content and article plans. For those eager to learn as well, I’ll take you along with me on a joyride of learning what’s new for developers on Office 2010 and SharePoint 2010.

I’ve spent the last months working in content plans for upcoming MSDN articles, Visual How-tos, and MSDN site projects. Happily, there’s already plenty articles, code samples, and videos on our publishing pipe to cover the most interesting features and scenarios. We started releasing some content in October after the SPC 2009 and in November for Beta. We have much more to come in the following months and it’s a great time to catch-up on blogging as there’s so much to share in the following months. This are exciting times for Office and SharePoint developers!

With this blog post, I am starting a series of posts that will guide you through the most interesting 2010 features and resources available for developers. I’ll be tagging this series as learn2010.

I’ll start by introducing the top places/content I recommend if you want to learn more about Office 2010 and SharePoint 2010 development.

 Developing with Office 2010

Videos: The 5-10+ min intros

Key Pillars of Office 2010 Development, the 3 + hours intro to Office 2010 development

The links below provide videos, downloads, and technical articles specific to each pillar.

Web sites and training content for developers

Developing with SharePoint 2010

Videos: The 5-10+ min intros

Key Pillars of SharePoint 2010 Development, the 3 + hours intro to SharePoint 2010 development

The links below provide videos, downloads, and hands-on labs specific to each pillar.

  • Getting Started: Building Web Parts in SharePoint 2010
  • What Developers Need to Know About SharePoint 2010
  • Building Blocks for Web Part Development in SharePoint 2010
  • Accessing SharePoint 2010 Data and Objects with Server-Side APIs
  • Accessing SharePoint 2010 Data and Objects with Client-Side APIs
  • Accessing External Data with Business Connectivity Services in SharePoint 2010
  • Developing Business Processes with SharePoint 2010 Workflows
  • Creating Silverlight User Interfaces for SharePoint 2010 Solutions
  • Sandboxed Solutions for Web Parts in SharePoint 2010
  • Creating Dialog Boxes and Ribbon Controls for SharePoint 2010

    Web sites and training content for developers

  • MSDN SharePoint Developer Center
  • SharePoint 2010 (Beta) Home Page
  • SharePoint 2010 Upgrade Resource Center
  • SharePoint 2010 Community
  • SharePoint 2010 Developer Workshop

    While generic, the links above can help you understand the big picture. As we approach the launch, I will be drilling-down into more detailed info about developing solutions using specific features pertaining to key pillars of Office 2010 and SharePoint 2010 development. I’ll try and share more videos, links to articles, pointers to interesting blog posts, and code samples for each piece so you can continue to learn more about features that you find particularly interesting.

  • Getting Started with Office 2010 Development

    It’s been an exciting week with all the recent announcements at PDC. Today, at PDC we announced the availability of our public Office 2010 and SharePoint 2010 Betas. Lots of developers from the community who have been monitoring the new developer investments on Office 2010 can start creating solutions with the latest features. You can find links to all our downloads here:

    Download the 2010 Betas

    Office 2010 Beta
    Office Professional Plus 2010 Beta

    Word, Excel, PowerPoint, OneNote, Outlook, Access, Publisher, InfoPath, Communicator, SharePoint Workspace, and Office Web Apps.

    You can learn more about the benefits of Office 2010 by downloading the beta from www.microsoft.com/2010

    Office 2010 Developer Content on MSDN

    Today, I am also happy to share the availability of our new Office 2010 developer pages on MSDN. We launched a few minutes ago a set of pages that provide Office 2010 developer learning resources including Channel 9 videos, developer references, articles, feeds to Office 2010 bloggers and community resources, and our very first three Office 2010 Visual How-to videos!

    We will start publishing more Office 2010 VHTs soon.

    Office 2010 (Beta) Developer Center

    We have updated our Office 2010 (Beta) Developer Center with more community content and links to developer specific resources. We will add more links to content and videos as we continue publishing.

    Developing with Office 2010

    Office 2010 Beta is a broadly extensible platform for building information worker productivity solutions and developing for Office with Visual Studio 2010 makes this easy. The following six key initiatives show you how to get started developing with Office 2010.

    image

    1 | Getting Started Developing with Office 2010

    2 | Extending the Office 2010 Backstage View and Other UI

    3 | Working with Office 2010 Data Through the File Formats and Office APIs

    4 | Integrating External Data and SharePoint 2010 Platform Services in Office 2010 Solutions

    5 | Creating Tracking Applications in Office 2010 and Publishing Them to SharePoint 2010

    6 | Using Office 2010 APIs to Customize Application Behavior and Automate Tasks

     

    I’m still developing Office 2007 solutions. Where can I find the content?

    We have modified our home page so you can find your way to both Office 2007 and Office 2010 developer content. We have a commitment to continue delivering and helping you discover Office 2007 content.

    image

    You should also check the Products tab to find your way to product and version specific developer content.

    image

    Check back often the MSDN Office Developer Center for the latest updates on Office 2010 development and follow us on Twitter for the latest news and twits for new content and cool stories about Office 2010 and SharePoint 2010 development.

    I’d also like to suggest you all read David Hale’s great post on Developer Help Updates for Office 2010 Beta!

    What about SharePoint 2010 developer content?

    In case you missed it, you can find detailed information about our recent SharePoint Conference release here:

    Also, check back often the MSDN SharePoint Developer Center for the latest updates on SharePoint 2010 development.

    Happy coding!

    Getting Started with SharePoint 2010 for Developers + New Office 2010 and SharePoint 2010 (Beta) Developer Centers

    It’s always hard to stay away from blogging when there’s so many new things to share and talk about. Today at the SharePoint Developer Conference Keynote, Jeff Teper talked about SharePoint 2010 and Office 2010 features for developers and IT professionals. This is the time to start to blog more about the new release of Office and SharePoint and I am glad that we can all talk now!!!!

    The SharePoint team blog has a good summary of key announcements made today at the conference, so in case you missed the keynote, go check out this blog.

    Here’s a few more cool surprises from the MSDN Office and SharePoint Developer Center team.

    Getting Started with SharePoint 2010

    I had the opportunity to work closely with Paul Andrew, Martin Harwar, the MSDN team, and the SharePoint developer content team during the last few months on the new SharePoint 2010 Getting Started training on MSDN. We released this training a few minutes ago and you can all access it here:

    http://msdn.microsoft.com/en-us/sharepoint/ee513147.aspx

    The goal of this training is to show you how to get started with development for SharePoint 2010 using Visual Studio 2010.

    This training provides a Silverlight navigation experience that allows you to navigate between ten different learning tracks or modules and you can even test your skills.

    image

    Each module includes a set of videos, hands-on labs manuals in C# and VB, and a set code samples/snippets that you can also find in Paul Andrew’s blog.

    Here’s a list of all the different modules in this training:

    Module 1: Getting Started: Building Web Parts in SharePoint 2010

    Building Web Parts is one of the most common tasks you will undertake as a developer. SharePoint 2010 and Visual Studio 2010 enable you to create Web Parts quickly and easily. You can use project templates and project item templates to help you get started building standard ASP.NET Web Parts. You can also build a new type of Web Part called a Visual Web Part.

    In this module you will learn how to:

    • Create standard ASP.NET Web Parts for SharePoint 2010.
    • Create Visual Web Parts for SharePoint 2010.
    • Use SharePoint controls and data in Web Parts.

    Module 2: What Developers Need to Know About SharePoint 2010

    Visual Studio 2010 integrates with SharePoint much more closely than in previous versions. Visual Studio 2010 includes SharePoint-specific project types and project item types, and includes powerful packaging, deployment, and debugging features that help increase your efficiency as a SharePoint 2010 developer.

    In this module you will learn how to:

    • Create SharePoint 2010 projects by using Visual Studio 2010.
    • Create SharePoint 2010 project items by using Visual Studio 2010.
    • Package and deploy SharePoint 2010 solutions by using Visual Studio 2010.
    • Explore the SharePoint file system from Visual Studio 2010.
    • Create solutions that use the SharePoint 2010 object hierarchy.

    Module 3: Building Blocks for Web Part Development in SharePoint 2010

    SharePoint 2010 includes many components that help increase your efficiency as a developer. The SharePoint platform includes many built-in Web Parts that you can include in your solution, and provides many more components that you can use in Web Parts that you develop.

    In this module, you will learn how to:

    • Explore all of the built-in Web Parts provided by SharePoint 2010.
    • Configure built-in Web Parts provided by SharePoint 2010.
    • Use SharePoint controls in Web Parts that you develop.
    • Render data in Web Parts that you develop by using data controls.

    Module 4: Accessing SharePoint 2010 Data and Objects with Server-Side APIs

    Accessing SharePoint data in server-side solutions is one of the most common tasks that you will perform as a SharePoint developer. SharePoint 2010 provides powerful server-side APIs that enable you to retrieve, add, edit, and delete SharePoint data programmatically. SharePoint 2010 also includes the new LINQ to SharePoint technology that enables you to work with SharePoint data efficiently and easily.

    In this module you will learn how to:

    • Access SharePoint list data programmatically by using the SharePoint server-side APIs.
    • Use LINQ to SharePoint to access SharePoint list data programmatically.
    • Add files to SharePoint document libraries programmatically.
    • Modify files in SharePoint document libraries programmatically.
    • Create and work with content types programmatically.

    Module 5: Accessing SharePoint 2010 Data and Objects with Client-Side APIs

    SharePoint 2010 provides a new client object model that enables you to create SharePoint solutions that run remotely from the SharePoint server farm. For example, the client object model enables you to consume and manipulate SharePoint data in Windows Forms applications, Windows Presentation Framework applications, console applications, Microsoft Silverlight applications, and ASP.NET Web applications.

    In this module you will learn how to:

    • Develop Microsoft .NET Framework applications by using the client object model for SharePoint 2010.
    • Develop Silverlight applications by using the client object model for SharePoint 2010.
    • Access SharePoint data in .NET Framework and Silverlight applications.

    Module 6: Accessing External Data with Business Connectivity Services in SharePoint 2010

    SharePoint 2010 provides a new set of technologies known as Business Connectivity Services for retrieving, editing, updating, and deleting data from external systems. This module provides an overview of Business Connectivity Services, and delves into development examples of using Business Connectivity Services data in custom SharePoint solutions.

    In this module you will learn how to:

    • Create Business Connectivity Services applications.
    • Create and use external content types.
    • Create .NET Types for Business Connectivity Services applications.

    Module 7: Developing Business Processes with SharePoint 2010 Workflows

    SharePoint 2010 provides a powerful workflow framework that enables you to implement custom business processes that are driven by SharePoint data.

    In this module, you will learn how to:

    • Create workflows for SharePoint 2010 solutions.
    • Create workflow events for SharePoint 2010 solutions.
    • Create workflow forms for SharePoint 2010 solutions.
    • Integrate external data with SharePoint workflows.

    Module 8: Creating Silverlight User Interfaces for SharePoint 2010 Solutions

    Silverlight 3.0 provides the opportunity for developers to create the next generation of Rich Internet Applications (RIAs). SharePoint 2010 integrates closely with Microsoft Silverlight to enable you to build compelling user interfaces that interact with SharePoint data.

    In this module you will learn how to:

    • Host Silverlight applications in SharePoint 2010.
    • Build Silverlight Web Parts.
    • Pass data from SharePoint to Silverlight by using Silverlight parameters.
    • Render SharePoint data in Silverlight by using the SharePoint client object model.
    • Render media files from SharePoint in Silverlight applications.

    Module 9: Sandboxed Solutions for Web Parts in SharePoint 2010

    SharePoint 2010 provides a new sandbox environment that enables you to run user solutions without affecting the rest of the SharePoint farm. This environment means that users can upload their own custom solutions without requiring intervention from administrators, and without putting the rest of the farm at risk.

    In this module you will learn how to:

    • Explore solution galleries.
    • Create Web Parts for sandboxed solutions.
    • Use sandboxed operations.
    • Differentiate between operations that are allowed in sandboxed solutions and those that are not.

    Module 10: Creating Dialog Boxes and Ribbon Controls for SharePoint 2010

    SharePoint 2010 provides new user interface components, such as server ribbons, and the new dialog platform. As a developer, you can create controls for the server ribbon and dialog boxes for the dialog platform.

    In this module, you will learn how to:

    • Explore the server ribbon.
    • Develop controls for the server ribbon.
    • Explore the dialog platform.
    • Develop solutions by using the dialog platform.

    New MSDN SharePoint 2010 (Beta) Developer Center and MSDN Office 2010 (Beta) Developer Center

    I am also glad to announce the availability of our new MSDN SharePoint 2010 and Office 2010 (Beta) Developer Centers. We will start adding more links to all the SharePoint 2010 and Office 2010 content we can now publish to these pages.

    Office 2010 (Beta) Developer Center
    http://msdn.microsoft.com/en-us/office/ee513173.aspx

    SharePoint 2010 (Beta) Developer Center
    http://msdn.microsoft.com/en-us/sharepoint/ee514561.aspx

    SharePoint 2010 Upgrade Resource Center
    http://msdn.microsoft.com/en-us/sharepoint/ee514557.aspx

    SharePoint 2010 Community
    http://msdn.microsoft.com/en-us/sharepoint/ee633451.aspx

    You can also find links to all the recently SharePoint 2010 developer content published at the SharePoint Developer Docs team blog.

    Enjoy!

    MSDN Redesign: Office, SharePoint, and VSTO sites are live!

    I know it’s late at night, but I couldn’t resist. The MSDN Office, SharePoint, and VSTO Developer Center are blue now and match the super cool new MSDN branding and experience. Go take a look and enjoy:

    Office Developer Center

    http://msdn.microsoft.com/en-us/office/default.aspx

    image

    SharePoint Developer Center

    http://msdn.microsoft.com/en-us/sharepoint/default.aspx

    image

    Office Development with Visual Studio Developer Center

    http://msdn.microsoft.com/en-us/vsto/default.aspx

    image

    More sites here: http://blogs.msdn.com/lisa/archive/2009/10/17/msdn-com-refresh.aspx

    Office and SharePoint devs - See you in Las Vegas next week!

    I’ll be a the SharePoint Conference in Las Vegas next week. I will be at the Office developer booths at the following times:

    • Monday Oct 12 – 2:30PM- 5:45PM
    • Tuesday Oct 20 – 8:30AM – 10:30AM
    • Wednesday Oct 21 -  2:30PM – 5:45PM

    I’ll also be at the Office Developer and MSDN ATE tables.

    I’d love to talk to you about both the MSDN new experience, great content in the pipe, and all the latest news about Office 2010 and SharePoint 2010. I’ll be blogging more often now that I can talk (starting Monday).

    Also lookout for dev news in twitter: @msdn_office, @erikaec, and @sharepointdev.

    Let the Office 2010 and SharePoint 2010 dev stories begin!

    Getting Ready for Office 2010 and SharePoint 2010 + MSDN Redesign + New MSDN Open XML Developer Portal

    It’s been a while since I had an opportunity to blog. When I am quiet it usually means I am up to something :).

    Getting Ready for Office 2010 and SharePoint 2010

    This are exciting times for Office and SharePoint developers. While we have released some interesting news about Office 2010 and SharePoint 2010 already, there’s a lot more coming for the SharePoint Developer Conference and Beta 2.

    We currently have more than 100 items in the publishing queue to be released between the SP Conference and after Beta 2, plus some great improvements and new pages being built for MSDN Office and MSDN SharePoint Developer Centers. Expect a lot of articles, videos, code samples, and more in the upcoming months.

    Moving forward I will focus more on blogging about Office 2010 and SharePoint 2010 for developers and will share related stories and links to others who are doing the same. Here are a few blogs that you should definitely follow if you are interested in developer documentation for Office and SharePoint:

    Office 2010 Developer Documentation and Code Samples

    SharePoint 2010 Developer Documentation and Code Samples

    Office 2010 & SharePoint 2010 Developer Documentation and Stories

    I’ll also be attending the SharePoint Developer Conference. It’s always refreshing to have an opportunity to talk to Office and SharePoint developers. I’ll be at the ATE tables and hanging out at the Office developer booths. Hope to see some of you there.

    MSDN Redesign

    While we work on 2010 content, we are also getting MSDN Office and MSDN SharePoint ready to be revamped with the new MSDN redesign. Scott Hanselman has already shared a preview of this look-and-feel in his blog. Here are a couple snapshots for your delight:

    MSDN_LOCH_HOME_thumb[1] lightframe_thumb[1]

    Soon MSDN Office and MSDN SharePoint will get this look. I particularly like that this new set of UI and improvements make the sites more community focused and looking as fresh and cool as the Expression site and the Silverlight site.

    This are also exciting times to work with the MSDN team. Scott will be blogging more about this project. If you are into MSDN, you should also check out the Inside MSDN & TechNet blog for more news about MSDN improvements.

    Revamped Open XML Developer Center

    If you are into Open XML like me, you may have noticed that in the last couple years we have published a lot more articles, Visual How-tos, and code samples for Open XML developers. We have mainly focused in writing more about the Open XML SDK 2.0.

    For that same reason, the Open XML Developer Center needed to grow and be organized in a way that would simplify discoverability of content and expose better ways to access content, including videos.

    image  image

    Because we didn’t want to wait until Beta 2 to release this site, we decided to take it live yesterday. Open XML SDK 2.0 developers are interested in finding more articles and guidance and we hope the improvements made to this site can simplify the time you spend learning Open XML and using the Open XML SDK 2.0.

    Here are the links that get you to all our new and redesigned pages.

    Home Page
    Downloads
    Learn Open XML
    | Getting Started
    | Articles
    | How Do I Videos
    | SDK
    | Training
    | Webcasts and Videos
    Scenarios
    Technologies
    | OPC
    | Excel
    | PowerPoint
    | Word
    Community

    These pages were optimized for the new MSDN redesign I discussed previously, so they will look even better once MSDN makes the switch to the new MSDN design.

    Eric White from my team owns the content of this portal and will be blogging soon about more details about this project.

    Looking forward to great times and to sharing new content for MSDN Office and MSDN SharePoint!

    Open XML SDK 2.0 August CTP, Videos, and 50+ Open XML Code Samples

    Zeyad Rajabi announced this week the availability of the new Open XML SDK 2.0 August CTP. As mentioned by Zeyad, changes to this CTP include:

  • Add semantic level validation support
  • Add markup compatibility/extensibility support
  • General improvements based on your feedback
  • If you are into Open XML Development, you will also be interested in a few more videos and code samples.

    dd183105.video_30(en-us,MSDN.10)[2] Open XML SDK 2.0 Visual How-to Series

    We have released some videos, walkthroughs, and code sample downloads in the last couple weeks:

    Visual How To: Creating a PowerPoint 2007 Presentation from a Folder of Images by Using the Open XML SDK 2.0 for Microsoft Office
    Visual How To: Merging Simple Content from Excel 2007 Workbooks and Worksheets by Using the Open XML SDK 2.0 for Microsoft Office
    Visual How To: Using the Open XML SDK 2.0 Classes Versus Using .Net XML Services
    Visual How To: Merging PowerPoint 2007 Decks Together by Using the Open XML SDK 2.0 for Microsoft Office
    Visual How To: Generating Documents with Headers and Footers in Word 2007 by Using the Open XML SDK 2.0 for Microsoft Office
    Visual How To: Coding a Long-Running Operation Page in SharePoint Server 2007
    Visual How To: Embedding Documents in Word 2007 by Using the Open XML SDK 2.0 for Microsoft Office
    Visual How To: Adding Images to Documents in Word 2007 by Using the Open XML SDK 2.0 for Microsoft Office

    More to come soon.

    dd183105.development_30(en-us,MSDN.10)[2] Open XML SDK 2.0 for Microsoft Office Code Snippets for Visual Studio 2008

    I am also glad to announce that yesterday we published 50+ Open XML code samples packaged as Visual Studio code snippets. The code samples were created by Ken Getz as an update to the previous Open XML Visual Studio 2005 code snippets released a couple years ago. The previous snippets provided samples on manipulating document parts and packages using the System.IO.Packaging namespace. This new set provides more code samples that show how to manipulate document parts and packages using the Open XML SDK 2.0. The snippets were tested and work well with the August CTP released this week.

    You can download the snippets here:

    http://www.microsoft.com/downloads/details.aspx?FamilyID=78bea298-a3f9-44cf-bde0-b4f30dc986df&displaylang=en

    The snippets in this download use the Open XML SDK 2.0 to accomplish many tasks involving Microsoft Excel 2007, Microsoft PowerPoint 2007, and Microsoft Word 2007 documents.

    You can use the enclosed code snippets with the Microsoft Visual Studio® 2008 Code Snippet Manager. Each snippet provides unique functionality that you can reuse within an application. This download provides snippets written in Microsoft Visual Basic.NET® and Microsoft C#® development languages.

    Here’s a list of all the snippets included in this package:

    Microsoft Office Excel Snippets

    Excel: Add custom UI

    Add custom ribbon markup to a specified workbook.

    Excel: Delete comments by user

    Delete comments from a workbook, given an author name. Pass an empty author name to delete all comments.

    Excel: Delete row

    Given a document name, a worksheet name, and a one-based row index, delete a row from the worksheet.

    Excel: Delete worksheet

    Delete the specified sheet from within the specified workbook.

    Excel: Delete XL4 macro sheets

    Given a document name delete all the XL4 macro sheets.

    Excel: Export chart

    Given a workbook and the name of a chart, export the chart to an XML file.

    Excel: Get all sheets

    Retrieve a List of all the sheets in a workbook.

    Excel: Get cell for reading

    Given a document name, a worksheet name, and a cell name, retrieve a reference to the cell for reading. Raise an exception of the cell doesn't exist.

    Excel: Get cell for writing

    Given a spreadsheet document, a sheet name and an address, return a reference to a cell ready to accept a value. Create the cell if necessary.

    Excel: Get cell format

    Given a document name, a worksheet name, and a cell name, return the CellFormat instance associated with the cell.

    Excel: Get cell value

    Given a document name, a worksheet name, and a cell name, get the value of the cell.

    Excel: Get cell value given row and column

    Rertrieve a cell value given its row and column numbers, or a row number and column name.

    Excel: Get column header

    Given a document name, a worksheet name, and a cell name, get the column of the cell and return the content of the first cell in that column.

    Excel: Get defined names

    Given a document name, return a dictionary of defined names.

    Excel: Get hidden rows or columns

    Given a document name, and a worksheet name, return a list of either hidden rows or columns.

    Excel: Get hidden worksheets

    Retrieve a list of all the hidden worksheets in a workbook.

    Excel: Get style border

    Retrieve information about a cell's border.

    Excel: Get style border info

    Get style border information.

    Excel: Get style fill

    Retrieve information about a cell's fill style.

    Excel: Get style fill information

    Retrieve specific font formatting information about a cell.

    Excel: Get style font information

    Retrieve specific font formatting information about a cell.

    Excel: Insert Custom XML

    Insert a custom XML part into a workbook.

    Excel: Insert header or footer

    Insert a header or footer into a workbook.

    Excel: Insert number into cell

    Given a file, a sheet, and a cell, insert a specified numeric value.

    Excel: Insert string into cell

    Given a document name, a worksheet name, a cell name, and a value, insert the text into the specified cell.

    Excel: Insert string into cell

    Insert a string into a specified cell.

    Excel: Set recalc option

    Given a file name, set the recalculation behavior of the workbook. Return the previous calc mode.

    Excel: Worksheet part by name

    Retrieve an entire worksheet part, given its name.

    Microsoft Office PowerPoint Snippets

    PowerPoint: Add comment

    Add a comment to the first slide in a presentation.

    PowerPoint: Delete all comments, by author

    Delete all comments in a PowerPoint presentation for a specific author. Pass an empty string for the author name to delete all comments.

    PowerPoint: Delete slide by title

    Given a presentation and a slide title, delete the slide.

    PowerPoint: Get List of Slide Titles

    Given a presentation file, retrieve a generic list of strings containing the slide titles. Some slide titles might be empty strings.

    PowerPoint: Get slide count

    Given a file name, retrieve the number of slides in the presentation.

    PowerPoint: Get slide index, by title

    Find the zero-based index of a slide within a presentation, given its title.

    PowerPoint: Reorder slides

    Given a PPT deck, an original position, and a new position, attempt to place the slide in the original position into the new position within the deck.

    PowerPoint: Replace image on slide

    Given a presentation, a slide title, and an image file, replace the first image on the selected slide with the new image.

    PowerPoint: Replace slide title

    Given a presentation, a slide title, and a new slide title, find the slide, and modify its title.

    Microsoft Office Word Snippets

    Word: Accept all revisions

    Given a document name and an author name, accept all revisions by the specified author. Pass an empty string for the author to accept all revisions.

    Word: Add Table

    Add a table, including text from an array, to the end of a document.

    Word: Convert DOCM to DOCX

    Convert a macro-enabled document to a standard document.

    Word: Delete all comments

    Given a document name and an author name, delete all comments by the specified author. Pass an empty string for the author to accept all revisions.

    Word: Delete headers and footers

    Delete headers and footers from a document.

    Word: Delete hidden text

    Delete hidden text from a document.

    Word: Extract Styles

    Extract the Styles part from a document, so you can insert it into another document.

    Word: Get application property

    Retrieve the value of an application property from a document.

    Word: Get Content Control

    Retrieve the markup for a specific content control.

    Word: Get core property

    Retrieve the value of a core property from a document.

    Word: Get custom property

    Retrieve a custom property for a document.

    Word: Replace the styles part

    Replace the entire styles part with a styles part extracted from another document.

    Word: Retrieve comments

    Retrieve all the comments from a document in an XDocument instance.

    Word: Retrieve Table of Contents

    Retrieve the table of contents markup, if it exists.

    Word: Set application property

    Given a document name, a property to set, and a value, update the document.

    Word: Set core property

    Set a core Word property (like Version, or LastModifiedBy).

    Word: Set custom property

    Given a document name, a property name/value, and the property type, add a custom property to a document.

    Word: Set print orientation

    Set the print orientation for each section in a document.

    Enjoy!

    Are you an Office Developer? Identify yourself as a member of the “Office Developer Guild”

    This will be interesting for all of you who are into Office development: As Office developers, we can start identifying ourselves as active members of the community by joining the “Office Developer Guild” spearheaded by John Durant.

    The developer community for Microsoft Office grand and healthy. And, the knowledge and expertise in our community is pretty vast and deep. To make it easier for us to stay alert about events, up-coming content, etc. and more easily share ideas we now have the “Office Developer Guild”—a group of like-minded professional friends on Facebook. Additional benefits in the ODG include receiving announcements, slightly ahead of everyone else, of up-coming content, events, etc. That way you can tee up your own blog entries in advance! You’ll also receive exclusive messages from community leaders and insiders. As part of the on-going Office developer conversation I’ll be reaching out, asking questions, and soliciting feedback as well.

    Who can join? Anyone who is interested in how to developer productivity solutions with Microsoft Office. This includes Web, SharePoint, SQL Server, Exchange, VBA, XML and other developers--- all of these products & technologies are relevant.

    How to join? Search for my email on Facebook and request to be added: john.durant@microsoft.com. I’ll add you.

    Host the ODG image: Place the ODG “badge” on your site or blog so that you identify yourself as a member of the “the Guild”. Be sure to announce on the ODG wall that you are hosting the ODG image (shown below).

    mole3y[1]

    Blog, twitter, and help us spread the word

      Bookmark and Share

    Here’s a smaller version of the image that I am hosting on my blog:

    mole3y[1]

    <a href="http://blogs.msdn.com/johnrdurant/archive/2009/07/30/office-developer-guild-is-live.aspx"><img src="http://blogs.msdn.com/blogfiles/johnrdurant/WindowsLiveWriter/OfficeDeveloperGuildisLive_87FB/mole3y%5B1%5D_thumb.png" border="0" width="170" height="88" /></a>

    Hope you all join the “Office Developer Guild!”

    Get Started Resources for Fluent UI Extensibility + Download the New Office Developer Resources Ribbon Tab

    I remember all the buzz generated when we announced the new Fluent UI (Ribbon) for Office 2007 applications. The Microsoft Office Fluent UI replaced the previous system of layered menus, toolbars, and task panes with a simpler system optimized for efficiency and discoverability. The new UI, including the Office Fluent Ribbon, provides improved context menus, enhanced screen tips, a Mini toolbar, and keyboard shortcuts that help to improve user efficiency and productivity.

    In Office 2007, the Fluent UI is implemented in several applications in the 2007 Microsoft Office suite, including Access, Excel, Outlook, PowerPoint, and Word. Fluent UI can be customized programmatically thanks to Fluent UI extensibility. MSDN has great articles, VHTs, and downloads that show you how to get started with Fluent UI extensibility.

    In Office 2010, the Fluent UI is available in more Office apps including Visio, InfoPath, Publisher, Outlook (improved), OneNote, and Project. Thanks to the expansion of Fluent UI to more products, developers will be able to provide more custom Fluent UI experiences. As explained by Brian Jones, in Office 2010 the Fluent UI extensibility story has been improved as well. We have added the ability for programmatically activating tabs in the Fluent UI. For example, you can now have your custom tabs behave like built in contextual tabs, where tabs only show when specific events are fired.

    Fluent UI extensibility resources

    If you are interested in learning more about Fluent UI extensibility and get ready for more Fluent UI programming in Office 2010, here’s a list of recommended resources:

    1. Office Fluent User Interface Developer Portal: This should be your first stop for all resources related to Fluent UI extensibility. This portal page provides technical articles, code samples, videos, Visual How-tos, and developer documentation on customizing the Office Fluent UI in the 2007 Microsoft Office release. Soon, we will have more resources for Office 2010.
    2. Customizing the 2007 Office Fluent Ribbon for Developers (Part 1 of 3): Learn how to customize the 2007 Office Fluent user interface. Also learn how new features in Microsoft Visual Studio 2005 Tools for the 2007 Microsoft Office System support RAD development of Ribbon customizations.
    3. Customizing the 2007 Office Fluent Ribbon for Developers (Part 2 of 3):This article is the companion to the part one and part three articles of the same name. This article contains detailed reference material about the controls and method signatures of the Ribbon user interface.
    4. Customizing the 2007 Office Fluent Ribbon for Developers (Part 3 of 3): This article is the companion to the part one and part two articles of the same name. This article contains a list of frequently asked questions regarding the Microsoft Office Fluent user interface.
    5. Office System Document: Lists of Control IDs: Download files that list the control IDs for built-in controls in all applications that use the Office Fluent Ribbon.
    6. 2007 Office System Document: UI Style Guide for Solutions and Add Ins: Download guidelines for creating a consistent end-user experience based on the design of the 2007 release of Microsoft Office suites.
    7. Visual Studio Code Snippets for the Office Fluent UI: This download includes Microsoft Visual Basic and Microsoft Visual C# code snippets for use when customizing Microsoft Office Excel 2007, Microsoft Office PowerPoint 2007, and Microsoft Office Word 2007.

    Also, check out the Fluent UI resource centers on TechNet and Office Online.

    Download the New Office Developer Resources Ribbon Tab

    MSDN Office Developer Center (ODC) provides a developer roadmap to understand and work with Office System programs, servers, services, tools and technologies. Since we are developers, we thought it would be great to provide a Office Developer Resources Ribbon Tab that you can download for free.  Frank Rice created a super cool Visual Basic .NET shared add-in in Visual Studio that creates a tab on the Word 2007 Ribbon. 

    image

    This Ribbon tab provides quick access to developer sites on MSDN for Office and SharePoint, as well as a rich set or organized links to Get Started, MSDN Library, Learn, Community, Forums and Support resources that matter to Office/SharePoint developers.

    This is a useful tool for anyone interested in getting quick access to Office and SharePoint developer resources from a frequently used application like Word. Also, if you are into blogging from Word or writing technical documentation related to Office or SharePoint, this a tool that simplifies navigation and discoverability to most popular developer resources. Finally, this is just another great sample of the detailed level of customization you can get with Fluent UI extensibility.

    Frank Rice has created most of the developer content we have about Fluent UI extensibility on MSDN and he is considered our expert in Fluent UI development. Frank shares in his blog post the code and process he followed to create this Ribbon. You can download this free add-in at: http://code.msdn.microsoft.com/OfficeDevResourceTab/. Kudos to Frank for this great sample.

    Enjoy!

    What’s New in Office 2010 and SharePoint 2010 (Technical Preview post)
    Bookmark and Share

    I was out of town and had to miss the excitement of blogging about the launch of the Office Technical Preview yesterday. Lucky me, today I have tons of links and trackbacks to other blog posts to share!

    What’s New in Office 2010 and SharePoint 2010?

    Yesterday, Stephen Elop announced the technical preview milestone for Microsoft Office 2010 at the WorldWide Partner Conference.

    From the Press Pass:

    Office 2010 and related products will deliver innovative capabilities and provide new levels of flexibility and choice that will help people:

    • Work anywhere with Office Web applications — the lightweight Web browser versions of Word, PowerPoint, Excel and OneNote — that provide access to documents from virtually anywhere and preserve the look and feel of a document regardless of device.
    • Collaborate better with co-authoring in Microsoft Word 2010, Microsoft PowerPoint 2010 and Microsoft OneNote 2010, and advanced e-mail management and calendaring capabilities in Microsoft Outlook 2010, including the option for users to ”ignore” unwanted threads.
    • Bring ideas to life with video and picture editing, broadcast capability in Microsoft PowerPoint 2010, easy document preparation through the new Microsoft Office Backstage view, and new Sparklines in Microsoft Excel 2010 to visualize data and spot trends more quickly.

    Read more here: http://www.microsoft.com/presspass/press/2009/jul09/07-13Office2010WPCPR.mspx

    What’s new in….

    What’s new for developers in Office 2010 and SharePoint 2010 (TP)?

    Office 2010 Roadmap (TP)
    Tools productivity UI Platform Application Extensibility
    • Fluent UI (Ribbon) support added to more products
    • Backstage view and context menu programmability support
    • Excel “slicers” and “sparklines” extensibility
    • Word, OneNote, PowerPoint, Visio, and Outlook enriched APIs.
    • Improved Outlook object model 

    Read more details at John Durant’s great post.

    SharePoint 2010 Roadmap (TP):
    • Visual Studio 2010 SharePoint tool
    • Language Integrated Query to SharePoint
    • Developer Dashboard
    • Business Connectivity Services
    • Client Object Model
    • Silverlight Web Part

    Read more details at Paul Andrew’s post and at the Developer Sneak peek video:

    Office and SharePoint development blogs:

    More links and resources:

    Availability to the Technical Preview program is “by invitation only” and is not broadly available to the public.  There is a waitlist you can sign up for, found here.

    I’ll keep updating this blog entry as I hear more.

    How to Upload Files to SharePoint Server 2007 from ASP.NET Web Applications
    Bookmark and Share

    Some time ago I  blogged about How to: Uploading a File to a SharePoint Library Site from a Local Folder and How to: Magic with SharePoint 2003, uploading files using a Web service. Some people found these samples useful and some people asked if I could provide sample code that works with SharePoint Server 2007.

    For some time I asked around and realized that there are multiple possible ways to accomplish this task in SharePoint 2007. Here are some popular approaches I’ve learned about and some great possibilities and drawbacks for each:

    • Copy Web service (Copy.asmx): The Copy Web service provides services for copying files within a SharePoint site and between SharePoint sites. Some people have created great samples that show you how to use this Web service to “upload” files while having some control over content types and metadata. This approach actually copies content from one SharePoint site to another, which is great, but may not be the best option if you want to upload files from your local drive to a SharePoint site.
    • Imaging Web Service (Imaging.asmx): This Web service provides methods that enable you to create and manage picture libraries. This WS has an upload method that allows you to upload different files (including non-image files) to SharePoint Image libraries (only) on the current Web site.  However, you can’t use this Web service to upload files to a regular document library (Shared Documents).
    • HTTP PUT method: There’s a third option that allows you to upload files (any file type) from your local drive to a predefined SharePoint list by using the HTTP PUT method. This method is simple and you don’t need to create SharePoint code to upload files. However, for the same reason, you won’t have programmatic control over file metadata on SharePoint lists. It’s super useful though, and I believe this is the best possible way (that I know of so far) to upload files to SharePoint Server 2007.

    For this last approach, Joel Krist has created a new Office Visual How-to that shows how to use the HTTP PUT method to programmatically upload files from an ASP.NET Web application to a Microsoft Office SharePoint Server 2007 site: Uploading Files to SharePoint Server 2007 from ASP.NET Web Applications by Using the HTTP PUT Method. This article provides code samples in both VB and C# and a video that shows how to this.

    Here’s a preview of the video from that same article.

    Enjoy!

    MSDN Office Developer Center – Pre Office/SharePoint 2010 Update

    MSDN Developer Centers pull together content and resources around specific products and technologies. They connect developers with code samples, community sites, technical articles and documentation, upcoming events, and much more. The MSDN Office Developer Center (ODC) provides a developer roadmap to understand and work with Office System programs, servers, services, tools and technologies.

    As we prepare for our next product release (Office 2010 and SharePoint 2010), we worked on a set of site updates to improve navigation, increase discoverability of content, and add more community content and features.

    Here’s a summary of new features and updated pages:

    • Home (Update): Latest blog posts and bio rotator from Microsoft employees experts in Office and SharePoint development. More featured MVP bios and articles. Office resources such as MSDN Magazine articles, Channel 9 videos, Books, Code Gallery samples, and more scoped to Office and SharePoint development.

    ODCHomeFY09

    • Products tab (new): The Microsoft Office system evolved from a suite of personal productivity products into a comprehensive, multifaceted, and integrated system. Building on a solid foundation of familiar tools, the Microsoft Office system today includes applications, servers, services, and technologies designed to work together to solve a wide array of business problems. We have lots of products that have their own developer story, so we built a tab that provides quick access to developer resources by product. This navigation matches Office Online’s Products tab navigation.

    ODCProductsFY09

    • Learn (update): Provides quick access to getting started resources and tools that help you learn more about the Office Developer roadmap.  Redesigned to include links to product-specific learn pages on the developer center (such as Access, SharePoint Server, and so on). All links on the page are scoped to Office Development content, and the certifications and exams listed are specifically for Office and SharePoint developers. We also showcase a featured book of the month on this page with a link to the new Office Developer Bookstore.

    ODCLearnFY09

    • Downloads (update): Redesigned to align more closely with what our customers wanted. We received feedback that made it clear that our developers wanted more than a list of most popular or latest downloads. This page provides now links to Downloads (By Product), quick access to the Microsoft Download Center, Office Downloads and Updates, CodePlex, Code Gallery, and more – all scoped to Office Development.  We kept our four most popular downloads at the top of the page so they are easy to find. Finally, we provide at the bottom an RSS pull for our recently published downloads.

    ODCDownloadsFY09

    • Support (update): This page is now scoped to Office, rather than general help links. In addition to a new template, we added scoped links to each product’s Solution Center as well as forum and newsgroup links. Section 4 adds links to other support-related pages on the Office Developer Center, as well as cross-links to Office, Project, and SharePoint TechCenters on TechNet and to the Help and How-to Center on Office Online.

    ODCSupportFY09

    • Community (update): The “Office Community Resources” set takes developers deeper into Office Community content, both within the MSDN Office Developer Center and outside it. The “Featured Community Content” set rotates the latest content from our MVPs, partners, and experts from the Office and SharePoint developer community. Bio rotators include photos and links to their MVP profiles. We also rotate a set of featured developer books from our MVPs with a link back to our Bookstore. We added dynamic feeds for Twitter, Delicious, and DIGG, scoped to Office development as well as an invitation to follow us on Twitter and Facebook. The Community Submitted Content page in this section  now features Community Highlights, an MVP rotator, a list of top contributors, as well as a comprehensive list of content that our MVPs and community partners have written. In addition to the community section of the portal, we’ve also added MVP rotators to our product home pages as well as improved their product-specific Community pages.

    ODCCommunityFY09ODCCommunitySubmittedFY09

    • Forums tab (new): You can now access MSDN Forums related to Office Development, Office Live Development, SharePoint Products and Technologies, and Unified Communications from the MSDN Office Developer Center.

    ODCForumsFY09

    If you’d like to hear more about what we do or provide feedback, follow us on Twitter, and join our Facebook group. We have a survey where you can leave comments related to your experience with the MSDN Office Developer Center.

    Coming soon Open XML Developer Center revamp!

    Links and Toys of the Week (June 8, 2009)

    Here’s a few toys and great reads that have kept me entertained for the last couple weeks:

    IIS SEO Toolkit Beta Now Available!

    If you manage a personal or company Web site and haven’t heard about this yet, get ready to be amused. The IIS team released last week the IIS Search Engine Optimization (SEO) Toolkit Beta – a free toolkit that helps Web developers, hosting providers, and server administrators improve their sites’ relevance in search results by recommending how to make them more search engine-friendly. The SEO Toolkit Beta is available for installation via the Microsoft Web Platform Installer 2.0 Beta.

    The IIS SEO Toolkit Beta is a piece of the larger Microsoft Web Platform strategy, which enables developers and end-users to build great websites, experiences, and achieve success in the Web ecosystem.

    Some of the great features this tool includes are: customization of crawling (you can ignore ‘nofollow’ attribute and ‘noindex’ metatag, define #links to crawl, and consider internal linking from groups of directories and subdirectories). You can also get SEO violation reports, query results using a UI query builder, generate sitemaps, page inventories, reports of external and internal links,  and much more. My favorite one is the keywords suggestions view:

    msdn_OfficeSEO[1]

    We’ve already crawled MSDN_Office and we’ve found lots of SEO violations. We already started fixing critical issues and our Web site will benefit extensively by using this tool and following best practices recommended by this tool. If you are interested in improving your site for SEO, this download is a must!

    Here’s a few great reads and sites for download:

    Stsadm SilverLight application is live on TechNet

    If you are doing SharePoint development and configuration and struggle to remember Stsadm commands, you should check out this super cool application. It provides a fully browsable interface, in-depth information from the TechNet TOC and library, and links to specific topics for each Stsadm command line operation and property. By using separate XML data files, the SilverLight application is instantly updatable and localizable.

    image_3[1]

    You can find the Stsadm SilverLight application on TechNet here:

    Some other blogs posts where you can find more info about this tool:

    MSDN thinking out-of-the-box and Scott Hanselman’s blog

    Even after years of getting my hands on Office development and loving it, I still continue being a passionate Web developer. I still keep my addiction to anything ASP.NET, AJAX, Silverlight, and Web platform in general.  ScottGu’s blog is a great read to keep-up with news from DevDiv. Another fantastic blog to follow is Scott Hanselman’s blog.  Scott is an expert in Web development and a former ASP.NET MVP who is now working with MSDN and providing great insight and suggestions to improve MSDN. He has a couple blogs posts that discuss alternate views for MSDN, including a Low-Bandwith (loband) view and MSDN Updates - and RFC for you. He is currently working with MSDN on a set of proposed let's go crazy here and try some way-out-there-MSDN designs for MSDN Developer Centers. Here’s a couple designs:

    MSDN_TRAM_HOME_thumb[1] MSDN_SHOE_HOME_D_thumb[1]

    It’s great that someone like Scott is providing all this out-of-the-box thinking and ideas for MSDN. The MSDN Office Developer Center team can’t wait to see the final designs and roll them out to our pages. More here: http://www.hanselman.com/blog/MSDNUpdatesAndRFCForYou.aspx.  You can also follow Scott on on Twitter: @shanselman

    Enjoy!

    Office 2010 for Developers: Conference moving to SharePoint Conference 2009

    Last year I had the opportunity to attend the Office Developer Conference 2008 in San Jose, CA. I remember being there with Sanjay, Ken Getz, and Wouter at the Open XML booth where we had the opportunity to talk to some of you about the latest improvements to the Open XML Format SDK 1.0 and distribute Open XML posters.  I was super happy to hear from Gray that we will have an Office Developer Conference moving to the SharePoint Developer Conference 2009. Office 2010 enables better integration between Office client applications and SharePoint products and technologies. It makes sense to have a shared conference.

    For those of you who are already collecting links to Office 2010 resources, don’t forget to sign-up for the Technical Preview and to pass on the word about the Office Developer Conference this year.

    Here are some other MS blogs that you should follow for news about the conference:

    Bookmark and Share
    Links of the Week (May 15, 2009) for SharePoint Developers
    1. The Windows SharePoint Services Developer Center has a new face and great community features and MVP highlights. This site has a new Bookstore and great Learn resources including videos and webcasts, virtual labs, and resource centers.  Check it out at: http://msdn.microsoft.com/sharepoint  wssDevCenterBoston[1]
    2. The SharePoint Designer Developer Center has a new face as well. Check it out at: http://msdn.microsoft.com/en-us/office/bb421303.aspx. Also, if you have not heard the news yet, SharePoint Designer 2007 is now free!
    3. News from the SharePoint Community in Spanish: Luis du Solier (MVP) has a great blog post and summary (Spanish only) for the 2nd Latin-American Symposium for SharePoint. Slide decks in Spanish as well.
    4. Here’s a compilation of great SharePoint and Office team blogs (courtesy of the fantastic list of official Microsoft blogs by Official Microsoft Team Blogs / Microsoft Blogs).

    Enjoy!

    Open XML Format SDK 2.0: Getting Started Best Practices

    The Open XML Format allows you to generate, manipulate, or pull data from Word 2007, Excel 2007, and PowerPoint 2007 files. If you are working with Microsoft-based solutions, you can generate, manipulate, and pull data from documents using the following tools and technologies:

    Note: If you are working with Java or PHP/Linux/Unix/Solaris, you can also find plenty of resources here and here.

    Anyway, today I want to focus on a couple best practices for getting started with coding for Open XML Format SDK 2.0.

    For the last couple of months I have been working with some Open XML gurus: Zeyad Rajabi, Linda Lanqing Brownell, Eric White, Joel Krist, and Ken Getz. We are working together on a new set of Visual How-tos for the Open XML Format SDK 2.0 and a set of 50+ code snippets for Visual Studio 2008 to be released soon on MSDN.

    Quite frequently I hear from most of them a couple best practices that I’d like to share with you today: If you plan to build a solution using the Open XML Format SDK 2.0…

    1. Always start with a template for your solution
    2. Use DocumentReflector to get started with coding

    Always start with the template for your solution

    The very first thing we recommend you to do before you start writing code for a document solution, is to create the template. Depending on what kind of solution you want to build, you can use Word 2007, Excel 2007, or PowerPoint 2007 to create a template.

    Imagine that you own a software company and you sent all your developers and consultants to the great Office and SharePoint sessions at TechEd this year. The end of the fiscal year is coming soon and you need expense data from each conference attendee ASAP. Developers and consultants plan to spend this weekend on New Orleans, so you ask them to fill out a Web-based Expense Report form that sends data to your company’s accounting database. Your accountant loves Excel 2007 and she asked you to export all expenses per/employee to Excel spreadsheets so she can review details before approving. CSV export won’t do this time because your accountant wants it all pretty and styled.  You want to figure out a way of programmatically generate the Expense Report spreadsheets by pulling data from your accounting database. You need styles and formatting as well. After evaluating lots of tools and technologies, you decide that you want to build this solution using the super cool Open XML Format SDK 2.0. Now what?

    The very first thing we recommend you to do before you start writing code is create the template using Excel 2007. You may ask your accountant to design the Expense Report template using Excel 2007, or you can always download tons of great templates from Office Online. Here’s my sample expense report template:

    expenseRTemplate[1]

    Open the template using Excel 2007 and add some dummy data. Don’t forget to save the template as Excel Workbook file (.xlsx). Now that you have a template to start with, you can start coding the solution.

    Use DocumentReflector to get started with coding

    The Open XML Format SDK 2.0 download ships with a set of tools that facilitate the process of building document solutions using the SDK. One of this tools is the DocumentReflector. This tool has the ability to open an existing Open XML document and dynamically generate C# source code that uses the Open XML SDK 2.0 typesafe classes to create the document parts. Exploring the source code created by DocumentReflector is a great way to become familiar with the Open XML SDK 2.0 classes and the Office document formats. Zeyad refers to this tool as the “Macro Recorder on vitamins” and I can tell you it rocks! The main idea is that once you have a solution template, you open it using the DocumentReflector and you get a set of autogenerated classes that you can later modify with Visual Studio 2008.

    To illustrate using the DocumentReflector to create the base code for the Expense Report solution, follow the next steps:

    1. Open the DocumentReflector tool: The DocumentReflector tool is located in the Tools folder under the Open XML Format SDK 2.0 installation folder. Use Windows Explorer to navigate to the Tools folder and double-click the DocumentReflector.exe file to launch the DocumentReflector tool.
    2. Select the DocumentReflector's File | Open menu and in the Open dialog browse to the folder containing the ExpenseReport.xlsx workbook created previously, select the workbook, and click on the Open button. DocumentReflector will open the workbook and display the content of the document. Clicking on the top-level Package node will display the generated code that can be used to create the entire package.

    docReflector[1]

    At this point the code generated by DocumentReflector can be copied and pasted into the Visual Studio solution for reuse and learning purposes.

    Using Visual Studio 2008 to create a Windows console application

    For testing purposes, you can create a Console application in Visual Studio 2008. Here are some generic steps:

    1. Open Visual Studio 2008.
    2. Create a new C# Windows Console Application project.
    3. Add a reference to the Open XML API assembly.
    4. Add a reference to the WindowsBase assembly.

      The next steps involve copying code generated by the DocumentReflector tool to the Visual Studio project. The DocumentReflector tool provided with the Open XML Format SDK 2.0 allows users to open a valid Open XML document, choose an XML element, part, or the whole package, and have DocumentReflector generate a C# class that can create the selected document parts using the Open XML Format SDK 2.0 classes.
    5. Select the using statements from the top of the DocumentReflector code window then copy and paste them to the top of the Program.cs file in the Visual Studio project.

    [C#]

    using DocumentFormat.OpenXml.Packaging
    using
    ap = DocumentFormat.OpenXml.ExtendedProperties
    using
    vt = DocumentFormat.OpenXml.VariantTypes
    using
    DocumentFormat.OpenXml
    using
    DocumentFormat.OpenXml.Spreadsheet
    using
    a = DocumentFormat.OpenXml.Drawing
    using
    op = DocumentFormat.OpenXml.CustomProperties;

    6. Select the code for all of the methods inside of the GeneratedClass class from the DocumentReflector code window then copy and paste the code as methods of the Program class in the Program.cs file in the Visual Studio project.

    7. Change the copied CreatePackage method to be private static so it can be called from the static Main method.

    [C#]

    private static void CreatePackage(string filePath) { 
       
    using (SpreadsheetDocument package
           
    SpreadsheetDocument.Create(filePath, 
                SpreadsheetDocumentType.Workbook)) { 
            AddParts(package)

       

    }

    The AddParts method creates all the parts that you need in the Expense Report spreadsheet.

    [C#]

    private static void AddParts(SpreadsheetDocument parent) { 
               var extendedFilePropertiesPart1
    = parent.AddNewPart<ExtendedFilePropertiesPart>("rId3")
              
    GenerateExtendedFilePropertiesPart1().Save(extendedFilePropertiesPart1)

              
    var coreFilePropertiesPart1 = parent.AddNewPart<CoreFilePropertiesPart>("rId2")
              
    GenerateCoreFilePropertiesPart1(coreFilePropertiesPart1)

              
    var workbookPart1 = parent.AddWorkbookPart()
              
    GenerateWorkbookPart1().Save(workbookPart1)

              
    var workbookStylesPart1 = workbookPart1.AddNewPart<WorkbookStylesPart>("rId3")
              
    GenerateWorkbookStylesPart1().Save(workbookStylesPart1)

              
    var themePart1 = workbookPart1.AddNewPart<ThemePart>("rId2")
              
    GenerateThemePart1().Save(themePart1)

              
    var worksheetPart1 = workbookPart1.AddNewPart<WorksheetPart>("rId1")
              
    GenerateWorksheetPart1().Save(worksheetPart1)

              
    var spreadsheetPrinterSettingsPart1 = worksheetPart1.AddNewPart<SpreadsheetPrinterSettingsPart>("rId1")
              
    GenerateSpreadsheetPrinterSettingsPart1(spreadsheetPrinterSettingsPart1)

              
    var calculationChainPart1 = workbookPart1.AddNewPart<CalculationChainPart>("rId5")
              
    GenerateCalculationChainPart1().Save(calculationChainPart1)

              
    var sharedStringTablePart1 = workbookPart1.AddNewPart<SharedStringTablePart>("rId4")
              
    GenerateSharedStringTablePart1().Save(sharedStringTablePart1)

              
    var customFilePropertiesPart1 = parent.AddNewPart<CustomFilePropertiesPart>("rId4")
              
    GenerateCustomFilePropertiesPart1().Save(customFilePropertiesPart1)

          

    The GenerateSharedStringTablePart1() method contains the code that you need to create values for the table on the Expense Report. You can modify this code to iterate through the accounting database. You can pull expense report data by employee and replace the dummy data you entered.

    [C#]
    private static SharedStringTable GenerateSharedStringTablePart1() { 
             var element

                 new
    SharedStringTable( 
                    
    new SharedStringItem( 
                        
    new Text("Name")), 
                    
    new SharedStringItem( 
                        
    new Text("Department")), 
                    
    new SharedStringItem( 
                        
    new Text("Manager")), 
                    
    new SharedStringItem( 
                        
    new Text("Position")), 
                    
    new SharedStringItem( 
                        
    new Text("From")), 
                    
    new SharedStringItem( 
                        
    new Text("To")), 
                    
    new SharedStringItem( 
                        
    new Text("Date")), 
                    
    new SharedStringItem( 
                        
    new Text("Account")), 
                    
    new SharedStringItem( 
                        
    new Text("Description")), 
                    
    new SharedStringItem( 
                        
    new Text("Transport")), 
                    
    new SharedStringItem( 
                        
    new Text("Fuel")), 
                    
    new SharedStringItem( 
                        
    new Text("Meals")), 
                    
    new SharedStringItem( 
                        
    new Text("Phone")), 
                    
    new SharedStringItem( 
                        
    new Text("Subtotal")), 
                    
    new SharedStringItem( 
                        
    new Text("Advances")), 
                    
    new SharedStringItem( 
                        
    new Text("For Office Use Only")), 
                    
    new SharedStringItem( 
                        
    new Text("Misc.")), 
                    
    new SharedStringItem( 
                        
    new Text("Hotel")), 
                    
    new SharedStringItem( 
                        
    new Text("Entertainment")), 
                    
    new SharedStringItem( 
                        
    new Text("PURPOSE:")), 
                    
    new SharedStringItem( 
                        
    new Text("STATEMENT NUMBER:")), 
                    
    new SharedStringItem( 
                        
    new Text("PAY PERIOD:")), 
                    
    new SharedStringItem( 
                        
    new Text("EMPLOYEE INFORMATION:")), 
                    
    new SharedStringItem( 
                        
    new Text("Total")), 
                    
    new SharedStringItem( 
                        
    new Text("APPROVED:")), 
                    
    new SharedStringItem( 
                        
    new Text("NOTES: "){ Space = "preserve" }), 
                    
    new SharedStringItem( 
                        
    new Text("    SSN"){ Space = "preserve" }), 
                    
    new SharedStringItem( 
                        
    new Text("    Employee ID"){ Space = "preserve" }), 
                    
    new SharedStringItem( 
                        
    new Text("Expense report")), 
                    
    new SharedStringItem( 
                        
    new Text("TechEd 2009")), 
                    
    new SharedStringItem( 
                        
    new Text("Erika Ehrli Cabral")), 
                    
    new SharedStringItem( 
                        
    new Text("123456")), 
                    
    new SharedStringItem( 
                        
    new Text("12345678")), 
                    
    new SharedStringItem( 
                        
    new Text("Office Development")), 
                    
    new SharedStringItem( 
                        
    new Text("JPBagel")), 
                    
    new SharedStringItem( 
                        
    new Text("Delicious breakfast")), 
                    
    new SharedStringItem( 
                        
    new Text("Developer (in my dreams)")) 
                 ){ Count
    = (UInt32Value)38U, UniqueCount = (UInt32Value)37U }
             return
    element
        

    7. Modify the Main method and add a call to the CreatePackage method.

    [C#]

    static void Main(string[] args){ 
       
    // Create an Excel workbook named ExpenseReportTest.xlsx 
        // in the current folder. You can write some code here to iterate through
        // your accounting database and generate one Spreadsheet per employee.    

    CreatePackage("ExpenseReportTest.xlsx")
    }


    8. Build and run the sample. Using the code shown above the sample application will create an Excel workbook named ExpenseReportTest.xlsx located in the Visual Studio project's Debug or Release build folder depending on the selected build mode.

    Opening the workbook with Excel will display a workbook that looks just like the ExpenseReport.xlsx workbook created previously.

    More resources

    If you are looking for more end-to-end solutions using the Open XML Format SDK 2.0, you must see this articles:

    Also, as mentioned before, Brian’s/Zeyad’s blog and Eric’s blog are always a great resource for Open XML code samples.

    Coming soon the set of Open XML Format SDK 2.0 VHTs and code snippets for Visual Studio 2008!

    More Posts Next page »
    Page view tracker