在 Word 文件建置過程中記錄物件樹,可以為開發人員提供重要的偵錯見解和驗證工具,使他們能夠快速識別和修正文件結構中的錯誤或不一致之處。 透過分析物件樹,可以幫助開發人員識別和解決建置過程中的低效率問題,從而有助於效能最佳化。 總而言之,記錄物件樹可以簡化開發流程,確保有效率地建立高品質的 Word 文件。
透過 IronWord 教學探索文件元素。using IronWord;
using IronWord.Models;
using System.Linq;
WordDocument docx = new WordDocument("Table.docx");
// Log object tree of the whole document
docx.LogObjectTree();
// Log object tree of table 0
docx.Children.OfType<Table>().First().LogObjectTree();
Imports IronWord
Imports IronWord.Models
Imports System.Linq
Dim docx As New WordDocument("Table.docx")
' Log object tree of the whole document
docx.LogObjectTree()
' Log object tree of table 0
docx.Children.OfType(Of Table)().First().LogObjectTree()Imports IronWord
Imports IronWord.Models
Imports System.Linq
Dim docx As New WordDocument("Table.docx")
' Log object tree of the whole document
docx.LogObjectTree()
' Log object tree of table 0
docx.Children.OfType(Of Table)().First().LogObjectTree()