aspose word for java去除目錄文字藍色樣式以及文字下方藍色下划線


//去除目錄文字藍色樣式以及文字下方藍色下划線
			for(FieldStart field: (Iterable<FieldStart>)doc.getChildNodes(NodeType.FIELD_START, true)){
				if (field.getFieldType() == FieldType.FIELD_HYPERLINK)
				{
					FieldHyperlink hyperlink = (FieldHyperlink)field.getField();
					//判斷是否是目錄
					if (hyperlink.getSubAddress() != null && hyperlink.getSubAddress().startsWith("_Toc"))	{
						//獲取目錄每行段落對象
						Paragraph tocItem = (Paragraph)field.getAncestor(NodeType.PARAGRAPH);
						if (tocItem != null) {
							//設置每行目錄樣式
							for (Run run : tocItem.getRuns()) {
								run.getFont().setColor(Color.BLACK);
								run.getFont().setBold(false);
								run.getFont().setUnderline(Underline.NONE);
							}
						}
					}
				}
			}


免責聲明!

本站轉載的文章為個人學習借鑒使用,本站對版權不負任何法律責任。如果侵犯了您的隱私權益,請聯系本站郵箱yoyou2525@163.com刪除。



 
粵ICP備18138465號   © 2018-2025 CODEPRJ.COM