Determining the tab leader in a Table of Contents
-
Sunday, April 24, 2011 8:30 PM
Hi;
Please take a look at http://www.windwardreports.com/temp/bug_table_of_content_2.docx - it marks the tabs as not having a dot leader. The TOC styles have no tabs in them so I think the correct use is a tab with leading dots.
So... How does it know to turn the dots off in the tabs in the generated part of the TOC?
thanks - dave
Very funny video - What's your Metaphor?
All Replies
-
Monday, April 25, 2011 4:17 PMModerator
Hi,
Thanks for your question. One of our team member will work on it and post the response soon.
Hongwei Sun -MSFT -
Tuesday, April 26, 2011 2:59 PMModerator
Hi David,
I will be looking into this for you and will get back to you shortly.
Best regards,
Tom Jebo
Escalation Engineer
Microsoft Open Specifications -
Tuesday, April 26, 2011 3:00 PMModerator
Hi David,
I will be looking into this for you and will get back to you shortly.
Best regards,
Tom Jebo
Escalation Engineer
Microsoft Open Specifications -
Wednesday, April 27, 2011 8:02 PMModerator
Hey David,
In comparing your TOC with one emitted by Word (in the OOXML), I see that yours has:
-<w:tabs><w:tab w:val="right" w:pos="9016"/></w:tabs>
Where the Word emitted xml has:
-<w:tabs><w:tab w:val="right" w:pos="9350" w:leader="dot"/></w:tabs>
So it looks like the leader attribute is what you're missing.
Are you generating this docx file with Word or some other application?
Tom
-
Wednesday, April 27, 2011 8:09 PM
Hi Tom;
Yes, there is that difference. But that is in the nodes that are auto-generated by the TOC field. How does the TOC field know to generate it that way? We need to know because we rebuild the TOC field when generating reports (the report can have more Heading 1 paragraphs than the original document). The DOCX spec does not say anything about what the rules are for generating the body of a TOC field.
thanks - dave
Very funny video - What's your Metaphor? -
Wednesday, April 27, 2011 9:57 PMModerator
Oh I understand. I'm thinking Word uses the style hierarchy but I'm not sure. Let me dig a little and find out where the tab style comes from.
Tom
-
Wednesday, May 04, 2011 3:12 PM
-
Wednesday, May 04, 2011 4:26 PMModerator
Hi Dave,
I'm still working on this but have gotten closer to an answer. Thanks for your patience. I expect to have something for you by end of the day or morning.
Best regards,
Tom Jebo
Escalation Engineer
Microsoft Open Specifications -
Friday, May 06, 2011 5:23 PMA little bit of experimenting suggests that there isn't any extra setting and the setting in the first node is taken as the one to use when rebuilding the TOC. If you set them all different (well, some of them, there aren't enough settings to make them all different!) they will each display as individually set, but when you rebuild they are all set to whatever the first one was. The value is available in the OM if you have access to it (which isn't entrely straightforward, of course, if there are multiple TOCs in the document).
Enjoy,
Tony
www.WordArticles.com -
Friday, May 06, 2011 8:04 PM
Hi Tony;
I'm not following. I took the uploaded document and set the tabs in the first TOC line to be dots - see http://www.windwardreports.com/temp/SetFirstAsDots.docx. This only changed that one line which makes sense as I set just that.
But then I told it to update the table and got http://www.windwardreports.com/temp/AfterUpdate.docx - where it dropped the dots from the main TOC lines, but then added them to the secondary lines.
Maybe I'm missing something, but I'm not seeing the logic here.
??? - thanks - dave
Very funny video - What's your Metaphor? -
Friday, May 06, 2011 11:23 PMHi Dave,OK, it's a little more complex than I suggested. :-) Your TOC1 style has tabs defined within it, without a leader, and that is overriding what's in the TOC itself.I'm guessing a little bit but the leader for each TOC level appears to come from the relevant style if it is specfied there and if not, from the first element of the TOC. That seems to make sense, but there may be more complexity, I'll need to play with some more levels to be sure!
Enjoy,
Tony
www.WordArticles.com -
Saturday, May 07, 2011 1:47 PM
Hi Tony;
Can you please push this question up to the Office dev team? We've played around with it for years but each time we think we've guessed the system, 3 months later we get an example that doesn't match our guess.
I think this requires the Word team to tell us what they are actually doing. And I think it's a reasonable request as otherwise the DOCX spec is incomplete.
thanks - dave
Very funny video - What's your Metaphor? -
Monday, May 09, 2011 12:47 PMWhilst TOCs are pretty complex, the spec seems complete to me; it defines the meaning of the field codes, but it does not define application behaviour. One could argue (as I often do) that Word - the application - should be properly documented, but that is a different issue.The spec says ..."A field update shall be carried out such that the content contained within the field result correctly reflects the intended semantics of the field codes (as defined in the [field description later]) .... "and leaves it up to the individual consumer exactly how they go about doing it. In theory a different consumer (including, but not limited to, a future version of Word) could choose to do things differently.In the absence of documentation, one is left to determine Word behaviour, to some extent, by trial and error and, in the case of a TOC there are a couple of issues (none of them to do with the new file format) ...... there is a field switch (\p) to define the separator between an entry and its page number, and this is what should be used; if it is not sepcified, the default (according to the spec) is a tab with leader dots. This has never worked properly in Word - that's not to say that it can't be specified, or has no effect - it just doesn't work properly.... there is no mechanism (in the spec) for the specification of a tab with any other leader, other than the switch. What Word does is incorrect.... the specification of tabs (however done) on the field causes a conflict between the setting in the field and the Styles of the generated content. Word chooses to resolve this by using the setting in the Style if there is one.Generating a complete TOC, in exactly the way Word does, is a huge task, but why do you need to do it? If you have access to the Word Object Model, why not get Word to do all the hard work.For more information on TOCs from the user standpoint, see Suzanne Barnhill's page, here: http://word..mvps.org/FAQs/Formatting/TOCSwitches.htm.
Enjoy,
Tony
www.WordArticles.com -
Monday, May 09, 2011 2:48 PM
Hi Tony;
On your first point, I disagree. I think the spec is incomplete if you cannot render an identical document as Word does. By definition if the information does not exist to match Word, then it is not a complete spec.
On the second point, our engine has a Java version and even for the .net version, using Office on the server makes for a slow and buggy process. So we have to render the output ourselves.
thanks - dave
Very funny video - What's your Metaphor? -
Monday, May 09, 2011 6:28 PMHi Dave,I do think it's an interesting question, but, whatever detail the spec should contain, although it was obviously based on Word, it is not a spec for Word, it is a spec for a generic document (not controlled by Microsoft) and Word is not following it as far as tab leaders go; I suppose that information might belong in the compliance document, although one could argue that what they do is an extension to the standard and, as such, is not explicitly non-compliant. I don't know where bugs should be documented - Microsoft has a tendency only to document them, and then only grudgingly, when they become history.I do understand - and share - much of your frustration, but wouldn't really expect a positive response from Microsoft.
Enjoy,
Tony
www.WordArticles.com -
Monday, May 09, 2011 9:29 PM
Hi Tony;
Everything you say is how Microsoft treated RTF and is a large part of the reason that spec became close to useless.
However there's a big difference with OpenXML. Microsoft is selling OpenXML to governments and large companies as a complete public standard as those bodies will only purchase Office if it stores files in an open standard. If Microsoft now turns around and says that Office will not match the open spec guidelines in places, that violates their committment to those governments/companies who purchased based on that promise.
So I think they do need to clarify where Office does not match the spec. Or tell their large purchasers that when they said the new Office spec is an open standard, that didn't mean they would follow it.
Very funny video - What's your Metaphor? -
Wednesday, May 11, 2011 5:26 PM
-
Tuesday, June 07, 2011 11:22 PMModerator
Hi David,
This topic is out of scope for this particular forum (see ISO 29500 section 17.15.1.90) and in fact is one for which we have not identified an appropriate forum. As you already are aware, we will be discussing this with you offline in an effort to help you.
Best regards,
Tom Jebo
Escalation Engineer
Microsoft Open Specifications -
Wednesday, June 08, 2011 9:39 AMI am delighted that you are going to take this a stage further - it was, witness my posts in this thread - not what I expected. If you must take this offline, however, can I please ask, in the interests of the community, that whatever resolution is reached be posted here for all to know?
Enjoy,
Tony
www.WordArticles.com -
Wednesday, June 08, 2011 12:11 PM
Tony;
When I get an authoratative answer I will write it up in my blog and post a link here.
thanks - dave
The future of B.I. - Raw & Uncut -
Wednesday, June 08, 2011 1:33 PM
-
Monday, August 22, 2011 10:27 PM
Answer here - http://blogs.windwardreports.com/davidt/2011/08/how-word-builds-the-table-of-contents-field-content.html
thanks - dave
The future of B.I. - Raw & Uncut- Marked As Answer by DavidThi808 Monday, August 22, 2011 10:28 PM

