没有找到合适的产品?
联系客服协助选型:023-68661681
提供3000多款全球软件/控件产品
针对软件研发的各个阶段提供专业培训与技术咨询
根据客户需求提供定制化的软件开发服务
全球知名设计软件,显著提升设计质量
打造以经营为中心,实现生产过程透明化管理
帮助企业合理产能分配,提高资源利用率
快速打造数字化生产线,实现全流程追溯
生产过程精准追溯,满足企业合规要求
以六西格玛为理论基础,实现产品质量全数字化管理
通过大屏电子看板,实现车间透明化管理
对设备进行全生命周期管理,提高设备综合利用率
实现设备数据的实时采集与监控
利用数字化技术提升油气勘探的效率和成功率
钻井计划优化、实时监控和风险评估
提供业务洞察与决策支持实现数据驱动决策
翻译|产品更新|编辑:李显亮|2019-07-03 10:58:25.643|阅读 243 次
概述:近期我们更新了Aspose.Slides For .Net v19.6,其中很重要的是丰富了改进的图像管理支持功能。其中,基于.NET的API中可用的内容也适用于Java,Android,通过基于Java和C ++的API。
# 界面/图表报表/文档/IDE等千款热门软控件火热销售中 >>
近期我们更新了Aspose.Slides For .Net v19.6,其中很重要的是丰富了改进的图像管理支持功能。其中,基于.NET的API中可用的内容也适用于Java,Android,通过基于Java和C ++的API。通过这种方式,用户可以轻松使用他们正在使用的API,并且可以使用相同的功能。
Aspose.Words For .Net是一种高级Word文档处理API,用于执行各种文档管理和操作任务。API支持生成,修改,转换,呈现和打印文档,而无需在跨平台应用程序中直接使用Microsoft Word。此外,API支持所有流行的Word处理文件格式,并允许将Word文档导出或转换为固定布局文件格式和最常用的图像/多媒体格式。
接下来,将详细讲解一些非常有趣且重要的新功能以及API进行的一些改进。
【下载Aspose.Words for .NET最新试用版】
处理PowerPoint演示文稿时,在演示文稿中处理图像起着关键作用。有时需要在演示中添加大量图像。MS PowerPoint包括blob等图像。新版中为IImageCollection接口和ImageCollection类添加了一个新方法,以支持将大图像作为流添加以将它们视为BLOB。
下面这个例子演示了如何包含大BLOB(图像)并防止高内存消耗:
//文档目录的路径。
string dataDir = RunExamples.GetDataDir_PresentationSaving();
string pathToLargeImage = dataDir + "large_image.jpg";
//创建一个包含此图像的新演示文稿
using (Presentation pres = new Presentation())
{
using (FileStream fileStream = new FileStream(pathToLargeImage, FileMode.Open))
{
//让我们将图像添加到演示文稿中 - 我们选择KeepLocked行为,因为我们没有
//有意访问“largeImage.png”文件。
IPPImage img = pres.Images.AddImage(fileStream, LoadingStreamBehavior.KeepLocked);
pres.Slides[0].Shapes.AddPictureFrame(ShapeType.Rectangle, 0, 0, 300, 200, img);
//保存演示文稿 尽管输出演示将是
//较大时,内存消耗将低于pres对象的整个生命周期
pres.Save(dataDir + "presentationWithLargeImage.pptx", SaveFormat.Pptx);
}
}类似的基于Java的示例:
//文档目录的路径。
String dataDir = Utils.getDataDir(AddBlobImageToPresentation.class);
//假设我们想要包含在演示文稿中的大图像文件
String pathToLargeImage = dataDir + "large_image.jpg";
//创建一个包含此图像的新演示文稿
Presentation pres = new Presentation();
try
{
FileInputStream fip = new FileInputStream(pathToLargeImage);
try
{
//让我们将图像添加到演示文稿中 - 我们选择KeepLocked行为
//意图访问“largeImage.png”文件。
IPPImage img = pres.getImages().addImage(fip, LoadingStreamBehavior.KeepLocked);
pres.getSlides().get_Item(0).getShapes().addPictureFrame(ShapeType.Rectangle, 0, 0, 300, 200, img);
//保存演示文稿
// 较大时,pres对象的整个生命周期内的内存消耗将较低
pres.save(dataDir + "presentationWithLargeImage.pptx", SaveFormat.Pptx);
}
finally {
fip.close();
}
} catch (java.io.IOException e) {
e.printStackTrace();
} finally {
pres.dispose();
}基于C ++的类似示例:
//假设我们想要包含在演示文稿中的大图像文件 System::String pathToLargeImage = u"../templates/largeImage.jpg"; //创建一个包含此图像的新演示文稿 auto pres = System::MakeObject(); auto fileStream = System::MakeObject(pathToLargeImage, System::IO::FileMode::Open); //让我们将图像添加到演示文稿中 - 我们选择KeepLocked行为 //意图访问“largeImage.png”文件。 auto img = pres->get_Images()->AddImage(fileStream, LoadingStreamBehavior::KeepLocked); pres->get_Slides()->idx_get(0)->get_Shapes()->AddPictureFrame(Aspose::Slides::ShapeType::Rectangle, 0.0f, 0.0f, 300.0f, 200.0f, img); //保存演示文稿 // 较大时,pres对象的整个生命周期内的内存消耗将较低 pres->Save(u"../out/presentationWithLargeImage.pptx", Aspose::Slides::Export::SaveFormat::Pptx);
在这个版本中,Aspose.Slides提供了表示幻灯片有效背景的支持,其中包含有效填充格式和有效效果格式的信息。为此,添加了IBackgroundEffectiveData接口及其BackgroundEffectiveData类的实现。
CreateBackgroundEffective方法已添加到IBaseSlide接口和BaseSlide类中。此方法允许获得幻灯片背景的有效值。以下示例显示如何获取幻灯片的有效背景值。
//文档目录的路径。
string dataDir = RunExamples.GetDataDir_Slides_Presentations_Background();
//实例化表示演示文稿文件的Presentation类
Presentation pres = new Presentation(dataDir + "SamplePresentation.pptx");
IBackgroundEffectiveData effBackground = pres.Slides[0].CreateBackgroundEffective();
if (effBackground.FillFormat.FillType == FillType.Solid)
Console.WriteLine("Fill color: " + effBackground.FillFormat.SolidFillColor);
else
Console.WriteLine("Fill type: " + effBackground.FillFormat.FillType);类似的基于Java的示例:
//文档目录的路径。
String dataDir = Utils.getDataDir(GetBackgroundEffectiveValues.class);
Presentation pres = new Presentation(dataDir + "SamplePresentation.pptx");
IBackgroundEffectiveData effBackground = pres.getSlides().get_Item(0).createBackgroundEffective();
if (effBackground.getFillFormat().getFillType() == FillType.Solid)
System.out.println("Fill color: " + effBackground.getFillFormat().getSolidFillColor());
else
System.out.println("Fill type: " + effBackground.getFillFormat().getFillType());基于C ++的类似示例:
const String templatePath = u"../templates/SamplePresentation.pptx";
auto pres = System::MakeObject(templatePath);
System::SharedPtreffBackground = pres->get_Slides()->idx_get(0)->CreateBackgroundEffective();
if (effBackground->get_FillFormat()->get_FillType() == Aspose::Slides::FillType::Solid)
{
System::Console::WriteLine(System::String(u"Fill color: ") + effBackground->get_FillFormat()->get_SolidFillColor());
}
else
{
System::Console::WriteLine(System::String(u"Fill type: ") + System::ObjectExt::ToString(effBackground->get_FillFormat()->get_FillType()));
}使用时,Aspose.Slides有时需要保存大量的演示文件或将大型演示文件转换为PDF。在这种情况下,API用户可能经历等待状态直到保存或呈现过程完成的时间并且这种情况有时令人讨厌。为了缓解这种情况,在ISaveOptions接口和SaveOptions抽象类中添加了一个新的IProgressCallback接口。IProgressCallback接口表示用于以百分比保存进度更新的回调对象。
下面的示例演示了在导出到PDF时使用新功能:
//文档目录的路径。
string dataDir = RunExamples.GetDataDir_Conversion();
using (Presentation presentation = new Presentation(dataDir + "ConvertToPDF.pptx"))
{
ISaveOptions saveOptions = new PdfOptions();
saveOptions.ProgressCallback = new ExportProgressHandler();
presentation.Save(dataDir + "ConvertToPDF.pdf", SaveFormat.Pdf, saveOptions);
}class ExportProgressHandler : IProgressCallback
{
public void Reporting(double progressValue)
{
// Use progress percentage value here
int progress = Convert.ToInt32(progressValue);
Console.WriteLine(progress + "% file converted");
}
}类似的基于Java的示例:
//文档目录的路径。
String dataDir = Utils.getDataDir(CovertToPDFWithProgressUpdate.class);
Presentation presentation = new Presentation(dataDir + "ConvertToPDF.pptx");
try
{
ISaveOptions saveOptions = new PdfOptions();
saveOptions.setProgressCallback((IProgressCallback) new ExportProgressHandler());
presentation.save(dataDir + "ConvertToPDF.pdf", SaveFormat.Pdf, saveOptions);
}finally {
presentation.dispose();
}//文档目录的路径。
class ExportProgressHandler implements IProgressCallback {
public void reporting(double progressValue) {
//在此使用进度百分比值
}
}基于C ++的类似示例:
const String templatePath = u“ ../ templates/ SamplePresentation.pptx ” ; const String outPath = u“ ../out/SamplePresentation_out.pptx ” ; auto presentation = System :: MakeObject(templatePath); System :: SharedPtrsaveOptions = System :: MakeObject(); System :: SharedPtrcallBack = System :: MakeObject(); saveOptions-> set_ProgressCallback(callBack); presentation-> Save(outPath,Aspose :: Slides :: Export :: SaveFormat :: Pdf,saveOptions);
class ExportProgressHandler : public IProgressCallback
{
public:
void Reporting(double progressValue)
{
//...
}
};此版本中包含许多其他功能,增强功能和错误修复程序。更多更新细则可参考【Aspose.Slides For .Net v19.6更新说明】
*如有更多疑惑和资源需求可加入ASPOSE控件讨论QQ群(642018183),与大神们一起交流讨论!
本站文章除注明转载外,均为本站原创或翻译。欢迎任何形式的转载,但请务必注明出处、不得修改原文相关链接,如果存在内容上的异议请邮件反馈至chenjj@ke049m.cn
文章转载自:



本文将介绍界面组件Telerik UI for WinForms在今年第三个重大版本2025 Q3中发布的新功能,欢迎下载最新版组件体验!
界面控件DevExpress WinForms v25.2将于今年年末左右更新,新版本将继续升级报表组件功能等,欢迎关注我们及时获取最新消息~
DevExpress WinForms控件v25.1日前已经全新发布,新版本的Ribbon、PDF Viewer(查看器)等组件功能全新升级等,欢迎下载最新版体验!
界面控件DevExpress WinForms v25.2将于今年年末左右更新,新版本将继续升级富文本编辑器控件功能等,欢迎关注我们及时获取最新消息~
服务电话
重庆/ 023-68661681
华东/ 13452821722
华南/ 18100878085
华北/ 17347785263
客户支持
技术支持咨询服务
服务热线:400-700-1020
邮箱:sales@ke049m.cn
关注我们
地址 : 重庆市九龙坡区火炬大道69号6幢
半岛外围网上直营