spire.presentation for java 3.8.6于今日发布。该版本支持更新ppt文档中的video视频数据及获取audio和video的partname属性。同时,它也修复了一些ppt转pdf、获取/设置动画、保存文档时出现的问题。具体新功能及问题修复参见下文。
新功能:
file file = new file("videopath");
fileinputstream fileinputstream = new fileinputstream(file);
byte[] data = new byte[(int)file.length()];
fileinputstream.read(data);
videocollection videos = presentation.getvideos();
videodata videodata = videos.append(data);
ivideo ivideo = (ivideo) presentation.getslides().get(0).getshapes().get(0);
ivideo.setembeddedvideodata(videodata);
for (int i = 0; i < presentation.getslides().getcount(); i ) {
islide slide = presentation.getslides().get(i);
for (int j = 0; j < slide.getshapes().getcount(); j ) {
ishape shape = slide.getshapes().get(j);
if (shape instanceof iaudio) {
string audiopartname = ((iaudio) shape).getdata().getpartname();
}
if (shape instanceof ivideo) {
string videopartname = ((ivideo) shape).getembeddedvideodata().getpartname();
}
}
优化:
问题修复:
https://www.e-iceblue.cn/downloads/spire-presentation-java.html
]]>该文将介绍如何在.net应用程序中使用象征符号绘制复选框到word文档。
using spire.doc;
using spire.doc.documents;
using spire.doc.fields;
using system.drawing;
using system.collections.generic;
namespace checkbox
{
class program
{
static void main(string[] args)
{
//新建word实例,添加section,段落并插入文本
document doc = new document();
section sec = doc.addsection();
paragraph para = sec.addparagraph();
para.appendtext("指定字符替换成复选框, symbol1, symbol2, symbol3.");
//设置段落样式
paragraphstyle style = new paragraphstyle(doc);
style.name = "parastyle";
style.characterformat.fontname = "宋体";
style.characterformat.fontsize = 11;
doc.styles.add(style);
para.applystyle("parastyle");
//复选框打勾
textselection selection1 = doc.findstring("symbol1", true, true);
textrange tr1 = selection1.getasonerange();
tr1.characterformat.fontname = "wingdings 2";
//doc.replace(selection1.selectedtext, "\u0052", true, true);
//16进制复选框打勾是0052,10进制复选框打勾是82
doc.replace(selection1.selectedtext, ((char)82).tostring(), true, true);
//复选框打叉
textselection selection2 = doc.findstring("symbol2", true, true);
textrange tr2 = selection2.getasonerange();
tr2.characterformat.fontname = "wingdings 2";
//16进制复选框打叉是0053,10进制复选框打叉是83
doc.replace(selection2.selectedtext, "\u0053", true, true);
//复选框不勾选
textselection selection3 = doc.findstring("symbol3", true, true);
textrange tr3 = selection3.getasonerange();
tr3.characterformat.fontname="wingdings 2";
//16进制复选框不勾选是00a3,10进制是163
doc.replace(selection3.selectedtext, "\u00a3", true, true);
//保存文档
doc.savetofile("symboltest.docx",fileformat.docx2013);
}
}
}
imports spire.doc
imports spire.doc.documents
imports spire.doc.fields
imports system.drawing
imports system.collections.generic
namespace checkbox
class program
private shared sub main(byval args() as string)
dim doc as document = new document
dim sec as section = doc.addsection
dim para as paragraph = sec.addparagraph
para.appendtext("指定字符替换成复选框, symbol1, symbol2, symbol3.”),
paragraphstyle, style=newparagraphstyle(docunknown)
style.name = "parastyle"
style.characterformat.fontname = "宋体"
style.characterformat.fontsize = 11
doc.styles.add(style)
para.applystyle("parastyle")
'复选框打勾
dim selection1 as textselection = doc.findstring("symbol1", true, true)
dim tr1 as textrange = selection1.getasonerange
tr1.characterformat.fontname = "wingdings 2"
'16进制复选框打勾是0052,10进制复选框打勾是82
'doc.replace(selection1.selectedtext, "\u0052", true, true);
doc.replace(selection1.selectedtext, ctype(82,char).tostring, true, true)
'复选框打叉
dim selection2 as textselection = doc.findstring("symbol2", true, true)
dim tr2 as textrange = selection2.getasonerange
tr2.characterformat.fontname = "wingdings 2"
'16进制复选框打叉是0053,10进制复选框打叉是83
doc.replace(selection2.selectedtext, "\u0053", true, true)
'复选框不勾选
dim selection3 as textselection = doc.findstring("symbol3", true, true)
dim tr3 as textrange = selection3.getasonerange
tr3.characterformat.fontname = "wingdings 2"
'16进制复选框不勾选是00a3,10进制是163
doc.replace(selection3.selectedtext, "\u00a3", true, true)
'保存文档
doc.savetofile("symboltest.docx", fileformat.docx2013)
end sub
end class
end namespace
效果图:
]]>该文将介绍如何使用象征符号绘制复选框到word文档。
import com.spire.doc.*;
import com.spire.doc.documents.paragraph;
import com.spire.doc.documents.paragraphstyle;
import com.spire.doc.documents.textselection;
import com.spire.doc.fields.textrange;
public class drawcombox {
public static void main(string[] args) {
//新建word 文档
document doc = new document();
section section = doc.addsection();
paragraph para = section.addparagraph();
para.settext("指定字符替换成复选框 symbol1, symbol2, symbol3.");
//设置段落中字体样式
paragraphstyle style= new paragraphstyle(doc);
style.setname("parastyle");
style.getcharacterformat().setfontname("宋体");
style.getcharacterformat().setfontsize(11f);
doc.getstyles().add(style);
para.applystyle("parastyle");
//复选框打勾
textselection selection1 = doc.findstring("symbol1",true,true);
textrange tr1 = selection1.getasonerange();
tr1.getcharacterformat().setfontname("wingdings 2");
//除了16进制,也可以用10进制来表示这个符号,复选框打勾是82
doc.replace(selection1.getselectedtext(), "\u0052", true, true);
//doc.replace(selection1.getselectedtext(),string.valueof(((char)82)), true, true);
//复选框打叉
textselection selection2 = doc.findstring("symbol2",true,true);
textrange tr2 = selection2.getasonerange();
tr2.getcharacterformat().setfontname("wingdings 2");
//16进制复选框打叉是0053,10进制是83
doc.replace(selection2.getselectedtext(), "\u0053", true, true);
//复选框不勾选
textselection selection3 = doc.findstring("symbol3", true, true);
textrange tr3 = selection3.getasonerange();
tr3.getcharacterformat().setfontname("wingdings 2");
//16进制复选框不勾选是00a3,10进制是163
doc.replace(selection3.getselectedtext(), "\u00a3", true, true);
doc.savetofile("output/symboltest.docx",fileformat.docx_2013);
}
}
效果图:
]]>本文介绍如何使用spire.doc for java在word文档中添加上角标和下角标。
import com.spire.doc.document;
import com.spire.doc.fileformat;
import com.spire.doc.section;
import com.spire.doc.documents.breaktype;
import com.spire.doc.documents.paragraph;
import com.spire.doc.documents.subsuperscript;
import com.spire.doc.fields.textrange;
public class insertsupsubscript {
public static void main(string[] args) {
//创建document对象
document document = new document();
//添加节
section section = document.addsection();
//添加段落
paragraph paragraph = section.addparagraph();
//添加文字到段落
paragraph.appendtext("e = mc");
//添加文字并设置为上角标
textrange textrange = paragraph.appendtext("2");
textrange.getcharacterformat().setsubsuperscript(subsuperscript.super_script);
//添加换行
paragraph.appendbreak(breaktype.line_break);
//添加文字并设置部分文字为下角标
paragraph.appendtext("a");
paragraph.appendtext("n").getcharacterformat().setsubsuperscript(subsuperscript.sub_script);
paragraph.appendtext(" = s");
paragraph.appendtext("n").getcharacterformat().setsubsuperscript(subsuperscript.sub_script);
paragraph.appendtext(" - s");
paragraph.appendtext("n-1").getcharacterformat().setsubsuperscript(subsuperscript.sub_script);
//保存文档
document.savetofile("insertsubsuperscript.docx", fileformat.docx);
}
]]>本文将介绍如何使用spire.doc for .net比较两个word文档的内容差异。
以下是两个原word文档截图,红框标记部分是它们的内容差异:
using spire.doc;
namespace compareworddocuments
{
class program
{
static void main(string[] args)
{
//创建document实例
document doc1 = new document();
//加载第一个word文档
doc1.loadfromfile("doc1.docx");
//创建document实例
document doc2 = new document();
//加载第二个word文档
doc2.loadfromfile("doc2.docx");
//比较这两个文档的内容差异
doc1.compare(doc2, "shawn");
//保存结果文档
doc1.savetofile("result.docx");
doc1.dispose();
}
}
}
imports spire.doc
namespace compareworddocuments
class program
private shared sub main(byval args as string())
‘创建document实例
dim doc1 as document = new document()
‘加载第一个word文档
doc1.loadfromfile("doc1.docx")
‘创建document实例
dim doc2 as document = new document()
‘加载第二个word文档
doc2.loadfromfile("doc2.docx")
‘比较这两个文档的内容差异
doc1.compare(doc2, "shawn")
‘保存结果文档
doc1.savetofile("result.docx")
doc1.dispose()
end sub
end class
end namespace
比较结果:
]]>默认情况下,源数据的更改变动不会自动更新到透视表,需要在透视表上进行刷新才能显示最新数据变化。下面通过使用spire.xls for java来展示如何刷新透视表。
import com.spire.xls.*;
public class refreshpivottable {
public static void main(string[] args) {
//创建实例,加载excel
workbook wb = new workbook();
wb.loadfromfile("数据透视表.xlsx");
//获取第一个工作表
worksheet sheet = wb.getworksheets().get(0);
//更改透视表的数据源数据
sheet.getcellrange("c2:c4").settext("产品a");
sheet.getcellrange("c5:c7").settext("产品b");
sheet.getcellrange("c8:c10").settext("产品c");
//获取透视表,刷新数据
pivottable pivottable = (pivottable) sheet.getpivottables().get(0);
pivottable.getcache().isrefreshonload();
//保存文档
wb.savetofile("刷新透视表.xlsx",fileformat.version2013);
}
}
透视表更新前后效果:
]]>spire.office 5.8.5 已正式发布。该版本新增了一些功能,如spire.doc添加了比较功能、spire.presentation支持添加节和设置smartart节点的轮廓线样式、spire.pdf将pdf转换为excel时支持图表。此外,也修正了将word转换为pdf/ epub、excel转换为pdf、ppt转换为pdf、xps转换为pdf、更新excel数据透视表、合并pdf文档以及从pdf文件中提取文本时出现的一些问题。更多新功能及问题修复详情如下。
该版本涵盖了最新版的spire.doc、spire.pdf、spire.xls、spire.presentation、spire.dataexport、spire.barcode、spire.docviewer、spire.pdfviewer、spire.officeviewer、spire.email。
版本信息如下:
https://www.e-iceblue.cn/downloads/spire-office-net.html
新功能:
document doc1 = new document();
doc1.loadfromfile(inputfile2);
document doc2 = new document();
doc2.loadfromfile(inputfile1);
doc1.compare(doc2, "summer");
doc1.savetofile(outputfile);
doc1.dispose();
调整:
问题修复:
问题修复:
新功能:
presentation presentation = new presentation();
presentation.loadfromfile(pptfile);
islide slide = presentation.slides[0];
//添加节
presentation.sectionlist.add("section1", slide);
//获取节
section section;
string name;
for (int i = 0; i < presentation.sectionlist.count; i )
{
section = presentation.sectionlist[i];
name = section.name;
foreach (long id in section.slideidlist)
{
}
}
ismartart smartart = presentation.slides[0].shapes[0] as ismartart;
int count =smartart.nodes.count;
ismartartnode node;
for (int i = 0; i < count; i )
{
node = smartart.nodes[i];
node.line.filltype = fillformattype.solid;
node.line.solidfillcolor.color = color.gray;
node.line.width = 2;
}
ismartart smartart = presentation.slides[0].shapes[0] as ismartart;
int count =smartart.nodes.count;
ismartartnode node;
for (int i = 0; i < count; i )
{
node = smartart.nodes[i];
node.linkline.filltype = fillformattype.solid;
node.linkline.solidfillcolor.color = color.gray;
node.linkline.width = 2;
node.linkline.dashstyle = linedashstyletype.systemdash;
}
问题修复:
新功能:
问题修复:
spire.pdf 6.8.5 现已正式发布。该版本成功解决了一些在转换pdf到图片,转换xps到pdf,操作以及打印pdf文件时出现的问题。详情请查阅以下内容。
问题修复:
spire.doc 8.8.2现已发布。该版本添加了比较功能, 同时做了些许调整,比如,shapegroup添加了icompositeobject接口,shapebase不再实现icompositeobject接口。除此之外,它还修复了一些word转pdf/epub及操作文档时出现的问题。详情参见下文。
新功能:
document doc1 = new document();
doc1.loadfromfile(inputfile2);
document doc2 = new document();
doc2.loadfromfile(inputfile1);
doc1.compare(doc2, "summer");
doc1.savetofile(outputfile);
doc1.dispose();
调整:
问题修复:
spire.office for java 3.8.2于今日发布。该版本包含了许多新功能,比如,spire.doc支持获取水印的类型, spire.pdf支持提取文本时用空行代替文档中的横线, spire.xls支持转换excel到tiff, spire.presentation支持获取ppt节。除此以外,一些在加载、操作和转换word、excel、pdf和presentation文档时出现的问题也得以成功解决。详情参加下文。
获取spire.office for java 3.8.2,请点击:https://www.e-iceblue.cn/downloads/spire-office-java.html
新功能:
doc.getbuiltindocumentproperties().sethyperlinkbase(data);
watermarkbase waterbase = doc.getdocument().getwatermark();
string watertype = waterbase.gettype().name();
int value =waterbase.gettype().getvalue();
问题修复:
新功能:
优化:
问题修复:
新功能:
worksheet.savetotiff(name);
worksheet.savetotiff(name,starrow,startcolumn,endrow,endcolumn);
问题修复:
新功能:
sectionlist list= presentation.getsectionlist();
list.get(0).getname();
iautoshape autoshape=presentation.getslides().get(0).getshapes().appendshape(shapetype.rectangle,new rectangle2d.double(100,100,100,100));
autoshape.setclick(clickhyperlink.getlastvievedslide());
问题修复: