Spire.Presentation is a professional PowerPoint® compatible library that enables developers to create, read, write, modify, convert and Print PowerPoint documents. Get free and professional technical support for Spire.Presentation for .NET, Java, Android, C++, Python.

Tue Jul 25, 2023 9:24 am

支持富文本吗

yabozhao
 
Posts: 26
Joined: Sat Jul 22, 2023 1:44 am

Tue Jul 25, 2023 10:12 am

您好,

感谢您的留言。
请问您所谓的富文本是指html格式的富文本,如果是,Spire.Doc for net是支持的哈,具体可以参考下面的代码 (将html代码放入txt文档中,然后读取到字符串中):
Code: Select all
//Get html string.
            String HTML = File.ReadAllText(@"..\..\..\..\..\..\..\Data\InputHtml.txt");

            //Create a new document.
            Document document = new Document();

            //Add a section.
            Section sec = document.AddSection();

            //Add a paragraph and append html string.
            sec.AddParagraph().AppendHTML(HTML);

            //Save it to a Word file.
            document.SaveToFile("HtmlFileToWord.docx", FileFormat.Docx);


Sincerely
Abel
E-iceblue support team
User avatar

Abel.He
 
Posts: 1010
Joined: Tue Mar 08, 2022 2:02 am

Return to Spire.Presentation

cron