設置 Word 項目符號樣式
Spire.Doc for .NET是一款專門對 Word 文檔進行操作的 .NET 類庫。在于幫助開發人員無需安裝 Microsoft Word情況下,輕松快捷高效地創建、編輯、轉換和打印 Microsoft Word 文檔。擁有近10年專業開發經驗Spire系列辦公文檔開發工具,專注于創建、編輯、轉換和打印Word/PDF/Excel等格式文件處理,小巧便捷。
E-iceblue 功能類庫Spire 系列文檔處理組件均由中國本土團隊研發,不依賴第三方軟件,不受其他國家的技術或法律法規限制,同時適配國產操作系統如中科方德、中標麒麟等,兼容國產文檔處理軟件 WPS(如 .wps/.et/.dps 等格式
Spire.Doc for.NET 最新下載
Word Bullet 可以將多個段落格式化為列表。它可以用項目符號強調段落并吸引讀者的注意力。使用項目符號,列出的段落將自動縮進符號,可以是點、數字或其他自定義符號(如小星、三角形、箭頭等)。
加載文檔后,獲取要設置項目符號樣式的段落,然后調用 p.ListFormat.ApplyBulletStyle() 方法進行格式化。此外,您可以設置當前列表的 NumberPosition 屬性以獲取項目符號和段落內容之間的間距。下載并安裝 Spire.Doc for .NET。然后使用以下代碼設置 Word 項目符號樣式。
	 
 
[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 是一個獨立的組件,使開發人員/程序員能夠在 WPF、.NET 和 Silverlight 中生成、打開、編寫、編輯和保存 Word 文檔,而無需在系統上安裝 Microsoft Word。
歡迎下載|體驗更多E-iceblue產品
獲取更多信息請咨詢 ;技術交流Q群(767755948)


 QQ交談
QQ交談 在線咨詢
在線咨詢 
                 
                
 渝公網安備
            50010702500608號
渝公網安備
            50010702500608號
             
            
 客服熱線
客服熱線