Suppose you have a .NET application that needs to open a Word document and insert data from a database or from an XML file. To provide this functionality, Microsoft Word documents contain bookmarks, a set of "placeholders" that allow you to insert text at design time and runtime. I want to share with you some guidelines that I use to work with bookmarks:To go to a particular location and insert text, you can create your own bookmarks using the Boomark object. You can also take advantage of the set of prefedined bookmarks to go to a particular location in a document. For example, to insert text at the end of a document, you can do something like:
There are times when you have a huge document and you get lost with all the bookmarks that you might have, or like me, you create some bookmarks and forget or mispell the names you defined for the bookmarks (doh!) while coding. You can use the following snippet of code to get a list of all the bookmarks that you have in your document:
You should also explore the "Bookmark View Controls" provided by Visual Studio Tools for Office v2.0. Take a look at this cool video created by Paul Stub and learn more about bookmarks.
Happy bookmark programming!
I didn't know about that, but Office Online receives over 120,000 queries per month requesting the ability to "save as PDF" in Office! Microsoft has LISTENED to customers and has an answer for a common need. Steven Sinofsky announced this weekend at the MVP Summit another great feature provided by Office "12:"
"Office Word, Excel, PowerPoint, Access, InfoPath, Publisher, Visio, Project, and OneNote – will provide the capability to save documents in the PDF format, which will include a fixed layout representation of the document. PDF documents created by Office “12” may contain live hyperlinks, cross-document links and bookmarks and will support accessibility. PDF documents produced from Microsoft Office Publisher “12” will also include additional support for pre-press specific functionality such as CMYK color models and printing page marks. The PDF format has been developed by Adobe and the specifications are available for developers like Microsoft to use."
I know that lots of customers and developers worldwide will be more than excited about this. Lots of Microsoft Consulting Services customers required to integrate "save as PDF" functionality to their solutions; I would love to be back with them and tell them: You can!
Today, a big set of managed applications generate Word documents, and Excel spreadsheets, and now, without using third-party PDF libraries, you will be able to change some lines of code to save the files using PDF format. Even outside managed applications, you can now save your legal contracts, requests for proposals, work orders, finance budgets and more!
The best part is that Office "12" still has more surprises to announce, so keep close to Office Developer Center and be the first to know the future of Microsoft Office.
I was talking to a customer last week at PDC and we were discussing about the possibilities offered by Microsoft Content Management Server 2002 (MCMS 2002). Powered by Microsoft .NET–connected technology, MCMS 2002 enables companies to quickly and efficiently build, deploy, and maintain mission critical content-rich Web sites.
MCMS 2002 provides a managed object model that allows you to extend the functionality that ships with the product and manage content programmatically. You can create custom navigation controls, placeholder controls, and more. A common need for site managers is to find and replace text of a given set of web pages. Imagine that after a while of creating postings (web pages) inside your MCMS 2002 site, you suddenly realize that you need to replace the text "foo" with the text "bar." Now imagine that you have more than 10,000 postings! MCMS 2002 does not provide built-in functionality to find and replace text because there are multiple combinations of channels, postings, and different kinds of placeholders where you might need to find and replace text. However, you can add this functionality to your site thanks the managed object model that ships with MCMS 2002.
Suppose that given a root channel, you need to find and replace text inside all the HTMLPlaceholders of all postings and the same for each subchannel inside the root channel. The following source code provides a way to implement the functionality that I explained:
So as you can see, you can play around with the MCMS 2002 managed object model and create cool enhancements for your Web sites.
I am back at Redmond and before I continue with my after-trip duties, I want to share with you the Office & SharePoint PDC slides:
Have a peek and enjoy!
Do I have stuff to talk about today! The track lounge became quite popular today after more cool things about Office "12" and SharePoint "v3" were presented through the sessions. The Office team is quite enthusiastic and I can honestly say that they have a great passion for customers and worked extra shifts to answer more questions. Here are some pictures of the Office & SharePoint Track Lounge while the day started:
I could write for hours about the sessions and discussions related to Office "12" and SharePoint here at PDC. However, I will keep it simple and write about some of the key enhancements that were presented in some sessions and discussions throughout the day:
Before I became a part of the Office User Assistance Team, I used to be an MCS Development Consultant, and I know that all these scenarios/challenges are common business needs for different organizations. I am glad to see that the Office and SharePoint team made a great effort to understand the current needs and pains that appear across organizations and is delivering a well-thought set of solutions through Office "12" and Windows SharePoint Services "v3" that help to solve common business problems easily and makes a simple kind of life for developers too!
Microsoft continues to invest deeply in XML in Office. The new release of Microsoft Office "12" Word®, Microsoft Office "12" Excel®, and Microsoft Office "12" PowerPoint® includes a set of XML schemas that comply with the W3C specifications. The XML schemas allow you to understand an XML based definition of Word documents, Excel spreadsheets, and PowerPoint presentations as part of the new Open XML formats for Office "12."
If you want to understand more of the internals of Microsoft Office "12" Word®, Microsoft Office "12" Excel®, and Microsoft Office "12" PowerPoint®, download the Office "12" XML Schema Reference - PDC 2005 Preview and take a deep dive into the XML schemas.
Keep in mind that this is draft documentation and that some details of the schemas might change for the Beta release.
I was dying to blog since I woke up this morning and finally I got a chance to sit down and share some Office "12" news with the community.
The day started with Steven Sinfosky's Keynote, where he announced some of the coolest enhancements for Office "12" and Windows SharePoint Services "v3." Steven started his presentation by talking about how the Office System has evolved to a results-oriented developer platform that allows extensibility thanks to the integration to XML and Web Services, Visual Studio .NET and managed code, a results oriented user interface, and the XML File Formats. Steven concluded his keynote with some great demos for InfoPath, Access, SharePoint, Excel, and Outllook. I really enjoyed to experience the joy and surprise shown by the audience as Steven presented some of the new features added to Office "12."
We also had eight sessions today that are related to Office "12' or Windows SharePoint Services "v3". In a nutshell, I can share with you some of the new enhancements that were announced today and yesterday at PDC and that are related to Office "12" and Windows SharePoint Services "v3":
Introducing and extending the Ribbon User Interface
Office "12" has a new look for client applications that replaces menus and toolbars with a Ribbon UI that organizes buttons, galleries, menus, and toolbars into tabs organized by categories. If you created special toolbars and CommandBars, the UI displays a special tab for your custom functionality. You can also extend the Ribbon UI by creating COM or managed Add-Ins or by using a text-based XML markup definition to create and customize the UI. The following picture shows a peek of the Ribbon UI:
Open XML File Formats
Office "12" provides a new XML based file format that allows interoperability and collaboration between other Microsoft Office System and third-party applications. The new XML file format replaces the previous Word, Excel, PowerPoint, Access, and Project file extensions to an open XML file format that is integrated with ZIP compressions to reduce the file size up to 75 percent. Office "12" client applications still allow you to save documents in the previous file format for backward compatibility. The files generated by Office "12" client applications are not only raw documents, now, you can use these files as a repository for data used by other applications.
InfoPath Forms services
InfoPath Forms services provide a Web browser form-filling experience for users that need to complete InfoPath forms from Web-based applications. This Web experience is built as a feature on top of the Microsoft Windows SharePoint Services "v3" platform. This feature is really cool because now you can add InfoPath forms to your ASP.NET applications.
Excel services
Some Web-based applications require to host Excel and interact with spreadsheets to explore and pivot on data, calculate and set values, or analyze PivotTable reports and charts using the browser. To obtain this functionality, Microsoft introduces Excel services. Excel spreadsheet services provide you with the ability to view and interact with spreadsheets in a browser. You can calculate, create snapshots, and extract values from the workbooks. You can also programmatically generate, manage, and distribute customized Excel spreadsheets by using Excel spreadsheet services. When I knew about this I almost cried! This one was a great need that lots of customers demanded and I am happy that we have something like this now and into the future.
Access, InfoPath, Windows SharePoint Services, and Outlook integration and collaboration
Believe it or not, you can create business workflows where you can define for example and InfoPath form that is filled inside Outlook, when sent back, a WorkFlow is updated inside Windows SharePoint Services, and the data stored inside Access. Today, writing and application that accomplishes this set of tasks is a bit complex and requires many lines of code. With Office "12" and Windows SharePoint Services "v3" ease of use, collaboration, and productivity have a real meaning.
I close the day with a picture of the great Office "12" stairs at PDC: "Step Up to the Future" - Microsoft Office "12"
So here we are at PDC 2005!
Bill Gates and Chris Caposella (the VP for Information Worker Division at Microsoft), presented a preview of Windows Vista and Office "12." The demo included a preview of the new ribbon user interface for Office "12" client applications and some of the productivity enhancements added to Excel "12", Word "12, and Windows SharePoint services "v3." Today, Jensen Harris and Andy Himberger will present a two-part session that provides guidance to extend and customize the Office "12" user interface, so keep connected to know more about the outcome of these sessions.
If you are here at PDC, come to the Office & SharePoint Track Lounge, a place where you can come to ask questions to the experts and meet the speakers for Office & SharePoint sessions. The following table displays the schedule for the Office & SharePoint Track Lounge:
PDC starts next week and many enhancements for Office "12" and SharePoint "v3" will be announced, so expect to learn more about what's new for Office developers next week. The Office Developer Center will have some great surprises for you, so stop by next week.
I am very happy because I will be at L.A. next week to attend PDC 2005. I am responsible for the Office & SharePoint Track Lounge, a place where you can stop by and hang out to meet the speakers, staff, and experts. If you are not attending PDC, visit my blog, I will keep you posted on the latest news and surprises.
If you are attending PDC 2005, don't loose the opportuniy to learn more about the possibilities that Office offers as a development platform:
You should check out the Excel XML Writer Library and the Excel XML Writer Library Code Generator created by Carlos Aguilar Mares. Carlos downloaded the Office 2003: XML Reference Schemas, ripped the bones of the Excel 2003 XML Reference Schema, and created a C# library that allows you to generate Office 2003 XML Workbooks. If want to see the power of Excel and XML in action, this is a MUST see. This tool is more than fantastic!
Since I woke up this morning I was thinking how XML has changed the information systems world. I remembered that when I was in college, I had a client-server teacher who started talking about this new thing called XML and his advice was: “you should explore this baby since it’s going to change the world someday.”
Since the late 90s, the minds of the software development world adopted XML and designed products that included support and integration for XML. The Microsoft Office team decided as well to integrate XML and to start the XML in Office story. Office 2000 and Office XP were the XML in Office beginners, with these versions you were able to open and save XML files. XML started to gain power and popularity and became the interoperability standard, the lingua franca of all systems. Office 2003 then expanded the possibilities of working with XML and products such as Word, Excel, Access, and InfoPath offered a deeper integration with XML. With Office 2003 you can do more than save and open files, among other things, you can create XML mappings in Excel, transform Word documents into XSL-FO format, turn user input into XML using InfoPath, and allow developers to create their own XML schema structure representing information within Office 2003 programs. The Office 12 version will expand even more the possibilities for the XML in Office story; for starters, all documents will have open XML-based file formats.
Here are my recommended steps and pointers to become a part of the XML in Office story:
For everyone, read books, explore blogs and newsgroups, and play around with Office and XML. Try to solve a business or home problem using what you learned; you will be surprised of the power of XML in Office.
If you are building a .NET application and you are struggling to find a way to host Word documents, Excel spreadsheets, Visio drawings, Project files, or PowerPoint presentations, you might consider using the Visual C++ ActiveX Control for hosting Office documents. I learned about this download resource and I was shocked to see how you can add it to your solution and start working with Office applications in less than a minute. You can open Office applications, format content, update documents, save changes, print, and more inside your application. The Office Framer Control is an Active X control written in C++. The download includes source code to extend the functionality and sample code to use it inside Visual Basic 6 and HTML pages. You can also enable and disable specific functionality by using a full set of properties, methods, and events exposed for customization.
You can also host the control inside managed applications following these simple steps:
Greetings fellow developers!
My name is Erika Ehrli and I am the new Site Manager of the MSDN Office Developer Center (ODC). I will continue the awesome work that John Durant -the short bald man - started. Today I am starting a new adventure by using this space as my definite stop to share with you code samples, thoughts, and tips that I have learned to get the best of Office client applications and servers.
I want to start my blog by sharing with you what moves me to be here: I am a developer, and as many developers around the world, I have been faced with the constant change of technology. As developers we are always exposed to new and better ways to create software and we have a constant need to obtain information and resources to learn how to build solutions and integrate technology to solve our business needs or our customer's needs. We are always demanding to find accurate samples, source code, conceptual and procedural documentation, and of course, the sooner we find it the better.
I admire all the people who use their talent and knowledge to create whitepapers, code samples, blogs, and tools to help other people to get the best out of software. Sharing knowledge is one of the best ways to make a difference in other developers’ experience with technology, so here I am starting my own way to contribute and enjoying this great opportunity to become one of the voices for the Office development story.