首页 >> 宝藏问答 >

ole对象是什么(ole对象)

2023-08-04 10:03:40

问题描述:

ole对象是什么(ole对象),卡了三天了,求给个解决办法!

最佳答案

推荐答案

2023-08-04 10:03:40

你们好,最近小时发现有诸多的小伙伴们对于ole对象是什么,ole对象这个问题都颇为感兴趣的,今天小活为大家梳理了下,一起往下看看吧。

1、 下载Spire。Office 3.9.1,并将Spire.XLS.dll文件和Spire.Presentation.dll文件引用到项目中。

2、 将代码放在Visual Studio中:

3、 【C#】

4、 using System;

5、 using System.Collections.Generic;

6、 using System.Linq;

7、 using System.Text;

8、 using System.Threading.Tasks;

9、 using Spire.Xls;

10、 using System.Drawing;

11、 using Spire.Presentation;

12、 using Spire.Presentation.Drawing;

13、 using System.IO;

14、 namespace Insert_OLE_to_PPT

15、 {

16、 class Program

17、 {

18、 static void Main(string[] args)

19、 {

20、 //加载Excel文档

21、 Workbook book=new Workbook();

22、 book.LoadFromFile('Sample.xlsx');

23、 //选择一系列单元格,并将其另存为图像。

24、 Image image=book. Sheet [0]. ToImage(1,1,5,5); //Create a new presentation software document.

25、 Presentation ppt=new Presentation();

26、 //在PowerPoint文档中插入图像

27、 IImageData oleImage=ppt.Images.Append(image);

28、 Rectangle rec=new Rectangle(60, 60, image.Width, image.Height); using (MemoryStream ms=new MemoryStream())

29、 {

30、 //将Excel数据保存到流中。

31、 book.SaveToStream(ms);

32、 ms.Position=0;

33、 //根据Excel数据将OLE对象插入PowerPoint文档。

34、 Spire.Presentation.IOleObject oleObject=ppt.Slides[0].Shapes.AppendOleObject('excel', ms.ToArray(), rec);

35、 oleObject.SubstituteImagePictureFillFormat.Picture.EmbedImage=oleImage;

36、 oleObject.ProgId='Excel.Sheet.12';

37、 }

38、 //保存文档

39、 ppt .SaveToFile('插入' OLE.pptx 'Spire .演示文稿。文件格式。pptx 2013);

40、 }

41、 }

42、 }

以上就是ole对象这篇文章的一些介绍,希望对大家有所帮助。

  免责声明:本答案或内容为用户上传,不代表本网观点。其原创性以及文中陈述文字和内容未经本站证实,对本文以及其中全部或者部分内容、文字的真实性、完整性、及时性本站不作任何保证或承诺,请读者仅作参考,并请自行核实相关内容。 如遇侵权请及时联系本站删除。

 
分享:
最新文章