zl程序教程

您现在的位置是:首页 >  其他

当前栏目

开源项目 03 DocX

项目开源 03 docx
2023-09-11 14:22:27 时间

 

 

using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using System.Threading.Tasks;
using HtmlAgilityPack;
using Xceed.Words.NET;

namespace ConsoleApp2.test1
{
    public class Class3
    {
        //原文:https://github.com/xceedsoftware/docx
        //Word文档转换为PDF 需要付费版 Xceed Words for .NET


        public void test1()
        {            
            using (DocX document = DocX.Create(@"HelloWorld.docx"))
            {
                Paragraph p = document.InsertParagraph();

                p.Append("Hello World!^011Hello World!赵杰迪")
                .Font(new Font("Times New Roman"))
                .FontSize(32)
                .Bold();

                document.Save();
                Console.WriteLine("\tCreated: docs\\HelloWorld.docx\n");
            }
        }
    }
}