Spire.Doc 9.4.12已发布。本次更新增强了转换Word到PDF的功能,同时还修复了提取文本等时出现的问题。详情请阅读以下内容。
问题修复:
本文介绍如何使用Spire.Doc 将ASCII字符(特殊符号)设置为Word文档中的列表符号。
//创建Document对象并添加一个section
Document doc = new Document();
Section section = doc.AddSection();
//根据不同的ASCII编码创建四个列表样式
ListStyle listStyle1 = doc.Styles.Add(ListType.Bulleted, "liststyle");
ListLevelCollection Levels1 = listStyle1.ListRef.Levels;
Levels1[0].BulletCharacter = "\x006e";
Levels1[0].CharacterFormat.FontName = "Wingdings";
ListStyle listStyle2 = doc.Styles.Add(ListType.Bulleted, "liststyle2");
ListLevelCollection Levels2 = listStyle2.ListRef.Levels;
Levels2[0].BulletCharacter = "\x0075";
Levels2[0].CharacterFormat.FontName = "Wingdings";
ListStyle listStyle3 = doc.Styles.Add(ListType.Bulleted, "liststyle2");
ListLevelCollection Levels3 = listStyle3.ListRef.Levels;
Levels3[0].BulletCharacter = "\x00b2";
Levels3[0].CharacterFormat.FontName = "Wingdings";
ListStyle listStyle4 = doc.Styles.Add(ListType.Bulleted, "liststyle2");
ListLevelCollection Levels4 = listStyle4.ListRef.Levels;
Levels4[0].BulletCharacter = "\x00d8";
Levels4[0].CharacterFormat.FontName = "Wingdings";
//添加四个段落并分别应用列表样式
Paragraph p1 = section.Body.AddParagraph();
p1.AppendText("Spire.Doc for .NET");
p1.ListFormat.ApplyStyle(listStyle1);
Paragraph p2 = section.Body.AddParagraph();
p2.AppendText("Spire.PDF for .NET");
p2.ListFormat.ApplyStyle(listStyle2);
Paragraph p3 = section.Body.AddParagraph();
p3.AppendText("Spire.XLS for .NET");
p3.ListFormat.ApplyStyle(listStyle3);
Paragraph p4 = section.Body.AddParagraph();
p4.AppendText("Spire.Presentation for .NET");
p4.ListFormat.ApplyStyle(listStyle4);
//保存文档
doc.SaveToFile("output.docx", FileFormat.Docx2013);
'创建Document对象并添加一个section
Dim doc As New Document()
Dim section As Section = doc.AddSection()
'根据不同的ASCII编码创建四个列表样式
Dim listStyle1 As ListStyle = doc.Styles.Add(ListType.Bulleted, "liststyle")
Dim Levels1 As ListLevelCollection = listStyle1.ListRef.Levels
Levels1(0).BulletCharacter = ChrW(&H006e).ToString()
Levels1(0).CharacterFormat.FontName = "Wingdings"
Dim listStyle2 As ListStyle = doc.Styles.Add(ListType.Bulleted, "liststyle2")
Dim Levels2 As ListLevelCollection = listStyle2.ListRef.Levels
Levels2(0).BulletCharacter = ChrW(&H0075).ToString()
Levels2(0).CharacterFormat.FontName = "Wingdings"
Dim listStyle3 As ListStyle = doc.Styles.Add(ListType.Bulleted, "liststyle2")
Dim Levels3 As ListLevelCollection = listStyle3.ListRef.Levels
Levels3(0).BulletCharacter = ChrW(&H00b2).ToString()
Levels3(0).CharacterFormat.FontName = "Wingdings"
Dim listStyle4 As ListStyle = doc.Styles.Add(ListType.Bulleted, "liststyle2")
Dim Levels4 As ListLevelCollection = listStyle4.ListRef.Levels
Levels4(0).BulletCharacter = ChrW(&H00d8).ToString()
Levels4(0).CharacterFormat.FontName = "Wingdings"
'添加四个段落并分别应用列表样式
Dim p1 As Paragraph = section.Body.AddParagraph()
p1.AppendText("Spire.Doc for .NET")
p1.ListFormat.ApplyStyle(listStyle1)
Dim p2 As Paragraph = section.Body.AddParagraph()
p2.AppendText("Spire.PDF for .NET")
p2.ListFormat.ApplyStyle(listStyle2)
Dim p3 As Paragraph = section.Body.AddParagraph()
p3.AppendText("Spire.XLS for .NET")
p3.ListFormat.ApplyStyle(listStyle3)
Dim p4 As Paragraph = section.Body.AddParagraph()
p4.AppendText("Spire.Presentation for .NET")
p4.ListFormat.ApplyStyle(listStyle4)
'保存文档
doc.SaveToFile("output.docx", FileFormat.Docx2013)

经常有客户反馈,在Windows系统中,使用Spire.Doc for Java 将Word文档保存为PDF格式时,结果文档正常,但是在Linux系统中,会发现PDF文档全是乱码或方框。
这个问题是由于Linux服务器缺少字体所导致。我们的产品转换Word到PDF需要从系统中找对应的字体绘制字形,如果系统中没有安装文档使用的字体,那么会先从系统安装了的字体匹配出能支持这个字形的字体,如果无法匹配出相应的字体,那么就会出现乱码或方框。若您遇到了这类问题,建议您先确认Word文档中使用了哪些字体,将这些字体安装到您的Linux系统后,问题会得到解决。
如何查看和安装字体的详细指令。
1、开启 root 权限
输入指令: su root 不行时,需要先输入指令: sudo passwd root
根据步骤输入密码,然后再重新输入指令: su root
2、将字体文件先放到某一个文件夹下
然后进入文件夹输入指令: cp simsun.ttc /usr/share/fonts/ ,依次输入下面的指令:
mkfontscale //字体扩展
mkfontdir //新增字体目录
fc-cache-fv //刷新缓存
3、查看安装的字体文件
查看系统中的字体:
指令:fc-list
查看系统中的中文字体:
指令:fc-list:lang=zh
如果按照上述步骤安装字体后,问题依然存在,请及时联系我们。该Email地址已收到反垃圾邮件插件保护。要显示它您需要在浏览器中启用JavaScript。 或致电 028-81705109。
本文介绍使用Spire.Doc for Java来获取Word中设置的标题内容。如果文档的目录选项中将“有效样式”和“目录级别”进行了相应设置(如下图),则获取标题的方法也可以用作获取目录内容。

用于测试的Word文档如下图所示:

import com.spire.doc.*;
import com.spire.doc.documents.Paragraph;
import java.io.BufferedWriter;
import java.io.File;
import java.io.FileWriter;
import java.io.IOException;
public class GetTitle {
public static void main(String[] args)throws IOException {
//加载Word测试文档
Document doc = new Document();
doc.loadFromFile("https://cdn.e-iceblue.cn/input.docx");
//保存标题内容到.txt文档
File file = new File("GetTitle.txt");
if (file.exists())
{
file.delete();
}
file.createNewFile();
FileWriter fw = new FileWriter(file, true);
BufferedWriter bw = new BufferedWriter(fw);
//遍历section
for (int i = 0; i < doc.getSections().getCount(); i++)
{
Section section = doc.getSections().get(i);
//遍历Paragraph
for (int j = 0; j < section.getParagraphs().getCount(); j++)
{
Paragraph paragraph = section.getParagraphs().get(j);
//获取标题
if ( paragraph.getStyleName().matches("1"))//段落为“标题1”的内容
{
//获取段落标题内容
String text = paragraph.getText();
//写入文本到txt文档
bw.write("标题1: "+ text + "\r");
}
//获取标题
if ( paragraph.getStyleName().matches("2"))//段落为“标题2”的内容
{
//获取段落标题内容
String text = paragraph.getText();
//写入文本到txt文档
bw.write("标题2: " + text + "\r");
}
//获取标题
if ( paragraph.getStyleName().matches("3"))//段落为“标题3”的内容
{
//获取段落标题内容
String text = paragraph.getText();
//写入文本到txt文档
bw.write("标题3: " + text+"\r");
}
//获取标题
if ( paragraph.getStyleName().matches("4"))//段落为“标题4”的内容
{
//获取段落标题内容
String text = paragraph.getText();
//写入文本到txt文档
bw.write("标题4: " + text+"\r");
}
bw.write("\n");
}
}
bw.flush();
bw.close();
fw.close();
}
}
标题(目录)获取结果:

Spire.PDF 7.4.5已发布。该版本支持根据图片的位置删除图片,并新增设置Check Box Field的导出值的功能。此外,本次更新还增强了转换PDF到Word/Image/TIFF/Excel/PDF/A-3A等格式的功能,并且还修复了打印和合并PDF文档时出现的问题。详情请阅读以下内容。
新功能:
PdfDocument doc = new PdfDocument(input);
PdfPageBase page = doc.Pages[0];
PdfImageInfo[] images = page.ImagesInfo;
for (int i = 0; i < images.Length; i++)
{
if (images[i].Bounds.Contains(x, y))
//if (images[i].Bounds.IntersectsWith(new RectangleF(x, y, width, height)))
{
page.DeleteImage(images[i].Image);
}
}
PdfDocument pdf = new PdfDocument();
pdf.LoadFromFile(inputFile);
PdfPageBase page = pdf.Pages[0];
PdfFormWidget formWidget = pdf.Form as PdfFormWidget;
int count = 1;
foreach (PdfFieldWidget field in formWidget.FieldsWidget)
{
if (field is PdfCheckBoxWidgetFieldWidget)
{ PdfCheckBoxWidgetFieldWidget checkbox = field as PdfCheckBoxWidgetFieldWidget; checkbox.SetExportValue("True" + (count++)); }
}
pdf.SaveToFile(outputFile, FileFormat.PDF);
问题修复:
在开发团队的共同努力之下,冰蓝科技于今日正式推出了Spire.Presentation for Android via Java 2.4.0。该产品是一款专业的 Android PowerPoint 控件,用于在 Android 手机应用程序中建、读取、写入、转换和保存 PowerPoint 文档。以下是该产品的主要功能:
https://www.e-iceblue.cn/Introduce/presentation-for-android-via-java.html
OpenXML 是用于微软 Office 文件的一种基于 XML 的文件格式。OpenXML 使开发者们可以在不需要微软 Office 的情况下创建和编辑如 Word 等 Office 文档,因此在开发者中非常受欢迎。但当这些文档呈现给用户的时候,通常需要将其转换成 Word 文档,以便于用户阅读和编辑。这篇文章将介绍如何用 Spire.Doc for .NET 将 OpenXMl 文件转换为 Word 文档以及将 Word 文档转换为 OpenXMl 文件。
首先,您需要将 Spire.Doc for.NET 包含的 DLL 文件作为引用添加到您的 .NET 项目中。DLL 文件可以从此链接下载,也可以通过 NuGet 安装。
PM> Install-Package Spire.Doc 转换的详细操作步骤如下:
using Spire.Doc;
using System;
namespace DocExample
{
internal class Program
{
static void Main(string[] args)
{
//创建 Document 类的对象
Document document = new Document();
//从磁盘加载 OpenXML 文件
document.LoadFromFile(@"C:\示例\示例.xml", FileFormat.Xml);
//将 OpenXML 文件转换为 Word 文档并保存
document.SaveToFile("OpenXML转Word.docx", FileFormat.Docx2013);
}
}
}Imports System
Imports Spire.Doc
Module Program
Sub Main(args As String())
'创建 Document 类的对象
Dim document As New Document()
'从磁盘加载 OpenXML 文件
document.LoadFromFile("C:\示例\示例.xml", FileFormat.Xml)
'将 OpenXML 文件转换为 Word 文档并保存
document.SaveToFile("OpenXML转Word.docx", FileFormat.Docx2013)
End Sub
End Module
转换的详细操作步骤如下:
using Spire.Doc;
using System;
namespace DocExample
{
internal class Program
{
static void Main(string[] args)
{
//创建 Document 类的对象
Document document = new Document();
//从磁盘加载 Word 文档
document.LoadFromFile(@"C:\Samples\Sample.docx");
//将 Word 文档转换为 OpenXML 文件并保存
//将 WordXML 更改为 WordML 可转换为 ML 文件
document.SaveToFile("WordToOpenXMl.xml", FileFormat.WordXml);
}
}
}Imports System
Imports Spire.Doc
Module Program
Sub Main(args As String())
'创建 Document 类的对象
Dim document As New Document()
'从磁盘加载 Word 文档
document.LoadFromFile("https://cdn.e-iceblue.cn/C:\Samples\Sample.docx")
'将 Word 文档转换为 OpenXML 文件并保存
'将 WordXML 更改为 WordML 可转换为 ML 文件
document.SaveToFile("WordToOpenXML.xml", FileFormat.WordXml)
End Sub
End Module
如果您希望删除结果文档中的评估消息,或者摆脱功能限制,请该Email地址已收到反垃圾邮件插件保护。要显示它您需要在浏览器中启用JavaScript。获取有效期 30 天的临时许可证。
Spire.XLS 11.4.0已发布。该版本增强了转换Excel到PDF/图片的功能,并且修复了保存文档等时出现的问题。详情如下。
问题修复:
Spire.Presentation for Java 4.4.0已发布。该版本支持了表格的分布行和分布列的功能,同时还增强了转换PPT到PDF的功能。详情如下。
新功能:
ISlide slide = presentation.getSlides().get(0);
ITable table = (ITable) slide.getShapes().get(0);
table.distributeRows(0,3);
table.distributeColumns(0,2);
问题修复:
https://www.e-iceblue.cn/Downloads/Spire-Presentation-JAVA.html
Spire.Office 6.4.0已发布。本次更新带来了一些新的功能。比如:Spire.Doc 在转换 Word 到 PDF 时支持了 EQField;Spire.PDFViewer支持设置缩略图的页码颜色。同时,本次更新还修复了大量的问题。详情请阅读以下内容。
该版本涵盖了最新版的Spire.Doc, Spire.PDF, Spire.XLS, Spire.Presentation, Spire.Email, Spire.DocViewer, Spire.PDFViewer, Spire.Spreadsheet, Spire.OfficeViewer, Spire.DataExport, Spire.Barcode。
版本信息如下:
https://www.e-iceblue.cn/Downloads/Spire-Office-NET.html
新功能:
问题修复:
问题修复:
新功能:
this.pdfDocumentThumbnail1.PageLabelColor = Color.Green;
this.pdfDocumentThumbnail1.PageLabelSelectedColor = Color.Yellow;
问题修复:
问题修复: