Thursday, January 08, 2009 6:53 AMA couple of questions:
- When importing XHTML using the AltChunk method the text always uses the "Normal" style defined in word. Is there anyway to impose a custom defined word style on these imported chunks? My colleague has tried setting the paragraph and run font properties and has also tried setting the class on the imported XHTML without success.
Tuesday, January 13, 2009 2:24 AMCreating a table of contents requires some kind of layout engine in order to determine page numbers. As you may know, the Open XML SDK does not perform layout functionality. That being said, there is a way around this limitation. You can let Word update the TOC on open by doing the following to the markup:
- Set the dirty attribute to have a value of true within the fldChar element
Zeyad Rajabi (MS)
Wednesday, May 20, 2009 1:23 PMZeyad,
Thank you for this helpful information. Can you expand on it please? I am new to Open XML and could use some clarification, specifically:
1) Which fldChar element should have the 'dirty' attribute? My sample docx has several fldChar elements but it is not clear which of them are associated with the TOC.
2) My docx does not have a settings.xml file, do I need to add one?
Friday, June 19, 2009 6:06 AMUnfortunately, it doesn't help me. Word 2007 doesn't update content of TOC on open :(
Monday, December 21, 2009 11:02 PMI haven't found this to work at all. I can set updateFields to "true" but then validation for the document fails stating that updateFields is an invalid child element for w:settings? The documentation would disagree, so I'm at a loss as to why the validator would appear to be lying. Any thoughts?
Thursday, October 21, 2010 3:20 PMSorry but just tried the above solution and it fails for me as well. I get the validation error on document.xml after adding the updateFields to the settings.xml?
Friday, October 22, 2010 12:02 AM
In terms of Office/SharePoint 2007, my colleague installed Word on the server (not ideal) to get the desired functionality with TOC update and PDF conversion.
And while this is not an answer for MOSS, it's worthwhile pointing out that Word Automation Services in SharePoint 2010 provides this functionality: http://msdn.microsoft.com/en-us/library/ff742315.aspx#woas_integrating
The key line of code is:Cheers.
job.Settings.UpdateFields = True
- Marked As Answer by Peter_D503 Friday, October 22, 2010 12:02 AM
Monday, February 14, 2011 6:51 PM
Sorry but just tried the above solution and it fails for me as well. I get the validation error on document.xml after adding the updateFields to the settings.xml?
Any help on this? I am having the same problem.
Thursday, February 17, 2011 8:00 PM
This whole OOXML stuff is amazing me more and more. Alas not always in a positive way.... There's so much potential but so little documentation!!!
I just would like to enter some code in VS2008 using OOXML SDK2, to let Word re-generate (or generate, which is easier???) the TOC in my document. I keep trying but cant' seem to find the right bits of the parts of the package....
Tuesday, August 23, 2011 2:01 AM
I've written some code that correctly sets the w:updateFields element in the settings part. The code shows how to add/update a TOC in a document. Updating is either via Word automation, or Word Automation Services.Exploring tables of contents in OpenXML WordprocessingML documents.
Tuesday, March 27, 2012 7:05 PMThis thread on Stack Overflow might be useful to read: How to generate Table Of Contents using OpenXML SDK 2.0?
Don't forget to vote for useful replies and/or mark answers for your questions - that helps other guys to find the answer faster.