Filed under: Office, Word — patrickyong @ 11:37 am
Tested on Word 2007
When you’re creating a bulleted or numbered list in Microsoft Office Word or Microsoft Office PowerPoint, you might want an item to appear in the list without a bullet or without incrementing the number. You can start a new line without a bullet by pressing SHIFT+ENTER. The next time you press the ENTER key, the new line will continue the bulleted or numbered list.
In my previous post I discovered that Content Controls in WordprocessingML files which has data binding to a CustomXML part will not render properly. However, this ONLY apply if you programmatically replaces the CustomXML part but never modify the value of <w:t> within the <w:sdt> element just like in this Eric White’s video on YouTube or as per mentioned in the book [Pro SharePoint Solution Development] in Chapter 7 .
To make things clearer, lets look at the screen shots below. For a Word 2007 document with CustomXML data bound(AND also with the CustomXML modified programmatically), below is what it looks like by default when you open it with Office 2003 (or XP and 2000), the data does not appear (below).
Even though you see there is no problem when open it up with Office 2007 (below)
This is because the Compatibility Pack for Office 2007 File Format does not render the value data bound inside the <w:databinding> element but instead its take the value in <w:t> element, shown below:
So I created a generic project using the latest OpenXML SDK (April 08 CTP) and together with LINQ to XML to modify the content within <w:t> element with the value from the CustomXML part. You can download my full source code here, but basically this is how my solution works:
string xpath; XElement t; var bindings = mainXml.Descendants(w + “dataBinding”);
This is where the magic works, grab XPath attribute value from all the <w:databinding> elements and then replace it into <w:t> element using GetValueFromCustomXmlParts method (details do refer my source code)
XmlDocument temp = new XmlDocument(); temp.Load(mainXml.CreateReader()); temp.Save(wordDoc.MainDocumentPart.GetStream(FileMode.Create, FileAccess.Write)); } }
After that the Word 2007 document can be opened in Office 2003 and data are rendered successfully. This solution also works in other none-MS Office productivity suites such as ThinkOffice and WordPerfect.
Disclamer: This is just a quick fix or rather a proof of concept on how to solve the <w:databinding> element problem on a simple Word 2007 document, there are many situations (or more complex document layout) I haven’t tested the solution on. Do download my solution at your own risk. If you bump into problems do let me know, but my help will only be on best effort basis.
By the way, here is Eric’s video on the new OpenXML SDK
Filed under: OpenXML, Word — patrickyong @ 10:01 am
I created a Word 2007 file with data binding to a CustomXML part
When I open it in Word 2003 with the capability pack installed, the data is not displayed.
After some investigation, I open up the document.xml (just rename the word file extension to .zip instead of .docx) and realize that the compatibility pack only renders the content inside <w:t> tag and ignores the XPath binding on the <w:dataBinding> tag. Below is a part of my document.xml, notice the blue colored text.
If you are creating a WordML document thru this manner and want to enable it for users of older version of Word, remember to update your <w:t> tag as well.
Sounds familiar? This is the No. 1 complain for first time user of Office 2007 because of the new Ribbon user interface, quite a number of commands have been repositioned. I keep on telling people that after a couple of weeks they will get used to the new UI and actually be happy with it. Honestly at least I do (whether or not I working with Microsoft)
So for the rest of us, Office Labs launched a new Office add in called Search Commands. It helps you find commands, options, wizards, and galleries in Microsoft Office 2007 Word, Excel and PowerPoint. Just type what you’re looking for in your own words and click the command you need. Search Commands also includes Guided Help, which acts as a tour guide for specific tasks. (pic above)
I guess this headline sure caught your attention. Actually you still can’t go to Low Yat today and asked for a free copy, don’t even try come to 29th floor KLCC either!
You see, I just discovered that the last DOS based version of MS Word (v5.5) has been made available by Microsoft since 1999 after they released it as a Y2k fix.
You can download the program here. Below is a screen shot.
Microsoft just launch the beta version of Office Live Workspace after allowing pre-registration for US based customers few months ago. Good news is this time it is available worldwide. Goto this URL to sign in using your Windows Live/ Hotmail ID http://workspace.office.live.com/
Upon signing in you will get a screen as below, notice that there is an ‘Install Office Add-in’ button. This is a less than 1Mb .msi file download which gives you integration on Word, Excel and PowerPoint.
I look at Office Live Workspace as a online extension of the Office client. There is a personal document library for you which you also can share with other people. Then for Outlook you can synchronize your tasks, appointments, contacts and even notes on your workspace.
On the help file it stated that the integration is available for Office 2003 and XP as well. Cool, FREE new features for older version of Office product. How many vendor does that?
Today the MSE team did a Tech Preview to fellow developers on Visual Studio 2008 which actually available for MSDN subscribers late last year and is available for sales now.
My session is about Visual Studio Tools for Office (VSTO) 2008 and a lot of productivity enhancements have been put inside the package in this current version. They include but not limited to:
Better UI Development on Office UI
Form Regions in Outlook
Custom Task Pane
Custom Ribbon for Excel, Word and PowerPoint.
No relearn, leverage on Windows Form Development skill
Windows Form able to host WPF app and extends this capability via Custom Task Pane
SharePoint Workflow development
No more manual writing of workflow.xml, feature.xml (both are SharePoint feature config files) and deployment script
Streamline development process from 15 steps to 3 steps in VSTO 2008
Word Content Control data binding with VSTO addin
Bringing unstructured data from Word documents to a structured world
Able to attach custom XML such as RosettaNet or UNeDoc which as industry based XML schema to Word data.
Easy deployment of VSTO – Office Addin via Click Once
No more reliant on CASPOL
Transparent to end users
I demo a cool VSTO addin for Word 2007 hosting a WPF user control with colossal effect and acting as a client to a WCF services at the back end. The data access is done using LINQ for XML. After that I will publish
It is based on an article in MSDN Dec 2007 issue but the source codes there is not working for RTM version of VS 2008. Many thanks for fellow MS staff Andrew Whitechapel for making it work for VS2008 RTM.
You can download the slides and working version of the source code here. They are hosted on Windows Live Skiydrive/ Folders.