設(shè)置 Word 項(xiàng)目符號(hào)樣式
Spire.Doc for .NET是一款專(zhuān)門(mén)對(duì) Word 文檔進(jìn)行操作的 .NET 類(lèi)庫(kù)。在于幫助開(kāi)發(fā)人員無(wú)需安裝 Microsoft Word情況下,輕松快捷高效地創(chuàng)建、編輯、轉(zhuǎn)換和打印 Microsoft Word 文檔。擁有近10年專(zhuān)業(yè)開(kāi)發(fā)經(jīng)驗(yàn)Spire系列辦公文檔開(kāi)發(fā)工具,專(zhuān)注于創(chuàng)建、編輯、轉(zhuǎn)換和打印Word/PDF/Excel等格式文件處理,小巧便捷。
E-iceblue 功能類(lèi)庫(kù)Spire 系列文檔處理組件均由中國(guó)本土團(tuán)隊(duì)研發(fā),不依賴(lài)第三方軟件,不受其他國(guó)家的技術(shù)或法律法規(guī)限制,同時(shí)適配國(guó)產(chǎn)操作系統(tǒng)如中科方德、中標(biāo)麒麟等,兼容國(guó)產(chǎn)文檔處理軟件 WPS(如 .wps/.et/.dps 等格式
Spire.Doc for.NET 最新下載
Word Bullet 可以將多個(gè)段落格式化為列表。它可以用項(xiàng)目符號(hào)強(qiáng)調(diào)段落并吸引讀者的注意力。使用項(xiàng)目符號(hào),列出的段落將自動(dòng)縮進(jìn)符號(hào),可以是點(diǎn)、數(shù)字或其他自定義符號(hào)(如小星、三角形、箭頭等)。
加載文檔后,獲取要設(shè)置項(xiàng)目符號(hào)樣式的段落,然后調(diào)用 p.ListFormat.ApplyBulletStyle() 方法進(jìn)行格式化。此外,您可以設(shè)置當(dāng)前列表的 NumberPosition 屬性以獲取項(xiàng)目符號(hào)和段落內(nèi)容之間的間距。下載并安裝 Spire.Doc for .NET。然后使用以下代碼設(shè)置 Word 項(xiàng)目符號(hào)樣式。
[C#]
using Spire.Doc; using Spire.Doc.Documents; namespace WordBullets { class Program { static void Main(string[] args) { //Load Document Document doc = new Document(); doc.LoadFromFile(@"E:\References.docx"); //Set Bullet Style Section s = doc.Sections[0]; for (int i = 1; i< s.Paragraphs.Count; i++) { Paragraph p = s.Paragraphs[i]; p.ListFormat.ApplyBulletStyle(); p.ListFormat.CurrentListLevel.NumberPosition = -10; } //Save and Launch doc.SaveToFile("sample.docx", FileFormat.Docx); System.Diagnostics.Process.Start("sample.docx"); } } }
[VB.NET]
Imports Spire.Doc Imports Spire.Doc.Documents Namespace WordBullets Friend Class Program Shared Sub Main(ByVal args() As String) 'Load Document Dim doc As New Document() doc.LoadFromFile("E:\References.docx") 'Set Bullet Style Dim s As Section = doc.Sections(0) For i As Integer = 1 To s.Paragraphs.Count - 1 Dim p As Paragraph = s.Paragraphs(i) p.ListFormat.ApplyBulletStyle() p.ListFormat.CurrentListLevel.NumberPosition = -10 Next i 'Save and Launch doc.SaveToFile("sample.docx", FileFormat.Docx) System.Diagnostics.Process.Start("sample.docx") End Sub End Class End Namespace
Spire.Doc 是一個(gè)獨(dú)立的組件,使開(kāi)發(fā)人員/程序員能夠在 WPF、.NET 和 Silverlight 中生成、打開(kāi)、編寫(xiě)、編輯和保存 Word 文檔,而無(wú)需在系統(tǒng)上安裝 Microsoft Word。
歡迎下載|體驗(yàn)更多E-iceblue產(chǎn)品
獲取更多信息請(qǐng)咨詢(xún) ;技術(shù)交流Q群(767755948)