I changed the stle of TOC,but why It didn't work?


I have already changed the TOC style, and when i debugged it, it shows ‘Times New Roman’, but the ouput of the doc is still unchanged, why ? Is there something i miss ?

@Madecho Could you please attach your input and output documents here for our reference along with code that will allow us to reproduce the problem? We will check the issue and provide you more information.

test.docx (995.4 KB)
in this document, the Directory style is already set, but when i update the directory, the output of the directory is not as i expected.


the output is :

i know i miss something, but i just want to produce the direcotry and chapter section separately with different style. I want to update the direcotry the form as i set. How could I update the directory alone just as the directory format that I set

@Madecho As I can see fonts in the styles are properly updated by Aspose.Words:

<w:style w:type="paragraph" w:styleId="TOC1">
	<w:name w:val="toc 1" />
	<w:hidden />
	<w:uiPriority w:val="39" />
	<w:rsid w:val="008956A3" />
	<w:pPr>
		<w:tabs>
			<w:tab w:val="right" w:leader="dot" w:pos="8504" />
		</w:tabs>
		<w:spacing w:before="120" w:line="400" w:lineRule="exact" />
		<w:jc w:val="both" />
	</w:pPr>
	<w:rPr>
		<w:rFonts w:ascii="Times New Roman" w:eastAsia="Times New Roman" w:hAnsi="Times New Roman" w:cs="Times New Roman" />
		<w:color w:val="000000" />
		<w:sz w:val="24" />
		<w:highlight w:val="white" />
	</w:rPr>
</w:style>

but since your document is in Chinese and Times New Roman does not contain Chinese glyphs, MS Word fallbacks to the available fonts with the required Chinese glyphs.

@alexey.noskov hi. may i explain it more clearly. the directory update seems connect with the Heading format.what if i want to update it separately ? I want the directory update just as in the direcotry style setting :


but the actual update is in the format of my content’s heading style

@alexey.noskov

although it looks like the heading is connected with heading3, but acutally, when i clicked it again, it became


the first style is setting using aspose words for java, as its output. but it didn’t really connect to any style, i just want it to connect it to a certain style that i already set in Java code, is that possible ?

@Madecho In MS Word documents text formatting can be applied on several levels. For example you can set formatting using styles and then override this formatting by explicit formatting. For example let’s take a look at the third level heading paragraph in your document:

<w:p w14:paraId="0F37AE16" w14:textId="77777777" w:rsidR="00036964" w:rsidRPr="00F05E65" w:rsidRDefault="00000000">
	<w:pPr>
		<w:pStyle w:val="Heading3"/>
		<w:numPr>
			<w:ilvl w:val="2"/>
			<w:numId w:val="57"/>
		</w:numPr>
		<w:spacing w:before="240" w:after="120" w:line="400" w:lineRule="exact"/>
		<w:ind w:right="0"/>
		<w:rPr>
			<w:rFonts w:ascii="FangSong" w:eastAsia="FangSong" w:hAnsi="FangSong" w:cs="Times New Roman"/>
			<w:sz w:val="30"/>
			<w:szCs w:val="30"/>
		</w:rPr>
	</w:pPr>
	<w:bookmarkStart w:id="12" w:name="_Toc171438109"/>
	<w:bookmarkEnd w:id="12"/>
	<w:r>
		<w:rPr>
			<w:rFonts w:ascii="Arial" w:eastAsia="SimHei" w:cs="Arial"/>
			<w:sz w:val="26"/>
			<w:highlight w:val="white"/>
		</w:rPr>
		<w:t xml:space="preserve">  </w:t>
	</w:r>
	<w:bookmarkStart w:id="13" w:name="_Toc172280354"/>
	<w:r>
		<w:rPr>
			<w:rFonts w:ascii="Arial" w:eastAsia="SimHei" w:cs="Arial"/>
			<w:sz w:val="26"/>
			<w:highlight w:val="white"/>
		</w:rPr>
		<w:t>研究思路</w:t>
	</w:r>
	<w:bookmarkEnd w:id="13"/>
</w:p>

As you can see Heading3 style is applied in the paragraph properties. But there is also formatting apliied dirrectly to the paragraph, such as list formatting:

		<w:numPr>
			<w:ilvl w:val="2"/>
			<w:numId w:val="57"/>
		</w:numPr>

And other formatting options. So if you clear formatting of this paragraph in MS Word and then apply the same style, formatting of the resulting paragraph will not be the same as before. Actually it is not a good practice to apply explicit formatting to the paragraphs, which should be formatted with styles. It would be better to define all required formatting in the style and apply this style to the paragraph. In such case there will not be mess with formatting applied via style and explicitly set formatting.