文檔半島外圍網上直營>>E-iceblue中文文檔>>將 ASCII 字符設置為 Word 中的項目符號
                將 ASCII 字符設置為 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 最新下載
技術交流Q群(767755948)
本文向您展示了如何使用 Spire.Doc 與 C# 和 VB.NET 將 ASCII 字符(特殊符號)設置為 Word 文檔中的項目符號。
[C#]
using Spire.Doc;
using Spire.Doc.Documents;
namespace SetBulletCharacter
{
class Program
{
static void Main(string[] args)
{
//Create a Document object and add a section
Document doc = new Document();
Section section = doc.AddSection();
//Create four list styles based on different ASCII characters
ListStyle listStyle1 = new ListStyle(doc, ListType.Bulleted);
listStyle1.Name = "liststyle";
listStyle1.Levels[0].BulletCharacter = "\x006e";
listStyle1.Levels[0].CharacterFormat.FontName = "Wingdings";
doc.ListStyles.Add(listStyle1);
ListStyle listStyle2 = new ListStyle(doc, ListType.Bulleted);
listStyle2.Name = "liststyle2";
listStyle2.Levels[0].BulletCharacter = "\x0075";
listStyle2.Levels[0].CharacterFormat.FontName = "Wingdings";
doc.ListStyles.Add(listStyle2);
ListStyle listStyle3 = new ListStyle(doc, ListType.Bulleted);
listStyle3.Name = "liststyle3";
listStyle3.Levels[0].BulletCharacter = "\x00b2";
listStyle3.Levels[0].CharacterFormat.FontName = "Wingdings";
doc.ListStyles.Add(listStyle3);
ListStyle listStyle4 = new ListStyle(doc, ListType.Bulleted);
listStyle4.Name = "liststyle4";
listStyle4.Levels[0].BulletCharacter = "\x00d8";
listStyle4.Levels[0].CharacterFormat.FontName = "Wingdings";
doc.ListStyles.Add(listStyle4);
//Add four paragraphs and apply list style separately
Paragraph p1 = section.Body.AddParagraph();
p1.AppendText("Spire.Doc for .NET");
p1.ListFormat.ApplyStyle(listStyle1.Name);
Paragraph p2 = section.Body.AddParagraph();
p2.AppendText("Spire.PDF for .NET");
p2.ListFormat.ApplyStyle(listStyle2.Name);
Paragraph p3 = section.Body.AddParagraph();
p3.AppendText("Spire.XLS for .NET");
p3.ListFormat.ApplyStyle(listStyle3.Name);
Paragraph p4 = section.Body.AddParagraph();
p4.AppendText("Spire.Presentation for .NET");
p4.ListFormat.ApplyStyle(listStyle4.Name);
//Save to file
doc.SaveToFile("output.docx", FileFormat.Docx2013);
}
}
}
[VB.NET]
Imports Spire.Doc
Imports Spire.Doc.Documents
Namespace SetBulletCharacter
Class Program
Shared Sub Main(ByVal args() As String)
'Create a Document object and add a section
Document doc = New Document()
Dim section As Section = doc.AddSection()
'Create four list styles based on different ASCII characters
Dim listStyle1 As ListStyle = New ListStyle(doc, ListType.Bulleted)
listStyle1.Name = "liststyle"
listStyle1.Levels(0).BulletCharacter = "\x006e"
listStyle1.Levels(0).CharacterFormat.FontName = "Wingdings"
doc.ListStyles.Add(listStyle1)
Dim listStyle2 As ListStyle = New ListStyle(doc, ListType.Bulleted)
listStyle2.Name = "liststyle2"
listStyle2.Levels(0).BulletCharacter = "\x0075"
listStyle2.Levels(0).CharacterFormat.FontName = "Wingdings"
doc.ListStyles.Add(listStyle2)
Dim listStyle3 As ListStyle = New ListStyle(doc, ListType.Bulleted)
listStyle3.Name = "liststyle3"
listStyle3.Levels(0).BulletCharacter = "\x00b2"
listStyle3.Levels(0).CharacterFormat.FontName = "Wingdings"
doc.ListStyles.Add(listStyle3)
Dim listStyle4 As ListStyle = New ListStyle(doc, ListType.Bulleted)
listStyle4.Name = "liststyle4"
listStyle4.Levels(0).BulletCharacter = "\x00d8"
listStyle4.Levels(0).CharacterFormat.FontName = "Wingdings"
doc.ListStyles.Add(listStyle4)
'Add four paragraphs and apply list style separately
Dim p1 As Paragraph = section.Body.AddParagraph()
p1.AppendText("Spire.Doc for .NET")
p1.ListFormat.ApplyStyle(listStyle1.Name)
Dim p2 As Paragraph = section.Body.AddParagraph()
p2.AppendText("Spire.PDF for .NET")
p2.ListFormat.ApplyStyle(listStyle2.Name)
Dim p3 As Paragraph = section.Body.AddParagraph()
p3.AppendText("Spire.XLS for .NET")
p3.ListFormat.ApplyStyle(listStyle3.Name)
Dim p4 As Paragraph = section.Body.AddParagraph()
p4.AppendText("Spire.Presentation for .NET")
p4.ListFormat.ApplyStyle(listStyle4.Name)
'Save to file
doc.SaveToFile("output.docx", FileFormat.Docx2013)
End Sub
End Class
End Namespace
	 
 
歡迎下載|體驗更多E-iceblue產品

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