冰蓝科技
|
028-81705109
|
|
微信扫一扫
|

Spire.Cloud 纯前端文档控件

Spire.Office for Java 7.5.4 已发布。本次更新包含一些 新功能,如: Spire.Doc for Java 支持为Word文件段落设置“如果定义了文档网格,则对齐到网格”; Spire.Presentation for Java 支持为图表边框设置圆角,设置 SeriesLines 的颜色以及按系列设置图表动画效果。此外,该版本还修复了一些已知问题。详情请阅读以下内容。

获取Spire.Office for Java 7.5.4请点击:

https://www.e-iceblue.cn/Downloads/Spire-Office-JAVA.html


Spire.Doc for Java

新功能:

问题修复:


Spire.XLS for Java

问题修复:


Spire.Presentation for Java

新功能:

问题修复:


Spire.PDF for Java

问题修复:

Spire.Office 7.5.4 已发布。在该版本中, Spire.Doc 增强了 Word 到 PDF 和 HTML 到 Word 的转换; Spire.XLS 提供 IPrstGeomShape 类的文本居中对齐样式以及 InsertArray 方法的重载,以支持在将数组插入Excel文档时设置是否将日期字符串自动转换为datetime格式; Spire.Presentation 添加了获取单个幻灯片文本内容的方法 slide.GetAllTextFrame(),还支持了设置包含文本域内容的图表数据标签; Spire.PDF 支持OFD转换为PDF时,以对象流的形式输出。同时,该版本还修复了大量已知问题。详情请阅以下内容。

该版本涵盖了最新版的Spire.Doc,Spire.PDF,Spire.XLS,Spire.Email,Spire.DocViewer, Spire.PDFViewer,Spire.Presentation,Spire.Spreadsheet, Spire.OfficeViewer, Spire.DocViewer, Spire.Barcode, Spire.DataExport。

版本信息如下:

获取Spire.Office 7.5.4请点击:

https://www.e-iceblue.cn/Downloads/Spire-Office-NET.html


Spire.Doc

问题修复:


Spire.XLS

新功能:

问题修复:


Spire.Presentation

新功能:

问题修复:


Spire.PDF

新功能:

问题修复:


Spire.Email

问题修复:


Spire.OfficeViewer

问题修复:


Spire.DocViewer

问题修复:

Spire.Presentation 7.5.3已发布。该版本增加了GetAllTextFrame方法来获取幻灯片的文本内容。并且支持设置包含文本域内容的图表数据标签。此外,该版本还修复了转换PPT到PDF时文本框中文本位置不正确等已知问题。详情请阅读以下内容。

新功能:

问题修复:


获取Spire.Presentation 7.5.3请点击:

https://www.e-iceblue.cn/Downloads/Spire-Presentation-NET.html

Spire.Doc for Java 10.5.10已发布。该版本支持为word文件段落设置“如果定义了文档网格,则对齐到网格”,并且增强了Word到PDF的转换功能,此外还修复了获取的页码不正确等已知问题。详情请阅读以下内容。

新功能:

问题修复:


获取Spire.Doc for Java 10.5.10请点击:

https://www.e-iceblue.cn/Downloads/Spire-Doc-JAVA.html

Spire.PDF for Java 8.5.8 已发布。此版本增强了 PDF 到 Excel 、 Word 、 PDF/A 、 PDFA1B ,以及 OFD 到 PDF 的转换。同时,此版本还修复了合并单元格时行高值变小等已知问题。详情请阅读以下内容。

问题修复:


获取Spire.PDF for Java 8.5.8请点击:

https://www.e-iceblue.cn/Downloads/Spire-PDF-JAVA.html

Spire.XLS 12.5.3已发布。本次更新提供了InsertArray方法的重载,该重载方法支持在将数组插入Excel文档时设置是否将日期字符串自动转换为datetime格式。此外,还该版本增强了Excel到PDF的转换功能并且修复了加载XML,程序抛“Invalid file format”等已知问题。详情请阅读以下内容。

新功能:

问题修复:


下载Spire.XLS 12.5.3请点击:

https://www.e-iceblue.cn/Downloads/Spire-XLS-NET.html

C#实现HTML转Word和Word转HTML

Word 和 HTML是广泛使用的两种文件格式。Word 提供了多种格式化和排版功能,适用于创建结构化的文档,如报告、合同、信函等专业文件。而 HTML 则是构建网页内容的标准语言,定义了网页的结构和样式。掌握这两种格式之间的转换方法,不仅能提升文档的可用性,还能增强其在不同平台上的可访问性。

本教程将详细介绍如何使用 C# 在 .NET 中实现 HTML 到 Word 以及 Word 到 HTML 的转换。主要内容包括:

为什么要在 Word 和 HTML 之间相互转换?

在 Word 和 HTML 之间相互转换的需求通常源于不同的使用场景和需求,以下是一些常见的原因:

  • 网页发布:将 Word 文档(如报告、文章、产品说明)转换为 HTML,便于发布到网站或博客。
  • 跨平台兼容性:HTML 可以在几乎所有的浏览器或设备上查看,而 Word 文件需要特定软件(如 Microsoft Word)。
  • 离线编辑与协作:将网页内容(如在线文章、表格)转为 Word 文档,方便团队修改或批注。

安装.NET Word文档处理库

由于.NET 框架本身不支持 Word 或 HTML 文档的操作和转换,开发者需要借助第三方库来实现高效的文档处理。Spire.Doc for .NET 提供了一套功能强大且易于集成的 API,支持 Word 文档的创建、编辑和格式转换,同时无需依赖 Microsoft Office 或 Interop 库。

安装 Spire.Doc for .NET

在开始文档转换之前,您可以通过以下任一方式安装 Spire.Doc for .NET:

方法 1:通过 NuGet 安装(推荐)

  • 打开 Visual Studio 项目。
  • 在 NuGet 包管理器控制台中执行以下命令:
Install-Package Spire.Doc

方法 2:手动引用 DLL

  • 下载Spire.Doc for .NET
  • 解压产品包,找到 Spire.Doc.dll 文件。
  • 在 Visual Studio 项目中,右键 引用添加引用浏览,选择该 DLL 文件并完成引用。

如何使用 C# 将 HTML 转换为 Word

Spire.Doc 支持加载 HTML 文件或 HTML 字符串并将其转换为 Word 文档格式。下面将展示每种转换的具体实现步骤和示例代码。

将 HTML 字符串转换为 Word

将 HTML 字符串转换为 Word 格式的实现步骤如下:

  • 创建Document对象:实例化 Document 类的对象。
  • 添加节和段落:给文档添加一个节和一个段落。
  • 添加 HTML 字符串:使用 Paragraph.AppendHTML() 方法将 HTML 字符串添加到段落。
  • 保存文档:使用 Document.SaveToFile() 保存文档,并指定所需格式(例如 Docx)。

示例代码

using Spire.Doc;
using Spire.Doc.Documents;
using System.IO;

namespace ConvertHtmlStringToWord
{
    class Program
    {
        static void Main(string[] args)
        {
            // 创建Document对象
            Document document = new Document();
            // 添加节
            Section section = document.AddSection();
            // 设置页面边距
            section.PageSetup.Margins.All = 2;

            // 添加段落
            Paragraph paragraph = section.AddParagraph();
            // 从文件读取 HTML 字符串
            string htmlFilePath = @"C:\Users\Administrator\Desktop\Html.html";
            string htmlString = File.ReadAllText(htmlFilePath, System.Text.Encoding.UTF8);
            // 添加 HTML 字符串
            paragraph.AppendHTML(htmlString);

            // 保存文档为 Word 文件
            document.SaveToFile("添加Html字符串.docx", FileFormat.Docx);
            // 释放资源
            document.Dispose();
        }
    }
}

将 HTML 文件转换为 Word

将现有HTML文件转换为 Word的过程非常简单,步骤如下:

  • 创建Document对象:实例化 Document 类的对象。
  • 加载 HTML 文件:使用 Document.LoadFromFile() 加载 HTML 文件。
  • 保存为 Word 格式:使用 Document.SaveToFile() 保存文档,并指定所需格式(例如 Docx)。

示例代码

using Spire.Doc;

namespace ConvertHtmlToWord
{
    class Program
    {
        static void Main(string[] args)
        {
            // 创建Document对象
            Document document = new Document();
            // 加载 HTML 文件
            document.LoadFromFile(@"C:\Users\Administrator\Desktop\MyHtml.html", FileFormat.Html);

            // 保存为 Word 文档
            document.SaveToFile("Html转Word.docx", FileFormat.Docx);
            // 释放资源
            document.Dispose();
        }
    }
}

如何使用 C# 将 Word 转换为 HTML

Spire.Doc 也支持将 Word 文档导出为 HTML 格式。你可以采用默认设置进行标准转换,也可以通过高级参数设置实现定制化转换。

Word 到 HTML 标准转换

实现Word到HTML标准转换的步骤如下:

  • 创建文档对象:实例化 Document 类的对象。
  • 加载 Word 文档:使用 Document.LoadFromFile() 加载 Word 文档。
  • 保存为 HTML 文件:使用 Document.SaveToFile() 保存文档,并指定 HTML 格式。

示例代码

using Spire.Doc;

namespace WordToHtmlConversion
{
    class Program
    {
        static void Main(string[] args)
        {
            // 创建Document对象
            Document document = new Document();
            // 加载 Word 文档
            document.LoadFromFile("示例.docx");

            // 保存为 HTML 文件
            document.SaveToFile("Word到Html标准转换.html", FileFormat.Html);
            // 释放资源
            document.Dispose();
        }
    }
}

Word 到 HTML 自定义设置

Spire.Doc提供了 HtmlExportOptions 类,支持自定义Word到HTML转换。该类支持调整多种转换设置,包括:

  • 是否导出文档样式。
  • 是否将图片嵌入转换后的 HTML 中。
  • 是否导出页眉和页脚。
  • 是否将表单字段作为纯文本导出。

实现Word到HTML定制化转换的步骤如下:

  • 创建Document对象:实例化 Document 类的对象。
  • 加载 Word 文档:使用 Document.LoadFromFile() 加载 Word 文档。
  • 获取 HtmlExportOptions对象:通过 Document.HtmlExportOptions 获取HtmlExportOptions对象。
  • 自定义转换设置:修改 HtmlExportOptions 对象的属性来自定义转换设置。
  • 保存为 HTML 文件:使用 Document.SaveToFile() 保存文档,并指定 HTML 格式。

示例代码

using Spire.Doc;

namespace WordToHtmlConversion
{
    class Program
    {
        static void Main(string[] args)
        {
            // 创建Document对象
            Document doc = new Document();
            // 加载 Word 文档
            doc.LoadFromFile("示例.docx");

            HtmlExportOptions htmlExportOptions = doc.HtmlExportOptions;
            // 设置是否导出文档样式
            htmlExportOptions.IsExportDocumentStyles = true;
            // 设置是否将图片嵌入 HTML 中
            htmlExportOptions.ImageEmbedded = true;
            // 设置 CSS 样式表类型
            htmlExportOptions.CssStyleSheetType = CssStyleSheetType.Internal;
            // 设置是否导出页眉和页脚
            htmlExportOptions.HasHeadersFooters = true;
            // 设置是否将表单字段作为文本导出
            htmlExportOptions.IsTextInputFormFieldAsText = false;

            // 保存为 HTML 文件
            doc.SaveToFile("Word到HTML自定义转换.html", FileFormat.Html);
            doc.Close();
        }
    }
}

总结

综上所述,Word 和 HTML 各自拥有不同的应用场景与优势。使用 C# 和 Spire.Doc for .NET库,开发者不仅可以高效地实现HTML到Word的转换,还能轻松地将Word文档导出为HTML格式。如需了解更多C# Word文档处理功能,欢迎查阅Spire.Doc for .NET使用教程

常见问题解答

Q1: 是否可以批量将多个 Word 文件转换为 HTML?

A1: 是的,您可以通过C#代码循环遍历 Word 文件列表,并对每个文件应用转换逻辑。

Q2: 转换为 Word 时支持哪些类型的 HTML 元素?

A2: Spire.Doc 支持多种 HTML 元素,包括文本、表格、图像、列表等。然而,某些不被 Microsoft Word 支持的元素在 Spire.Doc 中可能无法正确渲染。因此,应避免使用Word不支持的HTML标签、层叠样式、 JavaScript 等元素。

Q3: 我可以转换其他格式吗?

A3: 可以。Spire.Doc 支持多种文件格式的转换,例如 Word 转 PDFMarkdown 转 WordWord 转 MarkdownRTF 转 WordRTF 转 PDF 等。

Q4: Spire.Doc 是免费使用的吗?

A4: Spire.Doc 提供了一个免费版本,适用于轻量级或个人项目使用;若需更丰富的功能或用于商业场景,建议选择功能更完善的商业版。

申请临时 License

如果您需要去除生成文档中的评估提示或解除功能限制,请该Email地址已收到反垃圾邮件插件保护。要显示它您需要在浏览器中启用JavaScript。获取有效期 30 天的临时许可证。

超链接通常出现在文本上,只需要点击这些超链接,我们就可以跳转到特定的网页、文档、邮箱地址或是其他元素。但有些文档中,尤其是复制网页内容生成的 Word 文档,可能会有一些令人讨厌的超链接,例如广告。本文将展示如何用 Spire.Doc for Java 移除 Word 文档中的超链接

安装 Spire.Doc for Java

首先,您需要在 Java 程序中添加 Spire.Doc.jar 文件作为依赖项。您可以从 这个链接 下载 JAR 文件;如果您使用 Maven,则可以通过在 pom.xml 文件中添加以下代码导入 JAR 文件。

<repositories>
    <repository>
        <id>com.e-iceblue</id>
        <name>e-iceblue</name>
        <url>https://repo.e-iceblue.cn/repository/maven-public/</url>
    </repository>
</repositories>
<dependencies>
    <dependency>
        <groupId>e-iceblue</groupId>
        <artifactId>spire.doc</artifactId>
        <version>13.12.2</version>
    </dependency>
</dependencies>

移除 Word 文档中的指定超链接

以下是实现移除 Word 文档中指定超链接的详细操作步骤:

  • Java
import com.spire.doc.*;
import com.spire.doc.documents.DocumentObjectType;
import com.spire.doc.documents.Paragraph;
import com.spire.doc.documents.UnderlineStyle;
import com.spire.doc.fields.Field;
import com.spire.doc.fields.TextRange;

import java.awt.*;
import java.util.ArrayList;

public class removeHyperlink {
    public static void main(String[] args) {
        //创建 Document 的对象,并从磁盘加载Word文档
        String input = "D:/testp/示例.docx";
        Document doc = new Document();
        doc.loadFromFile(input);

        //找到所有超链接
        ArrayList hyperlinks = FindAllHyperlinks(doc);

        //移除第一个超链接及格式
        FlattenHyperlinks(hyperlinks.get(0));

        //保存文档到文件
        String output = "D:/javaOutput/移除超链接.docx";
        doc.saveToFile(output, FileFormat.Docx);
    }

    //创建 FindAllHyperlinks() 方法来获取文档中所有超链接
    private static ArrayList FindAllHyperlinks(Document document)
    {
        ArrayList hyperlinks = new ArrayList();

        //在文档中循环查找所有超链接
        for (Section section : (Iterable<Section>)document.getSections())
        {
            for (DocumentObject object : (Iterable<DocumentObject>)section.getBody().getChildObjects())
            {
                if (object.getDocumentObjectType().equals(DocumentObjectType.Paragraph))
                {
                    Paragraph paragraph = (Paragraph) object;
                    for (DocumentObject cObject : (Iterable<DocumentObject>)paragraph.getChildObjects())
                    {
                        if (cObject.getDocumentObjectType().equals(DocumentObjectType.Field))
                        {
                            Field field = (Field) cObject;
                            if (field.getType().equals(FieldType.Field_Hyperlink))
                            {
                                hyperlinks.add(field);
                            }
                        }
                    }
                }
            }
        }
        return hyperlinks;
    }

    //创建 FlattenHyperlinks() 方法来移除超链接及格式
    public static void FlattenHyperlinks(Field field)
    {
        int ownerParaIndex = field.getOwnerParagraph().ownerTextBody().getChildObjects().indexOf(field.getOwnerParagraph());
        int fieldIndex = field.getOwnerParagraph().getChildObjects().indexOf(field);
        Paragraph sepOwnerPara = field.getSeparator().getOwnerParagraph();
        int sepOwnerParaIndex = field.getSeparator().getOwnerParagraph().ownerTextBody().getChildObjects().indexOf(field.getSeparator().getOwnerParagraph());
        int sepIndex = field.getSeparator().getOwnerParagraph().getChildObjects().indexOf(field.getSeparator());
        int endIndex = field.getEnd().getOwnerParagraph().getChildObjects().indexOf(field.getEnd());
        int endOwnerParaIndex = field.getEnd().getOwnerParagraph().ownerTextBody().getChildObjects().indexOf(field.getEnd().getOwnerParagraph());
        FormatFieldResultText(field.getSeparator().getOwnerParagraph().ownerTextBody(), sepOwnerParaIndex, endOwnerParaIndex, sepIndex, endIndex);
        field.getEnd().getOwnerParagraph().getChildObjects().removeAt(endIndex);
        for (int i = sepOwnerParaIndex; i >= ownerParaIndex; i--)
        {
            if (i == sepOwnerParaIndex && i == ownerParaIndex)
            {
                for (int j = sepIndex; j >= fieldIndex; j--)
                {
                    field.getOwnerParagraph().getChildObjects().removeAt(j);
                }
            }
            else if (i == ownerParaIndex)
            {
                for (int j = field.getOwnerParagraph().getChildObjects().getCount() - 1; j >= fieldIndex; j--)
                {
                    field.getOwnerParagraph().getChildObjects().removeAt(j);
                }
            }
            else if (i == sepOwnerParaIndex)
            {
                for (int j = sepIndex; j >= 0; j--)
                {
                    sepOwnerPara.getChildObjects().removeAt(j);
                }
            }
            else
            {
                field.getOwnerParagraph().ownerTextBody().getChildObjects().removeAt(i);
            }
        }
    }

    //创建 FormatFieldResultText() 方法来移除超链接的字体颜色和下划线格式
    private static void FormatFieldResultText(Body ownerBody, int sepOwnerParaIndex, int endOwnerParaIndex, int sepIndex, int endIndex)
    {
        for (int i = sepOwnerParaIndex; i <= endOwnerParaIndex; i++)
        {
            Paragraph para = (Paragraph) ownerBody.getChildObjects().get(i);
            if (i == sepOwnerParaIndex && i == endOwnerParaIndex)
            {
                for (int j = sepIndex + 1; j < endIndex; j++)
                {
                    FormatText((TextRange)para.getChildObjects().get(j));
                }
            }
            else if (i == sepOwnerParaIndex)
            {
                for (int j = sepIndex + 1; j < para.getChildObjects().getCount(); j++)
                {
                    FormatText((TextRange)para.getChildObjects().get(j));
                }
            }
            else if (i == endOwnerParaIndex)
            {
                for (int j = 0; j < endIndex; j++)
                {
                    FormatText((TextRange)para.getChildObjects().get(j));
                }
            }
            else
            {
                for (int j = 0; j < para.getChildObjects().getCount(); j++)
                {
                    FormatText((TextRange)para.getChildObjects().get(j));
                }
            }
        }
    }

    //创建 FormatText() 方法把字体颜色改为黑色并移除下划线
    private static void FormatText(TextRange tr)
    {
        //将字体设置为黑色
        tr.getCharacterFormat().setTextColor(Color.black);

        //将下划线设置为无下划线
        tr.getCharacterFormat().setUnderlineStyle(UnderlineStyle.None);
    }
}

Java 移除 Word 文档中的超链接

移除 Word 文档中的所有超链接

移除 Word 文档中所有超链接的详细操作步骤如下:

  • Java
import com.spire.doc.*;
import com.spire.doc.documents.DocumentObjectType;
import com.spire.doc.documents.Paragraph;
import com.spire.doc.documents.UnderlineStyle;
import com.spire.doc.fields.Field;
import com.spire.doc.fields.TextRange;

import java.awt.*;
import java.util.ArrayList;

public class removeHyperlink {
    public static void main(String[] args) {
        //创建 Document 的对象,并从磁盘加载Word文档
        String input = "D:/testp/示例.docx";
        Document doc = new Document();
        doc.loadFromFile(input);

        //找到所有超链接
        ArrayList hyperlinks = FindAllHyperlinks(doc);

        // 循环所有超链接,移除超链接及格式
        for (int i = hyperlinks.size() -1; i >= 0; i--)
        {
            FlattenHyperlinks(hyperlinks.get(i));
        }
        //保存文档到文件
        String output = "D:/javaOutput/移除超链接.docx";
        doc.saveToFile(output, FileFormat.Docx);
    }

    //创建 FindAllHyperlinks() 方法来获取文档中所有超链接
    private static ArrayList FindAllHyperlinks(Document document)
    {
        ArrayList hyperlinks = new ArrayList();

        //在文档中循环查找所有超链接
        for (Section section : (Iterable)document.getSections())
        {
            for (DocumentObject object : (Iterable)section.getBody().getChildObjects())
            {
                if (object.getDocumentObjectType().equals(DocumentObjectType.Paragraph))
                {
                    Paragraph paragraph = (Paragraph) object;
                    for (DocumentObject cObject : (Iterable)paragraph.getChildObjects())
                    {
                        if (cObject.getDocumentObjectType().equals(DocumentObjectType.Field))
                        {
                            Field field = (Field) cObject;
                            if (field.getType().equals(FieldType.Field_Hyperlink))
                            {
                                hyperlinks.add(field);
                            }
                        }
                    }
                }
            }
        }
        return hyperlinks;
    }

    //创建 FlattenHyperlinks() 方法来移除超链接及格式
    public static void FlattenHyperlinks(Field field)
    {
        int ownerParaIndex = field.getOwnerParagraph().ownerTextBody().getChildObjects().indexOf(field.getOwnerParagraph());
        int fieldIndex = field.getOwnerParagraph().getChildObjects().indexOf(field);
        Paragraph sepOwnerPara = field.getSeparator().getOwnerParagraph();
        int sepOwnerParaIndex = field.getSeparator().getOwnerParagraph().ownerTextBody().getChildObjects().indexOf(field.getSeparator().getOwnerParagraph());
        int sepIndex = field.getSeparator().getOwnerParagraph().getChildObjects().indexOf(field.getSeparator());
        int endIndex = field.getEnd().getOwnerParagraph().getChildObjects().indexOf(field.getEnd());
        int endOwnerParaIndex = field.getEnd().getOwnerParagraph().ownerTextBody().getChildObjects().indexOf(field.getEnd().getOwnerParagraph());
        FormatFieldResultText(field.getSeparator().getOwnerParagraph().ownerTextBody(), sepOwnerParaIndex, endOwnerParaIndex, sepIndex, endIndex);
        field.getEnd().getOwnerParagraph().getChildObjects().removeAt(endIndex);
        for (int i = sepOwnerParaIndex; i >= ownerParaIndex; i--)
        {
            if (i == sepOwnerParaIndex && i == ownerParaIndex)
            {
                for (int j = sepIndex; j >= fieldIndex; j--)
                {
                    field.getOwnerParagraph().getChildObjects().removeAt(j);
                }
            }
            else if (i == ownerParaIndex)
            {
                for (int j = field.getOwnerParagraph().getChildObjects().getCount() - 1; j >= fieldIndex; j--)
                {
                    field.getOwnerParagraph().getChildObjects().removeAt(j);
                }
            }
            else if (i == sepOwnerParaIndex)
            {
                for (int j = sepIndex; j >= 0; j--)
                {
                    sepOwnerPara.getChildObjects().removeAt(j);
                }
            }
            else
            {
                field.getOwnerParagraph().ownerTextBody().getChildObjects().removeAt(i);
            }
        }
    }

    //创建 FormatFieldResultText() 方法来移除超链接的字体颜色和下划线格式
    private static void FormatFieldResultText(Body ownerBody, int sepOwnerParaIndex, int endOwnerParaIndex, int sepIndex, int endIndex)
    {
        for (int i = sepOwnerParaIndex; i <= endOwnerParaIndex; i++)
        {
            Paragraph para = (Paragraph) ownerBody.getChildObjects().get(i);
            if (i == sepOwnerParaIndex && i == endOwnerParaIndex)
            {
                for (int j = sepIndex + 1; j < endIndex; j++)
                {
                    FormatText((TextRange)para.getChildObjects().get(j));
                }
            }
            else if (i == sepOwnerParaIndex)
            {
                for (int j = sepIndex + 1; j < para.getChildObjects().getCount(); j++)
                {
                    FormatText((TextRange)para.getChildObjects().get(j));
                }
            }
            else if (i == endOwnerParaIndex)
            {
                for (int j = 0; j < endIndex; j++)
                {
                    FormatText((TextRange)para.getChildObjects().get(j));
                }
            }
            else
            {
                for (int j = 0; j < para.getChildObjects().getCount(); j++)
                {
                    FormatText((TextRange)para.getChildObjects().get(j));
                }
            }
        }
    }

    //创建 FormatText() 方法把字体颜色改为黑色并移除下划线
    private static void FormatText(TextRange tr)
    {
        //将字体设置为黑色
        tr.getCharacterFormat().setTextColor(Color.black);

        //将下划线设置为无下划线
        tr.getCharacterFormat().setUnderlineStyle(UnderlineStyle.None);
    }
}

Java 移除 Word 文档中的超链接

申请临时 License

如果您希望删除结果文档中的评估消息,或者摆脱功能限制,请该Email地址已收到反垃圾邮件插件保护。要显示它您需要在浏览器中启用JavaScript。获取有效期 30 天的临时许可证。

Spire.DocViewer 7.5.0 已发布。本次更新修复了预览文档时,部分内容格式与原文档不一致的问题。详情请阅读以下内容。

问题修复:


获取Spire.DocViewer 7.5.0请点击:

https://www.e-iceblue.cn/Downloads/Spire-DocViewer-NET.html

Spire.OfficeViewer 7.5.0 已发布。本次更新修复了预览Word文档时页数增多的问题。详情请阅读以下内容。

问题修复:


获取Spire.OfficeViewer 7.5.0请点击:

https://www.e-iceblue.cn/Downloads/Spire-OfficeViewer-NET.html